Skip to content

Commit dcaa40a

Browse files
refactor(predict): use MMDS HeaderStandard (#29704)
## **Description** This PR replaces the temporary `HeaderCompactStandard` component with `HeaderStandard` from `@metamask/design-system-react-native` on Predict screens and sheets. **Reason:** Align Predict UI with the MetaMask design system and rely less on `component-library/components-temp` for standard headers. **What changed:** - **Predict feed:** Main Predict feed header now uses `HeaderStandard` with `includesTopInset`, back handling, and the existing title string. Unused design-system imports (`Icon`, `IconColor`, `IconSize`) were removed from this file after the swap. - **Activity detail:** Activity detail screen header uses `HeaderStandard` with the same title fallback logic (`activityDetails?.headerTitle` vs. the default activity-details string). - **Unavailable bottom sheet:** The “Predict unavailable” sheet header uses `HeaderStandard` with `testID`, title, and close behavior unchanged. Behavior is intended to match the previous headers (navigation, titles, safe area). ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/DSYS-701 ## **Manual testing steps** ```gherkin Feature: Predict headers use design system HeaderStandard Scenario: Predict feed header Given the user opens Predict from the wallet (Predict feed) When they view the header title and tap back Then navigation matches prior behavior and the title shows the expected Predict label Scenario: Activity detail header Given the user opens a Predict activity from history or the feed When they view activity details Then the header title reflects activity-specific copy when present or the default activity-details string When they use the back control Then they return to the previous screen as before Scenario: Predict unavailable sheet Given Predict is unavailable and the bottom sheet is shown When the user views the header and closes the sheet Then the sheet dismisses as before ``` ## **Screenshots/Recordings** ### **Before** ### **After** ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk UI refactor that swaps a temporary header component for the design-system `HeaderStandard`; primary risk is minor layout/safe-area or button behavior differences across screens/sheets. > > **Overview** > Updates Predict UI to use the design-system `HeaderStandard` in place of the temporary `HeaderCompactStandard` on the feed screen, activity detail screen, and the “Predict unavailable” bottom sheet. > > Keeps existing titles and back/close wiring (including testIDs and `includesTopInset`) while removing now-unused icon-related imports in `PredictFeed`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 391f93a. 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 <cursoragent@cursor.com>
1 parent 229b997 commit dcaa40a

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

app/components/UI/Predict/components/PredictActivityDetail/PredictActivityDetail.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import {
2727
BoxFlexDirection,
2828
BoxAlignItems,
2929
BoxJustifyContent,
30+
HeaderStandard,
3031
} from '@metamask/design-system-react-native';
3132
import { useTailwind } from '@metamask/design-system-twrnc-preset';
32-
import HeaderCompactStandard from '../../../../../component-library/components-temp/HeaderCompactStandard';
3333
import UsdcIcon from './usdc.svg';
3434
import { PredictActivityDetailsSelectorsIDs } from '../../Predict.testIds';
3535
interface PredictActivityDetailProps {}
@@ -413,7 +413,7 @@ const PredictActivityDetails: React.FC<PredictActivityDetailProps> = () => {
413413
testID={PredictActivityDetailsSelectorsIDs.CONTAINER}
414414
>
415415
<Box twClassName="flex-1">
416-
<HeaderCompactStandard
416+
<HeaderStandard
417417
title={
418418
activityDetails?.headerTitle ??
419419
strings('predict.transactions.activity_details')

app/components/UI/Predict/components/PredictUnavailable/PredictUnavailable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
TextVariant,
1313
BoxAlignItems,
1414
BoxJustifyContent,
15+
HeaderStandard,
1516
} from '@metamask/design-system-react-native';
1617
import { useTailwind } from '@metamask/design-system-twrnc-preset';
1718
import { InteractionManager, TouchableOpacity } from 'react-native';
@@ -22,7 +23,6 @@ import { strings } from '../../../../../../locales/i18n';
2223
import BottomSheet from '../../../../../component-library/components/BottomSheets/BottomSheet/BottomSheet';
2324
import { BottomSheetRef } from '../../../../../component-library/components/BottomSheets/BottomSheet/BottomSheet.types';
2425
import BottomSheetFooter from '../../../../../component-library/components/BottomSheets/BottomSheetFooter/BottomSheetFooter';
25-
import HeaderCompactStandard from '../../../../../component-library/components-temp/HeaderCompactStandard';
2626
import { ButtonVariants } from '../../../../../component-library/components/Buttons/Button/Button.types';
2727
import { PREDICT_UNAVAILABLE_TEST_IDS } from './PredictUnavailable.testIds';
2828

@@ -116,7 +116,7 @@ const PredictUnavailable = forwardRef<
116116
isInteractable
117117
onClose={handleSheetClosed}
118118
>
119-
<HeaderCompactStandard
119+
<HeaderStandard
120120
testID="header"
121121
title={strings('predict.unavailable.title')}
122122
onClose={handleClose}

app/components/UI/Predict/views/PredictFeed/PredictFeed.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ import {
2020
import { useTailwind } from '@metamask/design-system-twrnc-preset';
2121
import {
2222
Box,
23-
Icon,
24-
IconColor,
23+
HeaderStandard,
2524
IconName,
26-
IconSize,
2725
Text,
2826
TextColor,
2927
TextVariant,
@@ -84,7 +82,6 @@ import {
8482
TabItem,
8583
TabsBar,
8684
} from '../../../../../component-library/components-temp/Tabs';
87-
import HeaderCompactStandard from '../../../../../component-library/components-temp/HeaderCompactStandard';
8885
import HeaderSearch, {
8986
HeaderSearchVariant,
9087
} from '../../../../../component-library/components-temp/HeaderSearch';
@@ -726,7 +723,7 @@ const PredictFeed: React.FC<PredictFeedProps> = ({
726723
backgroundColor: colors.background.default,
727724
})}
728725
>
729-
<HeaderCompactStandard
726+
<HeaderStandard
730727
includesTopInset
731728
title={strings('wallet.predict')}
732729
onBack={handleBackPress}

0 commit comments

Comments
 (0)