Repository navigation
Commit 2d78e60
release(runway): cherry-pick chore(perps): set the withdraw amount input in Grotzec Hero (#47672)
- chore(perps): set the withdraw amount input in Grotzec Hero cp-13.57.0
(#47560)
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
Stacked on #47564 (shared font-size helper) — merge that first.
## **Description**
This is the @MetaMask/perps slice of the Grotzec large number amount
inputs. It was split from the UAT build in #47557, which has the full
plan, the input inventory and the risks.
- Ticket:
[TMCU-1744](https://consensyssoftware.atlassian.net/browse/TMCU-1744)
- Epic: [TMCU-1741 [Extension] Update large number amount inputs with
Grotzec](https://consensyssoftware.atlassian.net/browse/TMCU-1741)
**Depends on #47564** (the shared amount scale and
`useAmountInputFontSize` hook). This PR is stacked on #47564's branch
(`cursor/grotzec-amount-input-scale-f3b4`) and does not carry its own
copy of the helper, so its diff shows only this slice. Merge #47564
first, then retarget this PR to `main`.
**What is the reason for the change?** The Perps withdraw amount was
Inter at weight 500 and 64/40/30/20px. Perps balances and prices moved
to Grotzec in #47465. This input is the twin of the MM Pay
`CustomAmount`, which Mobile moves to Grotzec at 88px in
[#38135](MetaMask/metamask-mobile#38135).
**What is the improvement?**
- **MMDS `Input`.** The `<input>` is now the MMDS `Input`
(`textVariant={AmountDisplayLg}`, `font-hero`). The hidden-text
measuring pattern stays. The symbol and measuring element are MMDS
`Text` (`AmountDisplayLg` + `FontFamily.Hero`), so all three share the
same family, weight and size. The explicit `fontWeight: 500` is dropped,
as on Mobile.
- **Sizing: shared scale.** The withdraw amount uses the scale in #47564
(`ui/helpers/utils/amount-input-font-size.ts`), the same one used by
Swap/Bridge, Ramps Buy and the MM Pay amount. It has steps of 88, 72,
60, 48, 40, 32, 24 and 20px, takes the largest step at which `$` and the
amount fit the input's measured width (`useAmountInputFontSize`, one
`ResizeObserver` per input; 328px is only the fallback before the first
measurement), and sets line height equal to font size. In the expanded
view long amounts stay large instead of shrinking early. At the 328px
popup width, `$25` is 88px, `$1234567.89` is 72px and `$123456789012.34`
is 48px.
- **Mobile reference.** The 88px start, 88px row, 88px `rounded-lg`
skeleton and 20px floor match Mobile #38135. Mobile's MM Pay drops
straight from 88px to 40px; Extension steps down gradually so mid-length
amounts stay larger.
- **Twin stays in sync.** The local length-based `getFontSize` is
removed. Its twin, the confirmations `CustomAmount`, moves to the same
scale in #47565, so the two can no longer drift.
**Risks**
- The weight changes from 500 Inter to the Bold Grotzec cut. Perps is
USD only, and Grotzec has `$`, so there is no glyph fallback.
## **Changelog**
CHANGELOG entry: Updated the Perps withdraw amount input to the Grotzec
typeface
## **Related issues**
Fixes:
[TMCU-1744](https://consensyssoftware.atlassian.net/browse/TMCU-1744)
Epic:
[TMCU-1741](https://consensyssoftware.atlassian.net/browse/TMCU-1741)
Depends on: #47564
Related: #47565 (MM Pay custom amount twin)
Split from: #47557
## **Manual testing steps**
1. Load this branch in the extension, open Perps and choose Withdraw.
2. Confirm the loading skeleton is 88px tall with rounded corners.
3. Enter `25` and confirm it renders in Grotzec at 88px.
4. Type `123456789012.34` one key at a time and confirm the amount steps
down 88 → 72 → 60 → 48px and stays centred.
5. Enter more than the available balance and confirm the amount turns
red.
6. Repeat in the expanded view, where long amounts stay larger instead
of shrinking early, and in the side panel, where they step down smoothly
as the width narrows.
## **Screenshots/Recordings**
### Before / After by code owner
Before is `main` @adeaf9ad59 and After is the UAT head (#47557)
@28a7077e43, both recorded with the same typing script (type 5, then
500000000000000000, then clear).
#### Perps withdraw
| Before | After |
| --- | --- |
| <img width="360"
src="https://github.com/user-attachments/assets/bde0cc8d-a0a6-493e-81cd-6754ac6a0a82"
alt="Perps withdraw before, side panel"> | <img width="360"
src="https://github.com/user-attachments/assets/87e17271-f2a9-4b2e-824f-92456a58a3eb"
alt="Perps withdraw after, side panel"> |
| <img width="360"
src="https://github.com/user-attachments/assets/2c539038-48c1-4f5b-9ef4-85b21391df3b"
alt="Perps withdraw before, expanded view"> | <img width="360"
src="https://github.com/user-attachments/assets/cc7c54af-42e1-4bf9-bffc-92bd98312ead"
alt="Perps withdraw after, expanded view"> |
Full MP4s: [Side panel
before](https://github.com/user-attachments/assets/49c2722c-88e1-41fb-8ff3-1fda48319b85)
· [Side panel
after](https://github.com/user-attachments/assets/573cd199-f321-4b96-aab8-790349a292a6)
· [Expanded
before](https://github.com/user-attachments/assets/0595640d-d948-4c3f-9ec8-fb505f8f01f7)
· [Expanded
after](https://github.com/user-attachments/assets/85f918b1-09ec-4359-927d-705da4ed3405)
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] 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/main/.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.
<!-- CURSOR_AGENT_PR_BODY_END -->
<div><a
href="https://cursor.com/agents/bc-b3180cce-a244-5330-95e3-35b5951ff3b4?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a
href="https://cursor.com/background-agent?bcId=bc-b3180cce-a244-5330-95e3-35b5951ff3b4&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div>
[TMCU-1744]:
https://consensyssoftware.atlassian.net/browse/TMCU-1744?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[TMCU-1744]:
https://consensyssoftware.atlassian.net/browse/TMCU-1744?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Scoped UI swap on the Perps withdraw amount field with no changes to
withdrawal submission, balance guards, or backend calls.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
52d1e02. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: George Marshall
<georgewrmarshall@users.noreply.github.com>
[b0f7657](b0f7657)
[TMCU-1744]:
https://consensyssoftware.atlassian.net/browse/TMCU-1744?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[TMCU-1744]:
https://consensyssoftware.atlassian.net/browse/TMCU-1744?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
Co-authored-by: metamask-ci[bot] <271559518+metamask-ci[bot]@users.noreply.github.com>
Co-authored-by: sleepytanya <104780023+sleepytanya@users.noreply.github.com>1 parent a52e6c4 commit 2d78e60
5 files changed
Lines changed: 6 additions & 316 deletions
File tree
- ui
- components/app/perps/perps-fiat-hero-amount-input
- pages/perps
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
612 | 613 | | |
613 | 614 | | |
614 | 615 | | |
615 | | - | |
| 616 | + | |
| 617 | + | |
616 | 618 | | |
617 | 619 | | |
618 | 620 | | |
619 | 621 | | |
620 | | - | |
| 622 | + | |
| 623 | + | |
621 | 624 | | |
622 | 625 | | |
623 | 626 | | |
| |||
0 commit comments