feat: add segment events for tabs UI#29767
Conversation
- Add HomepageDiscoveryTabs component with Portfolio, Perpetuals, and Predictions tabs - Wire A/B test gate in Wallet — treatment renders discovery tabs, control renders existing homepage - Lazy-mount Perps and Predictions inline as tab content with hideHeader prop to suppress duplicate headers - Extend TabsList/TabsBar/Tab to support per-tab icons using local icon system - Register portfolio and predict custom SVG icons - Add per-tab gradient overlay that bleeds into wallet header with color per tab - Fix Perps safe area top inset when rendered as embedded tab
…tmcu-591-homepage-hub-tabs-ui
…tmcu-591-homepage-hub-tabs-ui
…tmcu-591-homepage-hub-tabs-ui
…underline, re-enable A/B variant gating, and add test coverage for keepMounted and new PerpsHomeView props
…tmcu-591-homepage-hub-tabs-ui
Co-authored-by: Cursor <cursoragent@cursor.com>
…ndexRef update order and prevent control variant layout regression from shared portfolioHeader margin
Adds Tab, TabsBar, and TabsList to components-temp with animated underline, scrollable overflow detection, icon support, and height collapse animation. Adds Candlestick, Portfolio, and Predict icons.
Introduces TabsIconTab, TabsIconBar, and TabsIconList as a new icon-only tab variant alongside the existing Tabs family. Reverts all modifications to the base Tabs components to avoid downstream regressions.
…nges to Tab family
… fix style override and sparse array reset
…mcu-591-homepage-hub-tabs-ui
|
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. |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 517ed3e. Configure here.
…mcu-591-homepage-hub-tabs-ui
…tmcu-591-homepage-hub-tabs-ui
…homepage-hub-tabs-segment-events
…tmcu-591-homepage-hub-tabs-segment-events
…ub.com:MetaMask/metamask-mobile into feat-tmcu-591-homepage-hub-tabs-segment-events
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: The
The risk is low because: (1) only analytics tracking is added, (2) the hook uses refs to avoid stale closures, (3) comprehensive unit tests are included, (4) no rendering performance impact expected from a simple Performance Test Selection: |
|
| @@ -0,0 +1,55 @@ | |||
| import { useCallback, useEffect, useRef } from 'react'; | |||
There was a problem hiding this comment.
useEffect is not used here, we can remove it from imports




Description
Adds
Home ViewedSegment event tracking for the hub page discovery tabs UI. Firesinteraction_type: tab_viewedon initial mount (Portfolio) and on every subsequent tab switch, using a stable ref-based callback so analytics reads are never stale without causing extra re-renders.visitId === 0(session not yet initialized), and exposes a stabletrackTabViewed(name)callback.active_ab_testsforHOME_VIEWEDis injected automatically by the existing analytics registryHUB_PAGE_DISCOVERY_TABS_AB_TEST_ANALYTICS_MAPPING, no extra wiring needed here.HomepageDiscoveryTabs.Changelog
CHANGELOG entry:null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-592
Manual testing steps
Screenshots/Recordings
Screen.Recording.2026-05-05.at.4.42.41.PM.mov
Before
~After
~Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Low risk: adds Segment/MetaMetrics event tracking on homepage discovery tab mount/switch with unit tests; no auth, funds, or persistence logic changed.
Overview
Adds
useTabViewedEventto emitMetaMetricsEvents.HOME_VIEWEDwithinteraction_type: 'tab_viewed'and tab name, includingentry_point,app_session_id, andvisit_numberfrom homepage scroll context.Updates
HomepageDiscoveryTabsto fire the event on initial mount (Portfolio) and on each distinct tab switch, and extends tests to assert the tracking is called correctly (including not re-firing when re-pressing the active tab).Reviewed by Cursor Bugbot for commit 53f3626. Bugbot is set up for automated code reviews on this repo. Configure here.