Commit db49458
authored
feat(perps): redesign market detail header (TAT-3348) (#33024)
## **Description**
Redesigns the Perps market detail header to match the new design in
[TAT-3348](https://consensyssoftware.atlassian.net/browse/TAT-3348),
taking inspiration from the equivalent extension implementation.
**What changed**
- The header now shows a two-row market identity:
- **First row:** the full asset name (e.g. `Ethereum`), the leverage
pill (e.g. `50x`), and a chevron that opens the market list.
- **Second row:** the `[Ticker]-[collateral] perp` pair subtitle (e.g.
`ETH-USD perp`).
- The back chevron stays on the left and the favorite star on the right.
- The live price + 24h price change and the fullscreen chart button move
into a dedicated row **below** the header (the price is shown more
prominently).
**Why**
The previous header showed `ETH-USD` as the title with the price inline
and expand/star/search icons on the right. The new layout aligns mobile
with the agreed design and the extension, surfacing the full asset name
and market pair, and grouping the price/chart controls below the header.
**Implementation notes**
- `PerpsMarketInlineHeader` gains an opt-in `showAssetName` prop (plus
`onMarketListPress` for the chevron). The default layout is unchanged,
so the shared order book header is not affected.
- `LivePriceHeader` gains a `size` variant (`large`) used for the
prominent below-header price; the default size is unchanged.
- The collateral label uses `USD` to stay consistent with the app's
existing `-USD` convention.
- The fullscreen chart button is not present in the extension yet, so
mobile's existing fullscreen behavior is preserved and only relocated
per the acceptance criteria.
## **Changelog**
CHANGELOG entry: Redesigned the Perps market detail header to show the
full asset name, leverage, and market pair, with the live price, 24h
change, and fullscreen chart button below the header.
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/TAT-3348
## **Manual testing steps**
```gherkin
Feature: Perps market detail header
Scenario: user opens a perps market detail screen
Given the user is on the Perps market list
When the user taps a market (e.g. ETH)
Then the header first row shows the full asset name, the leverage pill, and a chevron
And the header second row shows the market pair as "ETH-USD perp"
And the back chevron is shown on the left and the favorite star on the right
And the live price and 24h price change are shown below the header
And a fullscreen chart button is shown below the header
Scenario: user opens the market list from the header chevron
Given the user is on a perps market detail screen
When the user taps the chevron next to the asset name
Then the market list is opened
Scenario: user opens the fullscreen chart
Given the user is on a perps market detail screen
When the user taps the fullscreen chart button below the header
Then the fullscreen chart modal is displayed
```
## **Screenshots/Recordings**
### **Before**
<!-- Header showed "ETH-USD" title with inline price and
expand/star/search icons -->
### **After**
<img width="1206" height="2622"
alt="simulator_screenshot_A02336D0-CDD5-4B3D-BA8E-456DA2EC0C70"
src="https://github.com/user-attachments/assets/ded18078-7207-4ad7-9d63-4074f2d15630"
/>
<!-- Header shows full asset name + leverage pill + chevron, "ETH-USD
perp" subtitle, and price + 24h change + fullscreen button below the
header. Screenshots/recordings to be attached from a device/simulator
run. -->
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/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
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
#### Performance checks (if applicable)
- [ ] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [ ] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **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.
[TAT-3348]:
https://consensyssoftware.atlassian.net/browse/TAT-3348?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> UI-only Perps market details layout and analytics property updates;
default inline header paths are preserved and coverage is extensive in
unit/view tests.
>
> **Overview**
> Redesigns the Perps **market detail** screen header and price row to
match TAT-3348 / extension-style layout.
>
> **Header (`useDetailLayout` on `PerpsMarketInlineHeader`):** Title
becomes the full asset name with leverage pill and a **market-list
chevron** (replacing header fullscreen + category search). Subtitle is
the localized `{{ticker}}-{{collateral}} perp` pair via new
`PERPS_COLLATERAL_SYMBOL`; live price is no longer in the header.
Compact header behavior elsewhere is unchanged.
>
> **Below header:** New **market summary** row with `LivePriceHeader`
`size="large"` (prominent price, stacked layout, absolute + % 24h
change) and a relocated **fullscreen chart** button. `LivePriceHeader`
migrates to design-system `Text` tokens and adds shrink/ellipsis for
long prices.
>
> **Analytics & i18n:** Market list entry reports `button_clicked:
market_list`, `button_location: perp_market_details`, `source:
perp_asset_screen`; metrics docs note legacy magnifying-glass values.
New strings for market list, perp pair, and updated test IDs.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
01e1b36. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent d95691f commit db49458
13 files changed
Lines changed: 545 additions & 129 deletions
File tree
- app/components/UI/Perps
- Views/PerpsMarketDetailsView
- components
- LivePriceDisplay
- PerpsMarketHeader
- PerpsMarketInlineHeader
- constants
- docs/perps
- locales/languages
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
| 415 | + | |
| 416 | + | |
415 | 417 | | |
416 | 418 | | |
417 | 419 | | |
| |||
456 | 458 | | |
457 | 459 | | |
458 | 460 | | |
459 | | - | |
| 461 | + | |
| 462 | + | |
460 | 463 | | |
461 | 464 | | |
462 | 465 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| |||
Lines changed: 54 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2143 | 2143 | | |
2144 | 2144 | | |
2145 | 2145 | | |
2146 | | - | |
| 2146 | + | |
2147 | 2147 | | |
2148 | 2148 | | |
2149 | 2149 | | |
| |||
3493 | 3493 | | |
3494 | 3494 | | |
3495 | 3495 | | |
3496 | | - | |
| 3496 | + | |
3497 | 3497 | | |
3498 | 3498 | | |
3499 | 3499 | | |
| |||
3517 | 3517 | | |
3518 | 3518 | | |
3519 | 3519 | | |
3520 | | - | |
| 3520 | + | |
3521 | 3521 | | |
3522 | 3522 | | |
3523 | 3523 | | |
| |||
3550 | 3550 | | |
3551 | 3551 | | |
3552 | 3552 | | |
3553 | | - | |
| 3553 | + | |
3554 | 3554 | | |
3555 | 3555 | | |
3556 | 3556 | | |
| |||
3615 | 3615 | | |
3616 | 3616 | | |
3617 | 3617 | | |
3618 | | - | |
3619 | | - | |
3620 | | - | |
| 3618 | + | |
3621 | 3619 | | |
3622 | 3620 | | |
3623 | 3621 | | |
| |||
3640 | 3638 | | |
3641 | 3639 | | |
3642 | 3640 | | |
3643 | | - | |
3644 | | - | |
| 3641 | + | |
| 3642 | + | |
3645 | 3643 | | |
3646 | 3644 | | |
3647 | 3645 | | |
| |||
3651 | 3649 | | |
3652 | 3650 | | |
3653 | 3651 | | |
3654 | | - | |
3655 | | - | |
| 3652 | + | |
| 3653 | + | |
3656 | 3654 | | |
3657 | | - | |
| 3655 | + | |
3658 | 3656 | | |
3659 | 3657 | | |
3660 | | - | |
| 3658 | + | |
3661 | 3659 | | |
3662 | 3660 | | |
| 3661 | + | |
| 3662 | + | |
| 3663 | + | |
| 3664 | + | |
| 3665 | + | |
| 3666 | + | |
| 3667 | + | |
| 3668 | + | |
| 3669 | + | |
| 3670 | + | |
| 3671 | + | |
| 3672 | + | |
| 3673 | + | |
| 3674 | + | |
| 3675 | + | |
| 3676 | + | |
| 3677 | + | |
| 3678 | + | |
| 3679 | + | |
| 3680 | + | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
| 3685 | + | |
| 3686 | + | |
| 3687 | + | |
| 3688 | + | |
| 3689 | + | |
| 3690 | + | |
| 3691 | + | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
3663 | 3696 | | |
3664 | 3697 | | |
3665 | 3698 | | |
| |||
4613 | 4646 | | |
4614 | 4647 | | |
4615 | 4648 | | |
4616 | | - | |
| 4649 | + | |
| 4650 | + | |
| 4651 | + | |
4617 | 4652 | | |
4618 | 4653 | | |
4619 | 4654 | | |
| |||
4820 | 4855 | | |
4821 | 4856 | | |
4822 | 4857 | | |
4823 | | - | |
| 4858 | + | |
| 4859 | + | |
4824 | 4860 | | |
4825 | 4861 | | |
4826 | 4862 | | |
| |||
4844 | 4880 | | |
4845 | 4881 | | |
4846 | 4882 | | |
4847 | | - | |
| 4883 | + | |
4848 | 4884 | | |
4849 | 4885 | | |
4850 | 4886 | | |
| |||
4854 | 4890 | | |
4855 | 4891 | | |
4856 | 4892 | | |
4857 | | - | |
| 4893 | + | |
| 4894 | + | |
4858 | 4895 | | |
4859 | 4896 | | |
4860 | 4897 | | |
| |||
Lines changed: 44 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
| 7 | + | |
| 8 | + | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
7 | 12 | | |
| 13 | + | |
8 | 14 | | |
9 | 15 | | |
10 | 16 | | |
| 17 | + | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
| |||
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
43 | | - | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
| |||
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
64 | 71 | | |
| 72 | + | |
65 | 73 | | |
66 | 74 | | |
67 | 75 | | |
| |||
853 | 861 | | |
854 | 862 | | |
855 | 863 | | |
856 | | - | |
| 864 | + | |
857 | 865 | | |
858 | 866 | | |
859 | 867 | | |
860 | 868 | | |
861 | 869 | | |
862 | 870 | | |
863 | | - | |
| 871 | + | |
864 | 872 | | |
865 | | - | |
| 873 | + | |
866 | 874 | | |
867 | 875 | | |
868 | 876 | | |
869 | 877 | | |
870 | | - | |
| 878 | + | |
871 | 879 | | |
872 | 880 | | |
873 | 881 | | |
| |||
1540 | 1548 | | |
1541 | 1549 | | |
1542 | 1550 | | |
1543 | | - | |
1544 | 1551 | | |
1545 | | - | |
| 1552 | + | |
1546 | 1553 | | |
| 1554 | + | |
1547 | 1555 | | |
1548 | | - | |
1549 | 1556 | | |
1550 | 1557 | | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
1551 | 1587 | | |
1552 | 1588 | | |
1553 | 1589 | | |
| |||
Lines changed: 42 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
485 | 491 | | |
486 | 492 | | |
487 | 493 | | |
488 | | - | |
| 494 | + | |
489 | 495 | | |
490 | 496 | | |
491 | 497 | | |
492 | 498 | | |
493 | | - | |
| 499 | + | |
494 | 500 | | |
495 | 501 | | |
496 | 502 | | |
497 | 503 | | |
498 | 504 | | |
499 | | - | |
| 505 | + | |
| 506 | + | |
500 | 507 | | |
501 | 508 | | |
502 | | - | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
503 | 532 | | |
504 | 533 | | |
505 | 534 | | |
| |||
536 | 565 | | |
537 | 566 | | |
538 | 567 | | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
539 | 571 | | |
540 | | - | |
| 572 | + | |
541 | 573 | | |
542 | 574 | | |
543 | | - | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
544 | 578 | | |
545 | 579 | | |
546 | 580 | | |
547 | 581 | | |
548 | 582 | | |
549 | 583 | | |
550 | 584 | | |
551 | | - | |
| 585 | + | |
552 | 586 | | |
553 | 587 | | |
554 | 588 | | |
| |||
0 commit comments