Skip to content

Commit 4fa454f

Browse files
chore(runway): cherry-pick fix: [Explore] design issues cp-7.63.0 (#25193)
- fix: [Explore] design issues cp-7.63.0 (#25165) <!-- 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** Solved multiple bugs: - [Explore] Arrow in subheads should be near titles and remove "View More". Design is dark screen attached. - [Explore] Rename "Tokens" to "Trending tokens" - [Explore] Button corner radius for button row should be 12px, not 16px. <!-- 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: solved multiple design issues in trending ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2540 & https://consensyssoftware.atlassian.net/browse/ASSETS-2541 & https://consensyssoftware.atlassian.net/browse/ASSETS-2542 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **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/67338a81-72e2-459d-afb9-72ccdd931306 <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] 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. ## **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] > Implements design tweaks for Explore/Trending. > > - SectionHeader: header is now a `TouchableOpacity` that triggers `viewAllAction`; shows title with right arrow; removes separate "View all" text/button while keeping `testID` prefix `section-header-view-all-...` > - Rename "Tokens" to `trending.trending_tokens` ("Trending tokens") in `sections.config.tsx`, tests, e2e selectors/mappings, and `en.json` > - QuickActions: change chip style from `rounded-2xl` to `rounded-xl` (12px) > - Updated unit/e2e tests and selectors to align with new titles and header interaction > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d51db76. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> [b7e231d](b7e231d) Co-authored-by: Juanmi <95381763+juanmigdr@users.noreply.github.com>
1 parent 6cd0bbf commit 4fa454f

8 files changed

Lines changed: 34 additions & 44 deletions

File tree

app/components/Views/TrendingView/components/ExploreSearchResults/ExploreSearchResults.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describe('ExploreSearchResults', () => {
104104
);
105105

106106
expect(getByTestId('trending-search-results-list')).toBeDefined();
107-
expect(getByText('Tokens')).toBeDefined();
107+
expect(getByText('Trending tokens')).toBeDefined();
108108
expect(getByText('Perps')).toBeDefined();
109109
expect(getByText('Predictions')).toBeDefined();
110110
});
@@ -129,7 +129,7 @@ describe('ExploreSearchResults', () => {
129129
<ExploreSearchResults searchQuery="btc" />,
130130
);
131131

132-
expect(getByText('Tokens')).toBeDefined();
132+
expect(getByText('Trending tokens')).toBeDefined();
133133
expect(queryByText('Perps')).toBeNull();
134134
expect(queryByText('Predictions')).toBeNull();
135135
});

