Skip to content

fix: refactor: [cherry-pick][V12.1.0] Permit decimal fix + introduce ConfirmInfoRowTextTokenUnits component#26478

Merged
pedronfigueiredo merged 2 commits intoVersion-v12.1.0from
cherry-pick-12.1.0-refactor-redesign-conf-token-amount
Aug 19, 2024
Merged

fix: refactor: [cherry-pick][V12.1.0] Permit decimal fix + introduce ConfirmInfoRowTextTokenUnits component#26478
pedronfigueiredo merged 2 commits intoVersion-v12.1.0from
cherry-pick-12.1.0-refactor-redesign-conf-token-amount

Conversation

@digiwand
Copy link
Copy Markdown
Contributor

@digiwand digiwand commented Aug 16, 2024

Description

Cherry-picks refactor: Create reusable ConfirmInfoRowTextTokenUnits component (#26105)
into V12.1.0

No UI/UX changes

Create reusable ConfirmInfoRowTextTokenUnits

notes:

  • there is an outstanding bug ticket to redesign the display length of the amount to max 15 characters. This will be handled separately
  • there's also a precision issue being handle separately

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2888
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2991 (cherry-pick issue)

Manual testing steps

  1. Create a redesign Permit transaction
  2. Observe amount displays as expected

Screenshots/Recordings

Before

After

CleanShot 2024-07-25 at 03 35 08

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.

)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

No UI/UX changes

Create reusable ConfirmInfoRowTextTokenUnits

notes: 
- there is an outstanding bug ticket to redesign the display length of
the amount to max 15 characters. This will be handled separately
- there's also a precision issue being handle separately

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26105?quickstart=1)

## **Related issues**

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

## **Manual testing steps**

1. Create a redesign Permit transaction
2. Observe amount displays as expected

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

![CleanShot 2024-07-25 at 03 35
08](https://github.com/user-attachments/assets/92e6db4e-7618-43d6-8259-d9e16f436dbe)


## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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 August 16, 2024 16:50
@github-actions
Copy link
Copy Markdown
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 Aug 16, 2024
// FIXME - Precision may be lost for large values when using formatAmount
/** @see {@link https://github.com/MetaMask/metamask-extension/issues/25755} */
const tokenValue = formatAmount('en-US', resultBn);
const tokenValueMaxPrecision = formatAmountMaxPrecision('en-US', valueBN);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was actually a bug. We should be reading resultBn here not valueBN

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed using the new component introduced here

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.62%. Comparing base (2870f59) to head (f4f4079).

Additional details and impacted files
@@                 Coverage Diff                 @@
##           Version-v12.1.0   #26478      +/-   ##
===================================================
- Coverage            69.62%   69.62%   -0.00%     
===================================================
  Files                 1362     1363       +1     
  Lines                48412    48410       -2     
  Branches             13347    13347              
===================================================
- Hits                 33703    33701       -2     
  Misses               14709    14709              

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

@digiwand digiwand changed the title refactor: cherry-pick 12.1.0 Permit ellipsis fix (1/3) introduce ConfirmInfoRowTextTokenUnits component fix: refactor: cherry-pick 12.1.0 Permit decimal fix + introduce ConfirmInfoRowTextTokenUnits component Aug 16, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [f4f4079]
Page Load Metrics (227 ± 244 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint633941107335
domContentLoaded999252110
load401908227507244
domInteractive999252110

const tokenValue = calcTokenAmount(value, decimals);

// FIXME - Precision may be lost for large values when using formatAmount
/** @see {@link https://github.com/MetaMask/metamask-extension/issues/25755} */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This issue has been fixed, we can get rid of this comment now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Turns out we haven't cherry-picked the Precision fix to 12.1.0 yet. Cherry-pick PR #26496

Copy link
Copy Markdown
Contributor

@jpuri jpuri left a comment

Choose a reason for hiding this comment

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

Changes look good, I left a small feedback to remove an outdated comment.

@pedronfigueiredo pedronfigueiredo merged commit db10925 into Version-v12.1.0 Aug 19, 2024
@pedronfigueiredo pedronfigueiredo deleted the cherry-pick-12.1.0-refactor-redesign-conf-token-amount branch August 19, 2024 09:58
@github-actions github-actions bot locked and limited conversation to collaborators Aug 19, 2024
@digiwand digiwand changed the title fix: refactor: cherry-pick 12.1.0 Permit decimal fix + introduce ConfirmInfoRowTextTokenUnits component fix: refactor: [cherry-pick][V12.1.0] Permit decimal fix + introduce ConfirmInfoRowTextTokenUnits component Aug 19, 2024
@digiwand digiwand added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Aug 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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