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

feat: Update Redesign Signature Permit to show ellipsis at max 15 digits #26227

Merged
merged 5 commits into from
Aug 2, 2024

Conversation

digiwand
Copy link
Contributor

@digiwand digiwand commented Jul 30, 2024

Description

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2845 (Permit design review)
Fixes: #26226 (Ellipsis fix)
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2730 (older, original issue)

Follow-up Cherry-picked PR:
#26500

Manual testing steps

  1. Go to cowswap
  2. Swap a token with gas-free approve for another token
  3. Notice the permit signature screen

or

  1. run yarn storybook
  2. go to http://localhost:6006/?path=/story/pages-confirmations-confirm-signatures-signedtypeddatav3orv4--permit-story&args=msgParams.data:3.0001231231212312e+22
  3. copy and paste the following into data
"{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"Permit\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"},{\"name\":\"nonce\",\"type\":\"uint256\"},{\"name\":\"deadline\",\"type\":\"uint256\"}]},\"primaryType\":\"Permit\",\"domain\":{\"name\":\"MyToken\",\"version\":\"1\",\"verifyingContract\":\"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC\",\"chainId\":1},\"message\":{\"owner\":\"0x935e73edb9ff52e23bac7f7e043a1ecd06d05477\",\"spender\":\"0x5B38Da6a701c568545dCfcB03FcB875f56beddC4\",\"value\":30001231231212312138768,\"nonce\":0,\"deadline\":50000000000}}"

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@digiwand digiwand requested review from a team as code owners July 30, 2024 15:40
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.

@metamaskbot metamaskbot added the team-confirmations Push issues to confirmations team label Jul 30, 2024
@digiwand digiwand changed the title feat: Update ellipsis UI to display on Permit amounts at max 15 digits feat: Update Redesign Signature Permit to show ellipsis at max 15 digits Jul 30, 2024
Copy link

@metamaskbot
Copy link
Collaborator

Builds ready [25b4f0a]
Page Load Metrics (72 ± 17 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint732291023216
domContentLoaded9170303416
load41210723517
domInteractive9169303416
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 150 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [566166e]
Page Load Metrics (294 ± 264 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint663411086029
domContentLoaded8108262110
load451707294550264
domInteractive8108262110
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 150 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Jul 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.97%. Comparing base (aceea3b) to head (566166e).
Report is 11 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26227      +/-   ##
===========================================
+ Coverage    69.96%   69.97%   +0.01%     
===========================================
  Files         1411     1411              
  Lines        49946    49960      +14     
  Branches     13805    13807       +2     
===========================================
+ Hits         34942    34956      +14     
  Misses       15004    15004              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

const [integerPart] = amountText.split('.');
const cleanIntegerPart = integerPart.replace(/,/gu, '');

if (cleanIntegerPart.length > maxLeftDigits) {
Copy link
Member

Choose a reason for hiding this comment

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

Could we re-use Goktug's shortenString function here?

From ui/helpers/utils/util.js.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it’s better to keep it as is since this requires more logic to count the digits and preserve the “,”

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I lost the design and issue ticket for this and ended up created a new ticket. Now that I've seen the relevant issue, we needed to do max 15 characters and not digits
https://github.com/MetaMask/MetaMask-planning/issues/2845

Updated to use shortenString here: #26458

@digiwand digiwand requested a review from matthewwalsh0 August 1, 2024 08:35
@digiwand digiwand merged commit f001d60 into develop Aug 2, 2024
78 checks passed
@digiwand digiwand deleted the feat-permit-display-max-15-digits branch August 2, 2024 13:13
@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 2024
@metamaskbot metamaskbot added the release-12.4.0 Issue or pull request that will be included in release 12.4.0 label Aug 2, 2024
@digiwand
Copy link
Contributor Author

Design set max 15 chars, not max 15 digits. Updated in new PR: #26458

@digiwand digiwand added release-12.1.0 Issue or pull request that will be included in release 12.1.0 rc-cherry-picked and removed release-12.4.0 Issue or pull request that will be included in release 12.4.0 labels Aug 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
rc-cherry-picked release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Fix Permit token amount ellipsis to display after max 15 digits
4 participants