Skip to content

feat(perps): scaffold pro mode market layout (PerpsProMarketView)#33560

Open
geositta wants to merge 7 commits into
mainfrom
feat/TAT-3558-lite-pro-components
Open

feat(perps): scaffold pro mode market layout (PerpsProMarketView)#33560
geositta wants to merge 7 commits into
mainfrom
feat/TAT-3558-lite-pro-components

Conversation

@geositta

@geositta geositta commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

Introduces PerpsProMarketView, a scaffold-only Pro-mode replacement for the Perps market screen, plus a thin PerpsMarketDetailsRouter that selects the Pro or lite view at the existing Routes.PERPS.MARKET_DETAILS route.

The scaffold follows the Figma “Perps Hub / Pro” structure: a fixed header, scrollable market summary slot, chart area, stats bar, two-column order-form/order-book area, and positions/orders section. The header displays the normalized market symbol; all deferred panel content remains placeholder only.

The trading columns use a 24px vertical divider slot matching the Figma token. The design-system SectionDivider remains the horizontal separator before positions.

Column placement uses PerpsProLayoutConfig, mirroring Core’s orderFormPosition and orderBookPosition preferences. Opposing positions are supported; conflicting values fall back to the default form-left/book-right layout.

Motivation and context

Upcoming Pro-mode panels need stable layout slots, and the market-details route needs a testable lite/Pro selection boundary. This scaffold provides those integration points without changing navigation, route names, or route parameters.

Pro mode remains behind usePerpsProModeEnabled, which currently returns false pending the controller mode selector. Lite users therefore continue rendering PerpsMarketDetailsView.

Changes

  • Added PerpsProMarketView with fixed header, scrollable market summary, chart, stats, trading-column, and positions placeholders.
  • Added validated, reversible order-form/order-book placement.
  • Added PerpsMarketDetailsRouter and the temporary always-lite mode seam.
  • Added Pro scaffold testIDs.
  • Added tests for route selection, safe areas, Figma dimensions, HIP-3 symbol formatting, slot rendering, reversed placement, and conflicting-position fallback.

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

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 to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

Note

Low Risk
Scaffold and routing swap are behind a hook that always selects lite mode; no trading logic or user-visible Pro UI yet.

Overview
Market details now registers PerpsMarketDetailsRouter instead of the lite view directly. The router picks PerpsProMarketView when usePerpsProModeEnabled() is true, otherwise PerpsMarketDetailsView; route name and params stay the same.

usePerpsProModeEnabled is a temporary seam that always returns false (TAT-3551), so production behavior is unchanged until feature flag and mode wiring land.

PerpsProMarketView is a Figma-aligned scaffold: fixed header with getPerpsDisplaySymbol, scrollable summary/chart/stats, a two-column trading area (order form left, 132px order book right, 24px divider), then positions—mostly muted placeholders. Invalid/missing market.symbol shows the existing perps market error copy.

Tests and E2E IDs cover router branching, hook default, layout dimensions, HIP-3 symbol stripping, safe areas, and slot structure via new PerpsProMarketViewSelectorsIDs.

Reviewed by Cursor Bugbot for commit f511aed. Bugbot is set up for automated code reviews on this repo. Configure here.

@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.

@metamask-ci metamask-ci Bot added the team-perps Perps team label Jul 21, 2026
@metamask-ci

metamask-ci Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Related issues section is empty. Add Fixes: #123 / Closes: <URL> / Refs: <Jira key>, or write a short rationale after the colon.
  • Manual testing steps still contain template content (the Gherkin example title or a [...] placeholder). Replace with real steps, or write N/A — <reason>.
  • Screenshots/Recordings section is empty. Add an image/video for user-facing changes, logs/console output for non-user-facing changes, or write N/A if no evidence is applicable.
  • Pre-merge author checklist has unchecked items (e.g. "I've tested on Android"). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@github-actions github-actions Bot added size-L and removed size-S labels Jul 21, 2026
@geositta
geositta marked this pull request as ready for review July 21, 2026 04:15
@geositta
geositta requested a review from a team as a code owner July 21, 2026 04:15
@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jul 21, 2026
@geositta
geositta force-pushed the feat/TAT-3558-lite-pro-components branch from bce9a3a to c86340a Compare July 21, 2026 04:29
@michalconsensys

Copy link
Copy Markdown
Contributor
simulator_screenshot_D87C597F-F717-406F-B045-DD2C12CA8EC1 Tested locally, looks good

Comment on lines +15 to +17
const isProModeEnabled = usePerpsProModeEnabled();

return isProModeEnabled ? <PerpsProMarketView /> : <PerpsMarketDetailsView />;

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.

