Skip to content

Commit e4b335f

Browse files
authored
fix(homepage): revert ErrorState icon to design system and center Retry button (#26643)
## **Description** Fixes two issues in the `ErrorState` component used by Homepage sections: 1. **Reverts icon to design system**: Replaces the custom PNG image (`wifi-off.png`) with the design system `Icon` component (`IconName.WifiOff`), restoring consistency with the design system approach. 2. **Centers the Retry button**: Adds `self-center` to the Button so it is horizontally centered within the error state, matching the centered icon and text above it. **Changes:** - Replace `Image` + `wifi-off.png` with `Icon` from `@metamask/design-system-react-native` - Remove `ErrorState.styles` import (no longer needed) - Delete unused `app/images/wifi-off.png` asset - Add `twClassName="self-center"` to the Retry button ## **Changelog** CHANGELOG entry: null ## **Related issues** Refs: https://consensyssoftware.atlassian.net/browse/TMCU-407 ## **Manual testing steps** ```gherkin Feature: ErrorState component fixes Scenario: error state shows centered wifi-off icon from design system Given a homepage section fails to load When the error state is displayed Then the wifi-off icon is rendered using the design system Icon component And the Retry button is horizontally centered below the error message ``` ## **Screenshots/Recordings** ### **Before** <img width="300" src="https://github.com/user-attachments/assets/b71ad654-ff73-440c-a84e-09a4d34ac730" /> <img width="300" src="https://github.com/user-attachments/assets/82f28853-08db-4543-983a-e3a842af2c59" /> ### **After** <img width="300" src="https://github.com/user-attachments/assets/bcc8480c-c1d5-4efc-bfa2-81aba1dc6ce2" /> <img width="300" src="https://github.com/user-attachments/assets/4353c7dd-9194-4b09-9e37-0f30d6b12d2b" /> <!-- Design system icon, button centered --> ## **Pre-merge author checklist** - [x] I have 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 have completed the PR template to the best of my ability - [x] I have included tests if applicable - [x] I have documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I have 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. ## **Pre-merge reviewer checklist** - [ ] I have 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-only change that swaps a local PNG/styled `Image` for a design-system `Icon` and tweaks button alignment; no business logic or data handling changes. > > **Overview** > Updates the Homepage `ErrorState` UI to use the design system `Icon` (`IconName.WifiOff`, muted XL) instead of a bundled `wifi-off.png` + `StyleSheet` styles, and removes the now-unused `ErrorState.styles.ts`. > > Centers the Retry button by adding `twClassName="self-center"`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8fe53f4. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 5ea5349 commit e4b335f

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

app/components/Views/Homepage/components/ErrorState/ErrorState.styles.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

app/components/Views/Homepage/components/ErrorState/ErrorState.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import React from 'react';
2-
import { Image } from 'react-native';
32
import {
43
Box,
54
Text,
5+
Icon,
6+
IconName,
7+
IconSize,
8+
IconColor,
69
TextVariant,
710
TextColor,
811
BoxAlignItems,
@@ -11,8 +14,6 @@ import {
1114
ButtonSize,
1215
} from '@metamask/design-system-react-native';
1316
import { strings } from '../../../../../../locales/i18n';
14-
import wifiOffIcon from '../../../../../images/wifi-off.png';
15-
import styles from './ErrorState.styles';
1617

1718
interface ErrorStateProps {
1819
/** Text describing what failed to load (e.g., "Unable to load predictions") */
@@ -41,7 +42,11 @@ const ErrorState: React.FC<ErrorStateProps> = ({ title, onRetry }) => {
4142

4243
return (
4344
<Box alignItems={BoxAlignItems.Center} gap={3} padding={4}>
44-
<Image source={wifiOffIcon} style={styles.icon} />
45+
<Icon
46+
name={IconName.WifiOff}
47+
size={IconSize.Xl}
48+
color={IconColor.IconMuted}
49+
/>
4550
<Text
4651
variant={TextVariant.BodyMd}
4752
color={TextColor.TextAlternative}
@@ -53,6 +58,7 @@ const ErrorState: React.FC<ErrorStateProps> = ({ title, onRetry }) => {
5358
variant={ButtonVariant.Secondary}
5459
size={ButtonSize.Lg}
5560
onPress={handleRetry}
61+
twClassName={'self-center'}
5662
>
5763
{strings('homepage.error.retry')}
5864
</Button>

app/images/wifi-off.png

-220 KB
Binary file not shown.

0 commit comments

Comments
 (0)