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

fix: add ellipsis for permit fiat values #26001

Merged
merged 4 commits into from
Jul 25, 2024

Conversation

OGPoyraz
Copy link
Member

@OGPoyraz OGPoyraz commented Jul 22, 2024

Description

This PR goal is to add ellipsis to the fiat value if it's more than 15 character in permit simulations.

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2842

Follow-up Cherry-picked PR:
#26515

Manual testing steps

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

Screenshots/Recordings

Before

After

Screenshot 2024-07-22 at 14 40 57

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.

@OGPoyraz OGPoyraz requested review from a team as code owners July 22, 2024 12:36
@metamaskbot metamaskbot added the team-confirmations Push issues to confirmations team label Jul 22, 2024
vinistevam
vinistevam previously approved these changes Jul 22, 2024
@vinistevam
Copy link
Contributor

Great PR @OGPoyraz ! Just a small lint error (jsdocs) failing the pipeline.

jpuri
jpuri previously approved these changes Jul 22, 2024
ui/hooks/useFiatFormatter.ts Outdated Show resolved Hide resolved
ui/hooks/useFiatFormatter.ts Outdated Show resolved Hide resolved
ui/hooks/useFiatFormatter.ts Outdated Show resolved Hide resolved
matthewwalsh0
matthewwalsh0 previously approved these changes Jul 22, 2024
@OGPoyraz OGPoyraz dismissed stale reviews from matthewwalsh0, jpuri, and vinistevam via 475a046 July 23, 2024 09:42
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR introduces ellipsis for fiat values exceeding 15 characters in permit simulations to enhance UI readability.

  • ui/helpers/utils/util.js: Added skipCharacterInEnd parameter to shortenString function for flexible string shortening.
  • ui/helpers/utils/util.test.js: Added test case for shortenString with skipCharacterInEnd option.
  • ui/hooks/useFiatFormatter.ts: Introduced shorten option to handle long fiat values.
  • ui/pages/confirmations/components/confirm/info/typed-sign/permit-simulation/permit-simulation.tsx: Updated PermitSimulation component to truncate long fiat values.
  • ui/pages/confirmations/components/simulation-details/fiat-display.tsx: Added shorten prop to IndividualFiatDisplay for improved fiat value display.

6 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This PR introduces ellipsis for fiat values exceeding 15 characters in permit simulations to enhance UI readability.

  • ui/helpers/utils/util.js: Added skipCharacterInEnd parameter to shortenString function for flexible string shortening.
  • ui/pages/confirmations/components/simulation-details/amount-pill.tsx: Updated shortenAssetId function call to include skipCharacterInEnd property.
  • ui/pages/confirmations/components/confirm/info/typed-sign/permit-simulation/permit-simulation.tsx: Updated PermitSimulation component to truncate long fiat values using the new shorten prop in IndividualFiatDisplay.

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@metamaskbot
Copy link
Collaborator

Builds ready [d4d259e]
Page Load Metrics (251 ± 266 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint62216993517
domContentLoaded96521126
load381963251553266
domInteractive96521126
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 699 Bytes (0.01%)
  • common: 70 Bytes (0.00%)

Copy link

codecov bot commented Jul 23, 2024

Codecov Report

Attention: Patch coverage is 96.96970% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.68%. Comparing base (e3691c0) to head (d4d259e).
Report is 16 commits behind head on develop.

Files Patch % Lines
...typed-sign/permit-simulation/permit-simulation.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26001      +/-   ##
===========================================
+ Coverage    69.67%   69.68%   +0.01%     
===========================================
  Files         1401     1404       +3     
  Lines        49628    49706      +78     
  Branches     13713    13736      +23     
===========================================
+ Hits         34577    34637      +60     
- Misses       15051    15069      +18     

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

@OGPoyraz OGPoyraz merged commit 8281f92 into develop Jul 25, 2024
79 checks passed
@OGPoyraz OGPoyraz deleted the 2842-missing-ellipsis-for-fiat-values-in-permits branch July 25, 2024 09:48
@github-actions github-actions bot locked and limited conversation to collaborators Jul 25, 2024
@metamaskbot metamaskbot added the release-12.3.0 Issue or pull request that will be included in release 12.3.0 label Jul 25, 2024
@digiwand
Copy link
Contributor

Follow-up PR adds tooltip when ellipsis is shown and updates calculation with decimals
#26523

@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.3.0 Issue or pull request that will be included in release 12.3.0 labels Aug 20, 2024
@digiwand
Copy link
Contributor

Cherry-pick PR into 12.1.0 #26515

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.

6 participants