feat: reduce the number of decimals shown for simulation detail amounts#24036
Merged
feat: reduce the number of decimals shown for simulation detail amounts#24036
Conversation
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. |
Contributor
sleepytanya
previously approved these changes
Apr 16, 2024
ui/pages/confirmations/components/simulation-details/amount-pill.tsx
Outdated
Show resolved
Hide resolved
ui/pages/confirmations/components/simulation-details/formatAmount.ts
Outdated
Show resolved
Hide resolved
ui/pages/confirmations/components/simulation-details/simulation-details.tsx
Show resolved
Hide resolved
Collaborator
Builds ready [93843bd]
Page Load Metrics (1489 ± 761 ms)
Bundle size diffs
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #24036 +/- ##
===========================================
+ Coverage 67.47% 67.48% +0.01%
===========================================
Files 1257 1259 +2
Lines 49227 49239 +12
Branches 12822 12826 +4
===========================================
+ Hits 33215 33227 +12
Misses 16012 16012 ☔ View full report in Codecov by Sentry. |
Collaborator
Builds ready [ee0d144]
Page Load Metrics (1098 ± 646 ms)
Bundle size diffs
|
Collaborator
Builds ready [1086855]
Page Load Metrics (1586 ± 738 ms)
Bundle size diffs
|
matthewwalsh0
previously approved these changes
Apr 23, 2024
Collaborator
Builds ready [85924bc]
Page Load Metrics (969 ± 592 ms)
Bundle size diffs
|
matthewwalsh0
approved these changes
Apr 23, 2024
Contributor
sleepytanya
approved these changes
Apr 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Description
This PR does two things:
|amount| < 1: We display a maximum of 3 significant digits.|amount| >= 1: We display all digits left of the decimal point. We also display some decimal places for smaller amounts, and gradually reduce the decimal precision as the amount gets bigger until we only show whole numbers.Users are still able to see the original amount, subject to the maximum precision supported by
Intl.NumberFormat.Here is how different amounts are rendered:
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2343
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist