-
Notifications
You must be signed in to change notification settings - Fork 100
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(ReviewTransaction): add new review component to SendConfirmation #6436
Conversation
…t-item-to-new-review
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6436 +/- ##
=======================================
Coverage 89.11% 89.11%
=======================================
Files 733 731 -2
Lines 31907 31859 -48
Branches 6099 6082 -17
=======================================
- Hits 28433 28391 -42
+ Misses 3427 3422 -5
+ Partials 47 46 -1
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
bcc174b
to
6e3b7d9
Compare
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!
"bottom": "additive", | ||
"left": "additive", | ||
"right": "additive", | ||
"bottom": "off", |
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.
can we remove the test that generates this snapshot? snapshot tests are particularly ineffective in a refactor like this
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.
Sure, I didn't know removal of snapshots are allowed! (assumed there was a reason for existing ones to be present considering that there are only a few of those)
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.
@kathaypacific further down the line, should I also remove snapshots if any other changes for other tasks involve updating snapshot? Or should that decision depend on the task/component?
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.
yes please remove any snapshots tests going forward that are not adding any value! ideally we want to replace all snapshot tests but sometimes you don't want to get bogged down with rewriting tests, so it depends on the task. but any suite where it looks like there's coverage over the main functionality already, please feel free to delete the snapshots tests
) | ||
|
||
expect(queryByTestId('RecipientAddress')).toBeFalsy() | ||
}) |
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.
should we backfill on some tests about what is rendered? i know there are unit tests for the components that are used, but tests here would help to ensure that the components are used correctly
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.
(this doesn't have to be elaborate btw, but one test that asserts that a happy scenario is rendered might be helpful?)
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.
Of course! My understanding was that if the current tests were enough for the existing screen - they should be fine for the new one, considering that it is basically just a redesign. So I removed the tests that are now covered with the reusable component.
But I see the point as it totally makes sense to ensure that all of the old and new pieces are rendered correctly. Will do!
const walletAddress = useSelector(walletAddressSelector) | ||
const feeCurrencies = useSelector((state) => feeCurrenciesSelector(state, tokenInfo!.networkId)) | ||
|
||
const dispatch = useDispatch() | ||
const { maxFeeAmount, feeCurrency: feeTokenInfo } = |
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.
can we please double check whether we want to be showing the maxFeeAmount or the estimatedFeeAmount? this doesn't matter so much on most networks but when transacting on Ethereum, this could make a big difference. on the designs i see that we are using the approx symbol so i guess that we want to show estimatedFeeAmount
...
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.
What's the best way for me to check this? Considering that this is the same value that was used for all this time I presumed that this was an intended way (as it wouldn't ever be the case that we estimated some X value and but it appeared to be bigger once the transaction was completed). Should I check it out with Kayla or Laura?
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.
yes perhaps this is a detail we can check separately, i can help to start a thread in figma. for context, we discussed this at length with swaps because we saw the max vs estimated gas fees differed by $20-60USD at times on Ethereum, of course this depends on the gas price and usd price of ETH on the day but this is why we decided to show estimated value rather than max for swaps (and show the max in the bottom sheet instead)
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.
Thank you, I'll pick it up from there and will re-post the final decision here for visibility!
src/send/SendConfirmation.tsx
Outdated
token: formatValueToDisplay(tokenFeeAmount), | ||
local: localFeeAmount ? formatValueToDisplay(localFeeAmount) : undefined, | ||
}), | ||
[localFeeAmount, tokenFeeAmount, feeTokenInfo] |
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.
[localFeeAmount, tokenFeeAmount, feeTokenInfo] | |
[localFeeAmount, tokenFeeAmount] |
i wonder if this variable is necessary given that we only use it in one place below?
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.
Forgot to remove after the last changes to this variable. Will remove!
src/send/SendConfirmation.tsx
Outdated
@@ -174,124 +138,101 @@ function SendConfirmation(props: Props) { | |||
tokenId, | |||
usdAmount, | |||
recipient, | |||
fromModal, | |||
// TODO remove fromModal from `sendPayment` | |||
false, |
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.
does this break any existing flows? taking a quick look i think it affects how the navigation works after the transaction is finished, perhaps it is worth keeping this variable and renaming it instead?
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.
As I was looking at it I thought that once the modal is removed then we'll always redirect the user to the home page (cause now its a separate screen and not the overlay modal). But you're right, I misunderstood it. It's not as much related to whether its overlay or separate screen but more to the aspect of whether its a request from a DAPP that expects you to get back to it once you press back button instead of being redirected to the home screen (in this case bidali and it's also the only thing using this different redirect).
I will adjust the name of the screen in Screens
and rename all the related arguments/variable.
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.
@kathaypacific I've reverted this change for this PR. It will not disrupt the existing flows anymore but the naming change will involve renaming all the occurrences of the screen name and fromModal argument which will add ~10 extra files changes + update of RootStateSchema
so I would suggest committing renames in the follow-up PR, would you agree?
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.
oh yes totally, makes sense
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.
@kathaypacific here's the PR for the renaming!
src/send/SendConfirmation.tsx
Outdated
: undefined | ||
} | ||
<ReviewTransaction | ||
title="Review Send" |
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.
should this use translations?
src/send/SendConfirmation.tsx
Outdated
{tokenInfo && ( | ||
<ReviewSummaryItem | ||
testID="SendConfirmationToken" | ||
label="Sending" |
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.
should this use translations?
src/send/SendConfirmation.tsx
Outdated
<ReviewDetailsItem | ||
testID="SendConfirmationNetwork" | ||
label={t('transactionDetails.network')} | ||
value={tokenInfo && NETWORK_NAMES[tokenInfo.networkId]} |
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.
value={tokenInfo && NETWORK_NAMES[tokenInfo.networkId]} | |
value={NETWORK_NAMES[tokenInfo.networkId]} |
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.
🚀✨
Description
This PR adds new
ReviewTransaction
component to theSendConfirmation
.Test plan
Fixed existing tests.
Related issues
Relates to RET-1295
Backwards compatibility
Yes
If a new NetworkId and/or Network are added in the future, the changes in this PR will: