Skip to content

Commit 364ec1b

Browse files
chore: Updated empty states for Activity page to use TabEmptyState (#23304)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR updates the empty states for the Activity page to use TabEmptyState <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/jira/software/c/projects/MDP/boards/2972?assignee=62afb43d33a882e2be47c36f&selectedIssue=MDP-414 ## **Manual testing steps** ```gherkin Feature: Activity Empty States Scenario: user navigates to Activity page Given user does not have any transactions/activities When user navigates to Activity page Then they see the empty state consistent with the empty state on the homepage ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** https://github.com/user-attachments/assets/1b6eccce-7511-4fec-941a-b29922da7797 <!-- [screenshots/recordings] --> ## **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. ## **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] > Replaces inline empty-state text with `TabEmptyState` across Perps, Predict, Ramp Orders, and Transactions views, updating i18n and tests/snapshots accordingly. > > - **UI/Empty States**: > - Replace inline `Text` empty states with `TabEmptyState` in: > - `PerpsTransactionsView`, `PredictTransactionsView`, `OrdersList`, `Transactions`, `MultichainTransactionsView`, and `UnifiedTransactionsView`. > - Remove obsolete styles (e.g., `emptyText`, `emptyMessage`). > - **Localization**: > - Update Perps empty-state copy to a single combined string in `en.json`. > - **Tests**: > - Update unit tests and Jest snapshots to assert/use `TabEmptyState` content. > - **Misc**: > - Minor import cleanup in `Transactions/index.js`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5ec92b8. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 14a3016 commit 364ec1b

File tree

13 files changed

+470
-359
lines changed

13 files changed

+470
-359
lines changed

app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.styles.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,6 @@ export const styleSheet = (params: { theme: Theme }) => {
106106
alignItems: 'center' as const,
107107
paddingVertical: 48,
108108
},
109-
emptyText: {
110-
textAlign: 'center' as const,
111-
marginTop: 16,
112-
color: colors.text.muted,
113-
},
114109
fillTag: {
115110
flexDirection: 'row' as const,
116111
alignItems: 'center' as const,

app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.test.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,10 @@ describe('PerpsTransactionsView', () => {
265265
});
266266

267267
await waitFor(() => {
268-
expect(component.getByText('No trades transactions yet')).toBeTruthy();
269268
expect(
270-
component.getByText('Your trading history will appear here'),
269+
component.getByText(
270+
'No trades transactions yet. Your trading history will appear here',
271+
),
271272
).toBeTruthy();
272273
});
273274
});
@@ -287,7 +288,11 @@ describe('PerpsTransactionsView', () => {
287288

288289
await waitFor(() => {
289290
// Should show empty state when API fails
290-
expect(component.getByText('No trades transactions yet')).toBeTruthy();
291+
expect(
292+
component.getByText(
293+
'No trades transactions yet. Your trading history will appear here',
294+
),
295+
).toBeTruthy();
291296
});
292297
});
293298

@@ -391,7 +396,11 @@ describe('PerpsTransactionsView', () => {
391396
});
392397

393398
await waitFor(() => {
394-
expect(component.getByText('No trades transactions yet')).toBeTruthy();
399+
expect(
400+
component.getByText(
401+
'No trades transactions yet. Your trading history will appear here',
402+
),
403+
).toBeTruthy();
395404
});
396405
});
397406

app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { usePerpsMeasurement } from '../../hooks/usePerpsMeasurement';
3838
import { TraceName } from '../../../../../util/trace';
3939
import ButtonFilter from '../../../../../component-library/components-temp/ButtonFilter';
4040
import { ButtonSize } from '@metamask/design-system-react-native';
41+
import { TabEmptyState } from '../../../../../component-library/components-temp/TabEmptyState';
4142

