-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(swap): Initial Swap screen redesign #5409
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5409 +/- ##
=======================================
Coverage 86.31% 86.31%
=======================================
Files 756 756
Lines 31185 31205 +20
Branches 5347 5353 +6
=======================================
+ Hits 26916 26935 +19
- Misses 4036 4037 +1
Partials 233 233
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Things/questions I noted from the video:
- Does the token selection also work when tapping the container of the down arrow?
- The right padding/margin in the skeleton loader seems different from the left one. It should be the same.
- The ripple effect on the switch token button is being clipped by containers above and below it. It should be above them.
- I'm slightly concerned by the fact that the "MAX" button can change position based on the length of the $ value. Maybe something we can improve with Kayla?
Responding to some comments:
It did not, but now it does - this required a bit of rejiggering to how Touchables work, since the border radius is uneven depending on the state of the screen.
Thanks! This has been fixed.
This was a tricky one. I'm somewhat sure that we were running up against this bug, since I did not encounter the adverse overlapping behavior when using
The designs have been updated to move the "MAX" button to the right of the fiat estimation.
Would you mind testing on iOS again? This is working on Android, but made a few small changes.
I've raised this with Kayla, waiting to hear back about design ideas.
Addressed above!
I suppose we could do this, though if the ripple is working correctly (which it should be, now) we could also stick with that. See new video here: swap-redesign-2-2024-05-14_16.08.42.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking great!
src/components/Touchable.tsx
Outdated
<PlatformTouchable | ||
{...passThroughProps} | ||
background={useForeground ? undefined : background} | ||
foreground={useForeground ? background : undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i got really hung up on this even though it's not important because it's not easy to understand what useForeground
means. (also reading if useForeground, use background
is weird). it seems like this prop should be used if the Touchable has any images as children and you want the ripple to be rendered above the image
- so perhaps a more intuitive prop for this component could be shouldRenderRippleAbove
or rippleAboveImages
or hasImageChildren
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, agreed that it's weird as-is... I like shouldRenderRippleAbove
, since it does have utility outside of using images within the Touchable.
...fontStyles.xsmall, | ||
fontWeight: 'bold', | ||
tokenInfo: { | ||
flexDirection: 'row', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you need an alignItems center here so that the icon is vertically centered. if you increase your device font size, the icon is no longer centered currently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump on this! :)
}, | ||
fiatValue: { | ||
...typeScale.bodyXSmall, | ||
paddingLeft: Spacing.Smallest8, | ||
maxWidth: '40%', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we're adding a max width, we should also add a numberOfLines={1}
so that the text is ellipsised when the limit is hit rather than spreading to new lines (e.g. if you type a long number like 123455678923624856 in the token amount - unlikely to happen but if the device font size is large then this number can become smaller to reach the limit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, good catch.. I had tried to do this but was setting numberOfLines={1}
at the wrong layer and it wasn't working as intended. Setting it on the SwapAmountInput/FiatValue
component works well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great!! 💅🏼
src/swap/SwapScreen.test.tsx
Outdated
expect(within(swapFromContainer).getByText('CELO')).toBeTruthy() | ||
|
||
expect(within(swapToContainer).getByTestId('SwapAmountInput/Input')).toBeTruthy() | ||
expect(within(swapToContainer).getByText('cUSD')).toBeTruthy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: selectSwapTokens
already includes these assertions so you don't need to do it again here :)
...fontStyles.xsmall, | ||
fontWeight: 'bold', | ||
tokenInfo: { | ||
flexDirection: 'row', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump on this! :)
Description
First part of RET-1065. Updates the design of swap screen to match the designs in Figma. The rest of the behavior outlined in the ticket will come in followup PRs.
Test plan
Unit and manual tested. See video below:
swap-redesign-2024-05-13_17.03.19.mp4
Related issues
Backwards compatibility
Yes.
Network scalability
If a new NetworkId and/or Network are added in the future, the changes in this PR will: