Make calculator functional
Calculator, currently is non-function. Make it function:
- Click on buttons to add numbers and symbols to the equation
- If calculator is focused, what is typed is also taken for input
- If the equation ends with an operator, replicate the whole structure on the right side
I'll be working on this myself, though if you got any suggestions, comment here. And if you wish to contribute, comment here, and while making the PR, choose feat/functional-calculator as the branch to merge to.
I'll not be working on this. If you wish to volunteer, you'll have my gratitude
I can take it
Thanks. Please take a look at the naming conventions, try not too include any extra library if you can help it, and overall, just make it good. Will be waiting for your PR :)
Great!
I checked in into the feat/functional-calculator branch and run yarn and yarn start to bootstrap the project.
But I got a blank page with styled mouse cursor and the error of:
Uncaught TypeError: Cannot set property default of #<Object> which has only a getter
at _interopRequireWildcard (react-rnd.js:1831)
at node_modules/react-draggable/build/cjs/Draggable.js (react-rnd.js:1787)
at __require (chunk-KYLA5N2V.js:12)
at node_modules/react-draggable/build/cjs/cjs.js (react-rnd.js:2276)
at __require (chunk-KYLA5N2V.js:12)
at react-rnd.js:2364
In Draggable.js:36.
Am I missing something?
UPDATE: After removing:
import { Rnd } from 'react-rnd';
and its usage the problem solved
Uhh yeah, I recommend you make your own branch and start over, that one has issues
Its related to Vite's version. Its fixed in main branch. Make a branch off of main anf start, nothing much in function-calculator brqnch anyway
Alright, Thanks :)
It's still an issue - when pressing one of the apps in the bottom toolbar - I cannot open it and see this error in the console Did you solve it in your environment?
@PuruVJ
Any update on it?
I updated the code to the latest version with the committed yarn.lock. NOTICE: the issue occurs only after I click some dock item to open the app window
Uhh yeah, its because I have package-lock.json as lock file(we're using npm here), so yarn might be skipping it. Try using npm, and if you can't, install [email protected] exact. That fixes the problem
Thanks - it works, I installed it with npm 👍
Still WIP - I did not know that calculator logic contains so many edge cases. I first try to write the logic straight-forward (https://github.com/nirtamir2/macos-web/tree/feat/calculator) and now I try to write it with TDD for incremental progression (https://github.com/nirtamir2/macos-web/tree/feat/calculator-tdd)
That is great! I love the fact you're still at it after so long! 🤗
Using TDD here feels like a great way going forward. Document the functionality, and use it as a map going forward!! Kudos!
Looked at the code, and it looks great to me. Would be happy to merge when it is complete 👌