4243
const PerpsTransactionsView: React.FC<PerpsTransactionsViewProps> = () => {
4344
const { styles } = useStyles(styleSheet, {});
@@ -331,14 +332,11 @@ const PerpsTransactionsView: React.FC<PerpsTransactionsViewProps> = () => {
331332

332333
const renderEmptyState = () => (
333334
<View style={styles.emptyContainer}>
334-
<Text style={styles.emptyText}>
335-
{strings('perps.transactions.empty_state.no_transactions', {
335+
<TabEmptyState
336+
description={strings('perps.transactions.empty_state.no_transactions', {
336337
type: activeFilter.toLowerCase(),
337338
})}
338-
</Text>
339-
<Text style={styles.emptyText}>
340-
{strings('perps.transactions.empty_state.history_will_appear')}
341-
</Text>
339+
></TabEmptyState>
342340
</View>
343341
);
344342

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Engine from '../../../../../core/Engine';
1111
import { PredictEventValues } from '../../constants/eventNames';
1212
import { TraceName } from '../../../../../util/trace';
1313
import { usePredictMeasurement } from '../../hooks/usePredictMeasurement';
14-
14+
import { TabEmptyState } from '../../../../../component-library/components-temp/TabEmptyState';
1515
interface PredictTransactionsViewProps {
1616
transactions?: unknown[];
1717
tabLabel?: string;
@@ -254,13 +254,10 @@ const PredictTransactionsView: React.FC<PredictTransactionsViewProps> = ({
254254
<ActivityIndicator size="small" testID="activity-indicator" />
255255
</Box>
256256
) : sections.length === 0 ? (
257-
<Box twClassName="px-4">
258-
<Text
259-
variant={TextVariant.BodySm}
260-
twClassName="text-alternative py-2"
261-
>
262-
{strings('predict.transactions.no_transactions')}
263-
</Text>
257+
<Box twClassName="items-center justify-center py-10">
258+
<TabEmptyState
259+
description={strings('predict.transactions.no_transactions')}
260+
/>
264261
</Box>
265262
) : (
266263
// TODO: Improve loading state, pagination, consider FlashList for better performance, pull down to refresh, etc.

app/components/UI/Ramp/Aggregator/Views/OrdersList/OrdersList.styles.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import { Colors } from '../../../../../../util/theme/models';
33

44
const createStyles = (colors: Colors) =>
55
StyleSheet.create({
6-
emptyMessage: {
7-
textAlign: 'center',
8-
},
96
row: {
107
borderBottomWidth: StyleSheet.hairlineWidth,
118
borderColor: colors.border.muted,

app/components/UI/Ramp/Aggregator/Views/OrdersList/OrdersList.tsx

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@ import { OrderOrderTypeEnum } from '@consensys/on-ramp-sdk/dist/API';
88
import { createOrderDetailsNavDetails } from '../OrderDetails/OrderDetails';
99
import { useRampNavigation } from '../../../hooks/useRampNavigation';
1010
import OrderListItem from '../../components/OrderListItem';
11-
import Row from '../../components/Row';
1211
import createStyles from './OrdersList.styles';
13-
14-
import Text, {
15-
TextColor,
16-
TextVariant,
17-
} from '../../../../../../component-library/components/Texts/Text';
12+
import { TabEmptyState } from '../../../../../../component-library/components-temp/TabEmptyState';
1813

1914
import {
2015
FIAT_ORDER_PROVIDERS,
@@ -141,23 +136,17 @@ function OrdersList() {
141136
renderItem={renderItem}
142137
keyExtractor={(item) => item.id}
143138
ListEmptyComponent={
144-
<Row>
145-
<Text
146-
variant={TextVariant.HeadingMD}
147-
color={TextColor.Muted}
148-
style={styles.emptyMessage}
149-
>
150-
{currentFilter === 'ALL'
151-
? strings('fiat_on_ramp_aggregator.empty_orders_list')
152-
: null}
153-
{currentFilter === 'PURCHASE'
154-
? strings('fiat_on_ramp_aggregator.empty_buy_orders_list')
155-
: null}
156-
{currentFilter === 'SELL'
157-
? strings('fiat_on_ramp_aggregator.empty_sell_orders_list')
158-
: null}
159-
</Text>
160-
</Row>
139+
<Box twClassName="w-full items-center py-10">
140+
<TabEmptyState
141+
description={
142+
currentFilter === 'ALL'
143+
? strings('fiat_on_ramp_aggregator.empty_orders_list')
144+
: currentFilter === 'PURCHASE'
145+
? strings('fiat_on_ramp_aggregator.empty_buy_orders_list')
146+
: strings('fiat_on_ramp_aggregator.empty_sell_orders_list')
147+
}
148+
/>
149+
</Box>
161150
}
162151
/>
163152
);

0 commit comments

Comments
 (0)