Skip to content
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

Token allowance screen updated #16157

Merged
merged 5 commits into from
Nov 7, 2022
Merged

Conversation

filipsekulic
Copy link
Contributor

Explanation

Updated the Token allowance screen.

More Information

Screenshots/Screencaps

Before

Before.mov

After

After.mov

Manual Testing Steps

BEFORE TESTING - in your .metamaskrc file, set TOKEN_ALLOWANCE_IMPROVEMENTS=1 and then start the app

  1. Open the Test Dapp: https://metamask.github.io/test-dapp/
  2. Under the section Send Tokens click on CREATE TOKEN
  3. Wait for the token to be created and then, under the same section, click on APPROVE TOKENS or APPROVE TOKENS WITHOUT GAS in order to see the newly created screen

To see how the screen looks like when the enhanced gas fee is enabled, go to Settings (Experimental tab) and enable it (Enable enhanced gas fee UI toggle).

@filipsekulic filipsekulic self-assigned this Oct 11, 2022
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@filipsekulic filipsekulic force-pushed the token-allowance-screen-update branch from b5287f0 to da2438d Compare October 11, 2022 10:33
@metamaskbot
Copy link
Collaborator

Builds ready [da2438d]
Page Load Metrics (2501 ± 93 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1022442236506243
domContentLoaded20112868248219292
load20402868250119493
domInteractive20112868248219292

highlights:

storybook

@mirjanaKukic
Copy link
Contributor

Verified by QA

@metamaskbot
Copy link
Collaborator

Builds ready [7be0fcc]
Page Load Metrics (2576 ± 99 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint93154119178
domContentLoaded22732963254720397
load22732963257620699
domInteractive22732963254720397

highlights:

storybook

@filipsekulic filipsekulic marked this pull request as ready for review October 12, 2022 09:08
@filipsekulic filipsekulic requested a review from a team as a code owner October 12, 2022 09:08
@filipsekulic
Copy link
Contributor Author

@brad-decker @georgewrmarshall
As mentioned and agreed here, I added storybook and prop type descriptions for ApproveContentCard component.

Copy link
Contributor

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stories and UI lgtm!

  • tested using the test app

@@ -2938,6 +2938,9 @@
"message": "By revoking permission, the following $1 will no longer be able to access your $2",
"description": "$1 is either key 'account' or 'contract', and $2 is either a string or link of a given token symbol or name"
},
"revokeSpendingCap": {
"message": "Revoke spending cap for your"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize that the existing translations are like this, but this should have a $1 here where the value that will come after "your" will be placed. Here is a ticket to fix this. We can fix it after this PR is merged: #16234

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @danjm!
Should I wait for someone else to fix #16234 and then to fix the issue you referenced here, or should I fix both of these issues?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like PR is here #16347, so your question is addressed

@danjm
Copy link
Contributor

danjm commented Oct 19, 2022

I am unable enter a decimal number for the custom approval amount, unless I copy and paste from elsewhere

Peek.2022-10-19.12-24.mp4

@danjm
Copy link
Contributor

danjm commented Oct 19, 2022

@bschorchit should we show a warning if the amount the user sets (or the amount the dapp proposes) is equal to their total balance?

@@ -128,17 +145,36 @@ export default function TokenAllowance({
fullTxData.originalApprovalAmount = dappProposedTokenAmount;
}

if (customTokenAmount) {
txData.customTokenAmount = customTokenAmount;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be fullTxData instead of txData?

Updating txData here does not seem to have any effect

Copy link
Contributor Author

@filipsekulic filipsekulic Oct 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!
Yes, I accidentally used txData instead of fullTxData.
Fixed here: 679cab6

@@ -128,17 +145,36 @@ export default function TokenAllowance({
fullTxData.originalApprovalAmount = dappProposedTokenAmount;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fullTxData.txParams.data is not updated anywhere, so if a user enters a custom amount, the approval will still be submitted with the default amount

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch once again! 🙌
I fixed it here: 679cab6

@danjm
Copy link
Contributor

danjm commented Oct 19, 2022

We can improve how state management is done for the custom token data. I created a PR with suggested changes #16236

Its possible my changes break something... maybe there is a case that the code I am replacing was meant to handle. If so, we can discuss and modify.

Copy link
Contributor

@danjm danjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left a few comments that need to be addressed before we merge.

@filipsekulic
Copy link
Contributor Author

I am unable enter a decimal number for the custom approval amount, unless I copy and paste from elsewhere

Peek.2022-10-19.12-24.mp4

There is a problem with NumericInput component which is being used inside the FormField component.
Peter (QA engineer) has opened this issue here: #16084

@filipsekulic
Copy link
Contributor Author

We can improve how state management is done for the custom token data. I created a PR with suggested changes #16236

Its possible my changes break something... maybe there is a case that the code I am replacing was meant to handle. If so, we can discuss and modify.

You are right. I made this 'mistake' as I thought the input value should be forwarded back to the container and when a user clicks on the Next button, then to manage it with Redux.
Fixed here: 679cab6

@filipsekulic filipsekulic requested a review from danjm October 21, 2022 12:38
@metamaskbot
Copy link
Collaborator

Builds ready [679cab6]
Page Load Metrics (2447 ± 63 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint93145111147
domContentLoaded22102602240512761
load22352688244713263
domInteractive22102602240512761

highlights:

storybook

@bschorchit
Copy link

@bschorchit should we show a warning if the amount the user sets (or the amount the dapp proposes) is equal to their total balance?

Oh good catch. Yes, we should also show the warning in this case. cc: @SayaGT

@@ -58,7 +63,7 @@ export default function TokenAllowance({
data,
isSetApproveForAll,
isApprovalOrRejection,
customTxParamsData,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay to stop using the customTxParamsData that is being passed into the component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually yes, because I fixed the issue with the customTxParamsData you had mentioned before (#16157 (review)).
It is now being placed inside the token-allowance container - here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, okay, and I see how the customdata that was being passed in is only used in the ConfirmApproveContent component

@danjm
Copy link
Contributor

danjm commented Nov 3, 2022

@filipsekulic should we make the change suggested in this comment or another PR? #16157 (comment)

Edit: I think it is okay to make this change in another PR

@danjm
Copy link
Contributor

danjm commented Nov 3, 2022

@georgewrmarshall Can you reapprove when you get a chance? there have not been any UI or CSS changes since you last approved

Copy link
Contributor

@georgewrmarshall georgewrmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving!

@brad-decker brad-decker merged commit 17c1fef into develop Nov 7, 2022
@brad-decker brad-decker deleted the token-allowance-screen-update branch November 7, 2022 18:21
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update "Token Allowance" screen
8 participants