Skip to content

feat: add swap page trending tokens section#26620

Merged
bfullam merged 37 commits into
mainfrom
swaps-4038-trending-tokens
Mar 6, 2026
Merged

feat: add swap page trending tokens section#26620
bfullam merged 37 commits into
mainfrom
swaps-4038-trending-tokens

Conversation

@bfullam
Copy link
Copy Markdown
Contributor

@bfullam bfullam commented Feb 26, 2026

Description

This PR implements the mobile Swap zero-state Trending Tokens experience for Bridge and hardens related Bridge rendering behavior.

Key updates:

  • Added BridgeTrendingTokensSection to render Trending tokens only in Swap zero state.
  • Added filter controls (Sort by / Network / Time) and list chunking with a centered "Load more" action while preserving single-screen scroll behavior.
  • Refined BridgeView content-mode precedence so loading/error/quote/zero states render deterministically.
  • Preserved quote + confirm visibility during quote refresh (isLoading && activeQuote) and only show skeleton when loading without an active quote.
  • Updated/expanded Bridge tests and removed brittle snapshot dependency in BridgeView tests.

Changelog

CHANGELOG entry: Added Trending tokens to the mobile Swap zero state with filter controls and improved Bridge quote/loading state handling.

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-4038

Manual testing steps

Feature: Swap zero-state trending list on mobile

  Scenario: Trending list visibility follows zero state
    Given user is on the Swap screen
    When no source amount is entered
    Then Trending tokens are visible below the swap form
    When user enters a non-zero source amount
    Then Trending tokens are hidden

  Scenario: Numpad hidden on initial load
    Given user opens Swap for the first time
    When the screen is rendered
    Then numpad is hidden and swap form is visible

  Scenario: Quote loading and refresh behavior
    Given user has entered a non-zero amount
    When quote is loading with no active quote
    Then quote skeleton is shown and trending list is hidden
    When quote is refreshing with an active quote
    Then quote content and confirm button remain visible

  Scenario: Single scroll behavior
    Given user is in zero state with Trending tokens visible
    When user scrolls
    Then swap form and trending list scroll together in one vertical scroll area

  Scenario: Filters update results
    Given user is in zero state with Trending tokens visible
    When user changes Sort by, Network, or Time filters
    Then list content updates to match selected filters
    And default sort is Price change high to low

Screenshots/Recordings

Before

N/A

After

Screen.Recording.2026-03-02.at.20.03.31.mov

Pre-merge author checklist

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.

Note

Medium Risk
Changes Bridge/Swap screen rendering precedence (loading/error/quote/zero) and scroll behavior, which could affect quote visibility and confirm UX during refreshes. Mostly UI/state-driven with good test coverage but touches a core transaction entry flow.

Overview
Adds a Swap zero-state Trending Tokens section to BridgeView, gated behind the temporary swapsTrendingTokens remote feature flag, with filter bottom sheets and incremental “show more” loading triggered by button or near-bottom scroll.

Refactors BridgeView to render deterministically via a contentMode state machine: shows a QuoteDetailsCardSkeleton only when loading without an active quote, preserves quote + confirm UI while refreshing (isLoading && activeQuote), and keeps error banners/zero-state separate from quote content.

Updates styles to support a single unified scroll area (inputs + dynamic content), introduces new testIDs, and rewrites/expands tests to avoid brittle snapshots and to assert the new loading/error/quote/zero behaviors (including mocking the trending section).

Written by Cursor Bugbot for commit ab8ffe2. This will update automatically on new commits. Configure here.

@bfullam bfullam requested a review from a team as a code owner February 26, 2026 09:10
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-swaps-and-bridge Swaps and Bridge team label Feb 26, 2026
Comment thread app/components/UI/Bridge/Views/BridgeView/BridgeView.styles.ts
Comment thread app/components/UI/Bridge/Views/BridgeView/BridgeView.test.tsx
Comment thread app/components/UI/Bridge/Views/BridgeView/index.tsx Outdated
@bfullam bfullam changed the title feat: simplify bridge trending chunk loading feat: add bridge swap zero-state trending tokens Feb 27, 2026
@bfullam bfullam requested a review from a team as a code owner March 3, 2026 14:47
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

bfullam added 4 commits March 3, 2026 15:57
…okens

# Conflicts:
#	app/components/UI/Bridge/Views/BridgeView/__snapshots__/BridgeView.test.tsx.snap
#	app/components/UI/Bridge/Views/BridgeView/index.tsx
GeorgeGkas
GeorgeGkas previously approved these changes Mar 5, 2026
@bfullam bfullam enabled auto-merge March 6, 2026 07:56
@bfullam bfullam disabled auto-merge March 6, 2026 07:56
## **Description**

