Zeroclickinfo-goodies: Calculator: [Stage 1] Add Interactive UI to Calculator

Created on 18 Mar 2017  路  11Comments  路  Source: duckduckgo/zeroclickinfo-goodies

Problem

A lot of user feedback has requested an interactive calculator. A Pull Request was created 2 years ago to create a JS based interactive calculator... but was unfortunately never finished. It was first implemented as a Spice, but it should now be created as a Goodie. There is now 30 open issues against the calculator IA. We should put them all on hold to get this working.

Screenshot

Solution [Stage 1]

For now, we should reduce ambitions and be more realistic.

The developer should:

  1. Implement these UI assets on top of the existing calculator Instant Answer

  2. Get the basic calculations to work. See stage 1 in the figure below (Red box).

687474703a2f2f692e696d6775722e636f6d2f614d684f4c77662e706e67

Implementation

  • Use DDG.require("math.js", function(){ ... }) to make Math.js available to the Instant Answer

This is a top priority task and requires an experienced DuckDuckHack contributor.

People to notify

  • @pjhampton
  • @moollaza

Get Started

Resources


Instant Answer Page: https://duck.co/ia/view/calculator

Highest Impact Tasks High High Handlebars.js JavaScript Perl Calculator

Most helpful comment

That's fine 馃槃 These are external dependencies. See Math.js.

Using math.js allows strings to be easily evaluated as mathematical expressions, using the math.eval() function. Moment.js is also an external dep but has nothing to do with this project. Hope that helps!

All 11 comments

cc. @zodiac403, @Lord-Lavios

Anyone working on this right now?

@kirkins I was going to start working on this tomorrow but if you want to work on this, go ahead.

In the implementation there is a math.js mentioned. I've looked through the file structure of the repo a few times and don't see it.

Would that be a completely new file or am I missing it?

This is a difficult / high-priority / urgent issue @kirkins. Please only take it if you feel you have the programming expertise to take it forward 馃憤

As for math.js, this was added by the internal guys last week. To bring it into scope, you would wrap the logic with the following statement.

DDG.require('math.js', function(){})

An example would be https://github.com/duckduckgo/zeroclickinfo-goodies/blob/ba2760f03485f32f10de1e85c19b11415cb8528b/share/goodie/countdown/countdown.js#L143

@pjhampton thanks for the example. I'm still wondering where to see the contents of math.js ?

Same for the moment.js file in the example you posted. Doing a search for moment.js I only find that single reference.

Are these two files closed source or located in another repo?

@pjhampton I will let @Lord-Lavios work on this one since it is high-priority and this would be my first duckduckgo module.

I have another idea to improve a different IA module anyways. Though I'm still curious about my question above.

That's fine 馃槃 These are external dependencies. See Math.js.

Using math.js allows strings to be easily evaluated as mathematical expressions, using the math.eval() function. Moment.js is also an external dep but has nothing to do with this project. Hope that helps!

@Lord-Lavios so can I take it you're happy taking this forward? 馃槃

I will take phase 1 forward.

@pjhampton 馃憤 Sorry, for the delay. I wasn't able to find time earlier and then it took some time to figure out how to do it and stuff.

That's cool, @Lord-Lavios 馃挋 Thanks anyway!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nickrsan picture nickrsan  路  29Comments

atomic1fire picture atomic1fire  路  15Comments

unhammer picture unhammer  路  14Comments

rushsteve1 picture rushsteve1  路  13Comments

moollaza picture moollaza  路  42Comments