app/components/Views/TrendingView/components/QuickActions/QuickActions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const QuickActions: React.FC<QuickActionsProps> = ({ emptySections }) => {
4545
onPress={() => section.viewAllAction(navigation)}
4646
testID={`quick-action-${section.id}`}
4747
style={tw.style(
48-
'flex-row items-center justify-center gap-1 rounded-2xl bg-background-section px-3 py-2',
48+
'flex-row items-center justify-center gap-1 rounded-xl bg-background-section px-3 py-2',
4949
)}
5050
>
5151
<Icon

app/components/Views/TrendingView/components/SectionHeader/SectionHeader.test.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,40 @@ describe('SectionHeader', () => {
2424
jest.clearAllMocks();
2525
});
2626

27-
it('renders title and view all text for predictions section', () => {
27+
it('renders title for predictions section', () => {
2828
const { getByText } = renderWithProvider(
2929
<SectionHeader sectionId="predictions" />,
3030
{ state: initialState },
3131
);
3232

3333
expect(getByText('Predictions')).toBeOnTheScreen();
34-
expect(getByText('View all')).toBeOnTheScreen();
3534
});
3635

37-
it('renders title and view all text for tokens section', () => {
36+
it('renders title for tokens section', () => {
3837
const { getByText } = renderWithProvider(
3938
<SectionHeader sectionId="tokens" />,
4039
{ state: initialState },
4140
);
4241

43-
expect(getByText('Tokens')).toBeOnTheScreen();
44-
expect(getByText('View all')).toBeOnTheScreen();
42+
expect(getByText('Trending tokens')).toBeOnTheScreen();
4543
});
4644

47-
it('renders title and view all text for perps section', () => {
45+
it('renders title for perps section', () => {
4846
const { getByText } = renderWithProvider(
4947
<SectionHeader sectionId="perps" />,
5048
{ state: initialState },
5149
);
5250

5351
expect(getByText('Perps')).toBeOnTheScreen();
54-
expect(getByText('View all')).toBeOnTheScreen();
5552
});
5653

57-
it('calls navigation action when view all button is pressed', () => {
58-
const { getByText } = renderWithProvider(
54+
it('calls navigation action when header is pressed', () => {
55+
const { getByTestId } = renderWithProvider(
5956
<SectionHeader sectionId="perps" />,
6057
{ state: initialState },
6158
);
6259

63-
fireEvent.press(getByText('View all'));
60+
fireEvent.press(getByTestId('section-header-view-all-perps'));
6461

6562
expect(mockNavigate).toHaveBeenCalledTimes(1);
6663
});

app/components/Views/TrendingView/components/SectionHeader/SectionHeader.tsx

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ import { TouchableOpacity } from 'react-native';
33
import { useTailwind } from '@metamask/design-system-twrnc-preset';
44
import {
55
Box,
6-
BoxFlexDirection,
7-
BoxAlignItems,
8-
BoxJustifyContent,
6+
Text,
7+
TextVariant,
8+
TextColor,
99
Icon,
1010
IconName,
1111
IconSize,
1212
IconColor,
13-
Text,
14-
TextVariant,
15-
TextColor,
13+
BoxFlexDirection,
14+
BoxAlignItems,
1615
} from '@metamask/design-system-react-native';
17-
import { strings } from '../../../../../../locales/i18n';
1816
import { SectionId, SECTIONS_CONFIG } from '../../sections.config';
1917
import { useNavigation } from '@react-navigation/native';
2018

@@ -35,28 +33,26 @@ const SectionHeader: React.FC<SectionHeaderProps> = ({ sectionId }) => {
3533
const sectionConfig = SECTIONS_CONFIG[sectionId];
3634

3735
return (
38-
<Box
39-
flexDirection={BoxFlexDirection.Row}
40-
justifyContent={BoxJustifyContent.Between}
41-
alignItems={BoxAlignItems.Center}
42-
twClassName="mb-2"
36+
<TouchableOpacity
37+
testID={`section-header-view-all-${sectionId}`}
38+
style={tw.style('flex-row items-center mb-2')}
39+
onPress={() => sectionConfig.viewAllAction(navigation)}
4340
>
44-
<Text variant={TextVariant.HeadingSm}>{sectionConfig.title}</Text>
45-
<TouchableOpacity
46-
testID={`section-header-view-all-${sectionId}`}
47-
onPress={() => sectionConfig.viewAllAction(navigation)}
48-
style={tw.style('flex-row items-center justify-center gap-1')}
41+
<Box
42+
flexDirection={BoxFlexDirection.Row}
43+
alignItems={BoxAlignItems.Center}
44+
gap={1}
4945
>
50-
<Text variant={TextVariant.BodyMd} color={TextColor.TextAlternative}>
51-
{strings('trending.view_all')}
46+
<Text variant={TextVariant.HeadingMd} color={TextColor.TextDefault}>
47+
{sectionConfig.title}
5248
</Text>
5349
<Icon
5450
name={IconName.ArrowRight}
5551
size={IconSize.Sm}
5652
color={IconColor.IconAlternative}
5753
/>
58-
</TouchableOpacity>
59-
</Box>
54+
</Box>
55+
</TouchableOpacity>
6056
);
6157
};
6258

app/components/Views/TrendingView/sections.config.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const PREDICTIONS_FUSE_OPTIONS: FuseOptions<PredictMarketType> = {
126126
export const SECTIONS_CONFIG: Record<SectionId, SectionConfig> = {
127127
tokens: {
128128
id: 'tokens',
129-
title: strings('trending.tokens'),
129+
title: strings('trending.trending_tokens'),
130130
icon: IconName.Ethereum,
131131
viewAllAction: (navigation) => {
132132
navigation.navigate(Routes.WALLET.TRENDING_TOKENS_FULL_VIEW);

e2e/pages/Trending/TrendingView.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class TrendingView {
133133
*/
134134
private getSectionId(sectionTitle: string): string {
135135
const sectionIdMap: Record<string, string> = {
136-
Tokens: 'tokens',
136+
'Trending tokens': 'tokens',
137137
Sites: 'sites',
138138
Predictions: 'predictions',
139139
Perps: 'perps',
@@ -192,11 +192,11 @@ class TrendingView {
192192
`section-header-view-all-${id}`,
193193
);
194194

195-
// Determine scroll direction: Predictions and Tokens are usually near top
196-
// But scrollToElement can handle both directions, so we try 'down' first
195+
// Determine scroll direction: Predictions and Trending tokens are usually near top
196+
// But scrollToElement can handle both directions, so we try 'up' first for top sections
197197
// and it will automatically adjust if needed
198198
const direction =
199-
sectionTitle === 'Predictions' || sectionTitle === 'Tokens'
199+
sectionTitle === 'Predictions' || sectionTitle === 'Trending tokens'
200200
? 'up'
201201
: 'down';
202202

e2e/selectors/Trending/TrendingView.selectors.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ export const TrendingViewSelectorsIDs = {
1919
} as const;
2020

2121
export const TrendingViewSelectorsText = {
22-
VIEW_ALL: 'View all',
23-
// Section titles might vary by localization, but these are for logical mapping
22+
// Section titles - must match the actual localized strings from sections.config.tsx
2423
SECTION_PREDICTIONS: 'Predictions',
25-
SECTION_TOKENS: 'Tokens',
24+
SECTION_TOKENS: 'Trending tokens',
2625
SECTION_PERPS: 'Perps',
2726
SECTION_SITES: 'Sites',
2827
} as const;

locales/languages/en.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7361,8 +7361,6 @@
73617361
},
73627362
"trending": {
73637363
"title": "Explore",
7364-
"view_all": "View all",
7365-
"tokens": "Tokens",
73667364
"trending_tokens": "Trending tokens",
73677365
"price_change": "Price change",
73687366
"all_networks": "All networks",

0 commit comments

Comments
 (0)