Skip to content

Commit 88b007a

Browse files
Prithpal-SooriyaPrithpal Sooriya
andauthored
fix: route DeFi empty-state CTA to Explore sites (#29552)
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## **Description** This change updates the DeFi empty-state `Explore DeFi` CTA behavior so it no longer opens the external MetaMask Portfolio explore tokens URL in the in-app browser. Instead, pressing the CTA now navigates users to the in-app Explore flow and opens the Explore **Sites** section (`TrendingView -> SitesFullView`), matching the requested product direction and avoiding the blank page issue. ## **Changelog** CHANGELOG entry: Fixed the DeFi empty-state Explore button to open the in-app Explore sites screen instead of an external portfolio page. ## **Related issues** Fixes: #29471 https://consensyssoftware.atlassian.net/browse/ASSETS-3133 ## **Manual testing steps** ```gherkin Feature: DeFi empty-state Explore CTA navigation Scenario: user opens Explore from empty DeFi tab Given the user is on the DeFi tab with no open positions When user taps the "Explore DeFi" button Then the app navigates to the Explore Sites screen And the app does not open portfolio.metamask.io/explore/tokens ``` ## **Screenshots/Recordings** ### **Before** N/A ### **After** https://www.loom.com/share/04b68f115a2c44a190bd7049b5ee323e https://www.loom.com/share/88e42d07ee06480a90abde1d4771add2 ## **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 - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] 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 - [ ] I've tested with a power user scenario - [ ] I've instrumented key operations with Sentry traces for production performance metrics ## **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_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-9cac285f-d4ce-4156-a35e-004942245eb2"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-9cac285f-d4ce-4156-a35e-004942245eb2"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div> --------- Co-authored-by: Prithpal Sooriya <prithpal@example.com>
1 parent 6902301 commit 88b007a

2 files changed

Lines changed: 8 additions & 16 deletions

File tree

app/components/UI/DefiEmptyState/DefiEmptyState.test.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,15 @@ describe('DefiEmptyState', () => {
2323
expect(getByText('Explore DeFi')).toBeDefined();
2424
});
2525

26-
it('should navigate to explore tokens page in in-app browser', () => {
26+
it('opens Explore on the main feed then Sites full view', () => {
2727
const { getByText } = renderWithProvider(<DefiEmptyState />);
2828

2929
const button = getByText('Explore DeFi');
3030
fireEvent.press(button);
3131

32-
expect(mockNavigate).toHaveBeenCalledWith('BrowserTabHome', {
33-
screen: 'BrowserView',
34-
params: {
35-
newTabUrl:
36-
'https://portfolio.metamask.io/explore/tokens?MetaMaskEntry=mobile',
37-
timestamp: expect.any(Number),
38-
},
32+
expect(mockNavigate).toHaveBeenNthCalledWith(1, 'TrendingView', {
33+
screen: 'TrendingFeed',
3934
});
35+
expect(mockNavigate).toHaveBeenNthCalledWith(2, 'SitesFullView');
4036
});
4137
});

app/components/UI/DefiEmptyState/DefiEmptyState.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
type TabEmptyStateProps,
99
} from '../../../component-library/components-temp/TabEmptyState';
1010
import { strings } from '../../../../locales/i18n';
11-
import AppConstants from '../../../core/AppConstants';
1211
import Routes from '../../../constants/navigation/Routes';
1312

1413
import emptyStateDefiLight from '../../../images/empty-state-defi-light.png';
@@ -22,14 +21,11 @@ export const DefiEmptyState: React.FC<DefiEmptyStateProps> = (props) => {
2221
const tw = useTailwind();
2322

2423
const handleExploreDefi = () => {
25-
// Navigate to explore tokens page in the in-app browser
26-
navigate(Routes.BROWSER.HOME, {
27-
screen: Routes.BROWSER.VIEW,
28-
params: {
29-
newTabUrl: AppConstants.EXPLORE_TOKENS.URL,
30-
timestamp: Date.now(),
31-
},
24+
// Open the Explore tab on the main feed, then push Sites (root stack).
25+
navigate(Routes.TRENDING_VIEW, {
26+
screen: Routes.TRENDING_FEED,
3227
});
28+
navigate(Routes.SITES_FULL_VIEW);
3329
};
3430

3531
return (

0 commit comments

Comments
 (0)