nodesmith / eth-plot

r/place inspired Dapp
https://medium.com/@brendan_87166/28b01f9fc244
MIT License
37 stars 6 forks source link

Allow buyout input to accept any number. #70

Closed lbrendanl closed 6 years ago

lbrendanl commented 6 years ago

This fixes #69

The bug was that that a user couldn't enter numbers of the form '1.00' or '0.003'. This is because the component was using the buyout value directly as the value to display.

I switched things around so that the component uses a state variable to track the display value - while still updating the actual value for the buyout price as before.

I had to do some work to make sure the display value updated correctly when switching the units is the only place where this got a bit convoluted. Could be less hardcoded, but I think it's fine for now since we wouldn't ever support more than three types of units.

I also made the default price for the buyout component always 0.