refactor(perps): migrate Close All Positions sheet to MMDS#33365
refactor(perps): migrate Close All Positions sheet to MMDS#33365brianacnguyen wants to merge 5 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
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. |
🧪 Flaky unit test detectionRun history flaky detectionHistorical failure rate is a hint, not proof — review each suggestion in context. See the flaky-test-detection skill for the full pattern reference and manual audit workflow. Failures / runs sampled per window:
AI-detected flaky patterns
|
Pin mock timestamps and replace weak/vacuous matchers with toBeOnTheScreen so presence checks stay deterministic and meaningful. Co-authored-by: Cursor <cursoragent@cursor.com>
⚡ Performance Test Results
✅ All tests passed · 2 tests · 1 device 📱 Devices tested (1)Android: Google Pixel 8 Pro (v14.0) ✅ Passed Tests (2)
Branch: |
Remove the MMDS BottomSheet mock and assert via shared selectors instead. Co-authored-by: Cursor <cursoragent@cursor.com>
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag selection rationale:
No other feature areas are affected. The changes are UI-only migrations with no controller, navigation, or shared infrastructure changes. Performance Test Selection: |
|



Description
Aligns the Perps Close All Positions bottom sheet with the MetaMask Design System (MMDS) so it matches other redesigned Perps surfaces, instead of the older component-library sheet/footer/text primitives.
What changed:
PerpsCloseAllPositionsViewto MMDSBottomSheet,BottomSheetHeader,BottomSheetFooter,Box, andText(includinggoBack/onClosewiring and primary/secondary footer button props withisDangeron Close all).PerpsCloseSummaryfees, you-receive, and estimated-points rows to MMDSKeyValueRow+SectionDivider(margin/P&L row kept custom for nested includes P&L).PerpsHomeView’s close-all sheet ref at MMDSBottomSheetRefwhile keeping cancel-all on the component-library sheet ref.Changelog
CHANGELOG entry: Updated the Perps Close All Positions sheet to use the MetaMask Design System
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TAT-3566
Manual testing steps
Unit tests:
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Touches the close-all trading confirmation UI and sheet dismiss/ref wiring on Perps Home, but close-all business logic stays in existing hooks; risk is mainly visual/regression in a high-impact user action.
Overview
Migrates the Perps Close All Positions flow from component-library bottom sheet primitives to MetaMask Design System (MMDS) so it matches other redesigned Perps surfaces.
PerpsCloseAllPositionsViewnow uses MMDSBottomSheet,BottomSheetHeader,BottomSheetFooter,Box, andText, withgoBack/onCloseinstead ofshouldNavigateBack, and footer actions wired viaprimaryButtonProps/secondaryButtonProps(includingisDangeron Close all). AddsPerpsCloseAllPositionsViewSelectorsIDstestIDs across sheet states and buttons; trims layout styles that MMDS/Boxreplace.PerpsCloseSummaryrefactors fees, you-receive, and estimated-points rows to MMDSKeyValueRowandSectionDivider(margin + nested P&L row stays custom). Tooltip info icons usekeyEndButtonIconPropswhen enabled.PerpsHomeViewtypes the close-all overlay ref with MMDSBottomSheetRefwhile cancel-all still uses the component-library ref.Unit tests drop manual bottom-sheet mocks, assert via testIDs, use a fixed position timestamp, and
PerpsCloseSummarytests switch totoBeOnTheScreen().Reviewed by Cursor Bugbot for commit 134b7f4. Bugbot is set up for automated code reviews on this repo. Configure here.