Maybe we change the hook to send the mode and...

Suggested change
const isProModeEnabled = usePerpsProModeEnabled();
return isProModeEnabled ? <PerpsProMarketView /> : <PerpsMarketDetailsView />;
const mode = usePerpsProMode();
const modeToUI = {
[PerpsModes.Lite]: <PerpsMarketDetailsView />,
[PerpsModes.Pro]: <PerpsProMarketView />
}
return modeToUI[mode];

wdyt?

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.

I prefer to keep the boolean hook because the router has a binary, fail safe decision and 3558 needs to merge before the mode API lands. Once TAT-3551 merges, the hook will resolve featureFlag && mode === Pro. I think a mode to element map adds indirection without improving the two case routing currently.

Comment on lines +4 to +27
export type PerpsPanelPosition = 'left' | 'right';

/**
* Placement config for the Pro-mode two-column trading area.
*
* Currently a static default (order form left, order book right). Once the
* `@metamask/perps-controller` package is bumped, this will be fed by
* `proLayoutPreferences.orderFormPosition` / `orderBookPosition`, enabling a
* future container-position / rearrangeable-tiles feature without changing the
* panel components themselves.
*/
export interface PerpsProLayoutConfig {
orderFormPosition: PerpsPanelPosition;
orderBookPosition: PerpsPanelPosition;
}

/**
* Default two-column placement matching Figma node 10041:12979.
*/
export const DEFAULT_PRO_LAYOUT_CONFIG: PerpsProLayoutConfig = {
orderFormPosition: 'left',
orderBookPosition: 'right',
};

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 config should come from the controller

@geositta
geositta force-pushed the feat/TAT-3558-lite-pro-components branch 2 times, most recently from 828e7ce to c5fa316 Compare July 22, 2026 01:14

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c5fa316. Configure here.

Comment thread app/components/UI/Perps/Views/PerpsProMarketView/PerpsProMarketView.tsx Outdated
@github-actions

Copy link
Copy Markdown
Contributor

⚡ Performance Test Results

ℹ️ Performance test results are currently non-blocking and will not block this PR.

All tests passed · 2 tests · 1 device

📱 Devices tested (1)

Android: Google Pixel 8 Pro (v14.0)

✅ Passed Tests (2)
Test Platform Device Duration Team Recording
Perps add funds Android Google Pixel 8 Pro (v14.0) 7.96s @mm-perps-engineering-team 📹 Watch
Perps open position and close it Android Google Pixel 8 Pro (v14.0) 19.70s @mm-perps-engineering-team 📹 Watch

Branch: feat/TAT-3558-lite-pro-components · Build: Normal · Commit: 17e3202 · View full run

@geositta
geositta force-pushed the feat/TAT-3558-lite-pro-components branch from c5fa316 to f511aed Compare July 22, 2026 13:37
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR introduces a new PerpsMarketDetailsRouter component that replaces PerpsMarketDetailsView directly in the navigation stack. The router conditionally renders either the new PerpsProMarketView (Pro mode) or the existing PerpsMarketDetailsView (lite mode) based on usePerpsProModeEnabled.

Key findings:

  1. usePerpsProModeEnabled is hardcoded to return false — Pro mode is never enabled, so all users continue to see the existing PerpsMarketDetailsView. The routing change is functionally transparent.
  2. The new PerpsProMarketView and all its sub-components (chart panel, order form, order book, positions, stats bar, market summary, header, layout) are scaffold/placeholder implementations with empty containers.
  3. The navigation route Routes.PERPS.MARKET_DETAILS now goes through an extra router component, which could theoretically introduce a regression in the existing Perps market details navigation flow.
  4. New test IDs added to Perps.testIds.ts for the Pro view.

Risk: Medium — the routing indirection is a real change to the navigation stack for Perps market details, even though the rendered component is unchanged. A regression in the router could break the existing Perps market details flow.

Tag selection per tag descriptions:

  • SmokePerps: Directly affected — Perps market details navigation route changed.
  • SmokeWalletPlatform: Required per SmokePerps description — "Perps is also a section inside the Trending tab (SmokeWalletPlatform); changes to Perps views affect Trending."
  • SmokeConfirmations: Required per SmokePerps description — "When selecting SmokePerps, also select SmokeConfirmations (Add Funds deposits are on-chain transactions)."

Performance Test Selection:
The Pro mode view is gated off (usePerpsProModeEnabled always returns false), so no users will encounter the new PerpsProMarketView. All new components are scaffold placeholders with empty containers. The existing Perps flow (PerpsMarketDetailsView) is unchanged in terms of rendering. No performance-sensitive code paths are modified. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low AI analysis: low risk size-L team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants