Skip to content

Commit 89e2ce8

Browse files
authored
feat: brwoser button (#22871)
<!-- 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** add browser button <!-- 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: add browser button ## **Related issues** Fixes: ## **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** <!-- [screenshots/recordings] --> https://github.com/user-attachments/assets/392276db-5423-45fd-b4ab-cae558e16c4b ## **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] > Adds a browser button that displays the open tab count and refactors search bar layout/padding across Trending and Explore screens, with tests for states and navigation. > > - **TrendingView UI** > - Replaces header controls with a row containing `ExploreSearchBar` and a bordered browser button. > - Browser button now shows `browser.tabs.length` as a `ButtonLink` label; falls back to `Add` icon when zero. > - Integrates theme colors for border and updates padding (`px-4`/`pb-3`). > - **ExploreSearchBar** > - Removes outer padding wrapper; exposes just the row layout and content. > - Keeps interactive mode clear/cancel; cancel rendered alongside input when focused. > - **ExploreSearchScreen** > - Wraps `ExploreSearchBar` in a padded container (`px-4 pb-3`). > - **Tests** (`TrendingView.test.tsx`) > - Adds cases for browser button states (0/1/many tabs) and navigation to `TrendingBrowser`. > - Verifies presence of search bar button and header title. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 72174b6. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent ff0fd5a commit 89e2ce8

File tree

4 files changed

+415
-51
lines changed

4 files changed

+415
-51
lines changed

app/components/Views/TrendingView/ExploreSearchBar/ExploreSearchBar.tsx

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -101,40 +101,38 @@ const ExploreSearchBar: React.FC<ExploreSearchBarProps> = (props) => {
101101
);
102102

103103
return (
104-
<Box twClassName="px-4 pb-3">
105-
<Box
106-
flexDirection={BoxFlexDirection.Row}
107-
alignItems={BoxAlignItems.Center}
108-
twClassName="gap-2"
109-
>
110-
{isButtonMode ? (
111-
<TouchableOpacity
112-
onPress={props.onPress}
113-
testID="explore-view-search-button"
114-
activeOpacity={0.7}
115-
style={tw.style('flex-1')}
116-
>
117-
{searchBarContent}
118-
</TouchableOpacity>
119-
) : (
120-
<>
121-
<Box twClassName="flex-1">{searchBarContent}</Box>
122-
{props.isSearchFocused && (
123-
<TouchableOpacity
124-
onPress={handleCancel}
125-
testID="explore-search-cancel-button"
104+
<Box
105+
flexDirection={BoxFlexDirection.Row}
106+
alignItems={BoxAlignItems.Center}
107+
twClassName="gap-2"
108+
>
109+
{isButtonMode ? (
110+
<TouchableOpacity
111+
onPress={props.onPress}
112+
testID="explore-view-search-button"
113+
activeOpacity={0.7}
114+
style={tw.style('flex-1')}
115+
>
116+
{searchBarContent}
117+
</TouchableOpacity>
118+
) : (
119+
<>
120+
<Box twClassName="flex-1">{searchBarContent}</Box>
121+
{props.isSearchFocused && (
122+
<TouchableOpacity
123+
onPress={handleCancel}
124+
testID="explore-search-cancel-button"
125+
>
126+
<Text
127+
variant={TextVariant.BodyMd}
128+
style={tw.style('text-default font-medium')}
126129
>
127-
<Text
128-
variant={TextVariant.BodyMd}
129-
style={tw.style('text-default font-medium')}
130-
>
131-
{strings('transaction.cancel')}
132-
</Text>
133-
</TouchableOpacity>
134-
)}
135-
</>
136-
)}
137-
</Box>
130+
{strings('transaction.cancel')}
131+
</Text>
132+
</TouchableOpacity>
133+
)}
134+
</>
135+
)}
138136
</Box>
139137
);
140138
};

app/components/Views/TrendingView/ExploreSearchScreen/ExploreSearchScreen.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ const ExploreSearchScreen: React.FC = () => {
2121

2222
return (
2323
<Box style={{ paddingTop: insets.top }} twClassName="flex-1 bg-default">
24-
<ExploreSearchBar
25-
type="interactive"
26-
isSearchFocused
27-
searchQuery={searchQuery}
28-
onSearchChange={setSearchQuery}
29-
onCancel={handleSearchCancel}
30-
/>
24+
<Box twClassName="px-4 pb-3">
25+
<ExploreSearchBar
26+
type="interactive"
27+
isSearchFocused
28+
searchQuery={searchQuery}
29+
onSearchChange={setSearchQuery}
30+
onCancel={handleSearchCancel}
31+
/>
32+
</Box>
3133

3234
<PerpsConnectionProvider>
3335
<PerpsStreamProvider>

0 commit comments

Comments
 (0)