rainbow-me / rainbow

🌈‒ the Ethereum wallet that lives in your pocket
https://rainbow.me
GNU General Public License v3.0
3.9k stars 607 forks source link

Fixes for review button states #5873

Closed jinchung closed 3 months ago

jinchung commented 3 months ago

NOTE: Please see the comments inline of the code to better map out where each of the fixes below correspond in the code.

NOTE: will attach screen recordings / screenshots in comments below so as not to blow up this description section.

Fixes in this branch:

  1. typing in an input amount that causes insufficient funds and then deleting the input amount to 0 still displays Insufficient Funds
  2. relying on the quote as a source of truth for the sell amount can cause the button to flicker because the quote can still technically have a value / not have an error, even though it is now out of date
  3. previously: the sellAmount calculation was returning two different orders of magnitude in the response which was incorrect. e.g, when there's a quote error, it would return the input amount (like "1.234") but if there's a quote, it would return the raw sell amount (like "12340") which we were using later for comparisons against another raw amount
  4. Fixes APP-1601: gas button can display a fee of $0.00 instead of proper handling of amounts below $0.01
  5. updated logic for "Enter Amount" label (please review)
  6. updated the ordering to also reduce flickering of the button

WHAT STILL NEEDS TO BE FIXED:

  1. (IN PROGRESS) incorporating Ben's final max swappable input changes: currently max input can incorrectly show insufficient funds; we will need the maxSwappableAmount to stop being updated on every gas update
  2. (IN PROGRESS FROM GREGS) "tap to swap" button no longer has haptic feedback
  3. (IN PROGRESS FROM GREGS) neither the review button nor the confirm swap button have press states (they should scale down on press)
linear[bot] commented 3 months ago

APP-1601 Gas button can display a fee of $0.00