Adds minimal SmokeTrade E2E coverage for Bridge Swap Trending Tokens
zero-state behavior as a follow-up to the feature PR to keep
implementation and test review separated.

Scope is intentionally narrow:
- Verifies zero-state trending section visibility and filter interaction
flow.
- Verifies row navigation behavior from trending list.
- Uses existing smoke framework/page-object patterns.

## **Changelog**

CHANGELOG entry: null

## **Related issues**

Fixes: Follow-up coverage for
#26620 (SWAPS-4038)

## **Manual testing steps**

```gherkin
Feature: Swap trending tokens smoke coverage

  Scenario: user validates bridge zero-state trending interactions
    Given the app is running with swap trending tokens enabled
    And the user is on the Swap screen in Bridge zero state

    When the user opens and applies trending filters
    Then the trending list reflects the selected filters

    When the user taps a trending token row
    Then the user is navigated to that token's asset details
```

## **Screenshots/Recordings**

### **Before**

N/A (test-only follow-up PR)

### **After**

N/A (test-only follow-up PR)

## **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
- [ ] 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]
> **Low Risk**
> Test-only additions; primary risk is potential flakiness due to new
Detox selectors, scrolling, and network mocking for trending
tokens/feature flags.
> 
> **Overview**
> Adds SmokeTrade E2E coverage for **Swap Trending Tokens (Bridge
zero-state)**, including a new `SwapTrendingTokensView` page object for
interacting with the trending section, filters, bottom sheets, and token
rows.
> 
> Introduces a new smoke spec that enables the `swapsTrendingTokens`
remote flag, mocks the `/v3/tokens/trending` proxy responses (all
networks vs Base-only), verifies filter behavior and default sort text,
confirms tapping a row opens token details, and asserts the trending
section hides once a swap amount is entered.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7e90d12. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
GeorgeGkas
GeorgeGkas previously approved these changes Mar 6, 2026
bfullam and others added 2 commits March 6, 2026 09:17
Reverts #26910

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is
generating a summary for commit
73b52d4. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: @PerformanceSwaps
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR introduces Trending Tokens functionality to the Bridge View, which is a significant UI change to the swap/bridge flow. Key changes include:

  1. BridgeView modifications: Added BridgeTrendingTokensSection component that displays trending tokens when no amount is entered (zero state). Changed scroll behavior, content rendering logic, and moved token input areas inside ScrollView.

  2. Trending component changes: Modified TrendingTokenNetworkBottomSheet, TrendingTokenPriceChangeBottomSheet, and TrendingTokenTimeBottomSheet to remove auto-open effects. These components are shared with the Trending tab in SmokeWalletPlatform.

  3. TokenInputArea change: Changed autoFocus from true to false, which affects the initial user experience when entering the Bridge view.

  4. useBridgeViewOnFocus hook: Simplified to only handle blur/close on unfocus, removing auto-focus on first mount.

Tag Selection Rationale:

  • SmokeTrade: Required - Bridge/swap functionality is directly modified with new UI elements, behavior changes, and the new trending tokens section
  • SmokeWalletPlatform: Required - Trending components (bottom sheets) are modified and shared with the Trending tab. Per tag description, changes to Trending views affect this tag.
  • SmokeConfirmations: Required - Per SmokeTrade tag description, swap/bridge flows require confirmations, so this tag should be included when selecting SmokeTrade.

The changes are feature-flagged behind swapsTrendingTokens remote feature flag, which provides some safety, but the modifications to shared Trending components and the TokenInputArea autoFocus change could affect existing flows.

Performance Test Selection:
The changes affect the Bridge/Swap view with new UI components (BridgeTrendingTokensSection), scroll handling for lazy loading, and skeleton loading states. These changes could impact swap flow performance, particularly: 1) Initial render time with the new trending tokens section, 2) Scroll performance with the new scroll event handling and lazy loading, 3) Quote loading experience with the new skeleton component. The @PerformanceSwaps tag covers swap flow performance including quote fetching and UI responsiveness, which aligns with these changes.

View GitHub Actions results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

⚠️ E2E Fixture Validation — Structural changes detected

Category Count
New keys 68
Missing keys 11
Type mismatches 0
Value mismatches 7 (informational)

The committed fixture schema is out of date. To update, comment:

@metamaskbot update-mobile-fixture

View full details | Download diff report

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 6, 2026

@bfullam bfullam added this pull request to the merge queue Mar 6, 2026
Merged via the queue into main with commit 3fba94e Mar 6, 2026
98 of 99 checks passed
@bfullam bfullam deleted the swaps-4038-trending-tokens branch March 6, 2026 09:09
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 6, 2026
@metamaskbot metamaskbot added the release-7.70.0 Issue or pull request that will be included in release 7.70.0 label Mar 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.70.0 Issue or pull request that will be included in release 7.70.0 size-XL team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants