Skip to content

Conversation

georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Sep 29, 2025

Description

This PR improves the user experience by hiding network selector controls in empty states across homepage tabs (DeFi, NFT, and Perps). When users have no positions, collectibles, or perps data, the network selector is no longer displayed, providing a cleaner and less cluttered interface.

Changes Made:

  • CollectibleContracts: Network selector only appears when filteredCollectibleContracts?.length > 0
  • DeFiPositionsList: Network selector hidden in empty state, only shows DefiEmptyState component
  • PerpsTabView: Control bar hidden when no positions/orders exist, shows PerpsEmptyState directly
  • Updated corresponding test files to reflect the new conditional rendering logic

This change follows the principle of progressive disclosure - showing relevant controls only when users have content to manage.

Changelog

CHANGELOG entry: null

Related issues

Fixes: Internal UX improvement initiative

Manual testing steps

Feature: Hide network selectors in empty states

  Scenario: user views NFT tab with no collectibles
    Given I am on the Wallet homepage
    And I have no NFT collectibles
    When user navigates to the NFT tab
    Then I should see the NFT empty state
    And I should NOT see the network selector

  Scenario: user views DeFi tab with no positions  
    Given I am on the Wallet homepage
    And I have no DeFi positions
    When user navigates to the DeFi tab
    Then I should see the DeFi empty state
    And I should NOT see the network selector

  Scenario: user views Perps tab with no positions/orders
    Given I am on the Wallet homepage  
    And I have no Perps positions or orders
    When user navigates to the Perps tab
    Then I should see the Perps empty state
    And I should NOT see the control bar

  Scenario: user views tabs with existing data
    Given I am on the Wallet homepage
    And I have NFTs, DeFi positions, or Perps data
    When user navigates to any of these tabs
    Then I should see the network selector
    And I should see my existing data

Screenshots/Recordings

Before

Network selectors were visible in empty states, creating visual clutter when users had no content to filter.

After

Clean empty states without network selectors, showing only relevant content and call-to-action elements.

after720.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.

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

@georgewrmarshall georgewrmarshall self-assigned this Sep 29, 2025
Copy link
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-design-system All issues relating to design system in Mobile label Sep 29, 2025
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Sep 29, 2025
@georgewrmarshall georgewrmarshall added team-mobile-platform Mobile Platform team needs-qa Any New Features that needs a full manual QA prior to being added to a release. No QA Needed Apply this label when your PR does not need any QA effort. and removed needs-qa Any New Features that needs a full manual QA prior to being added to a release. team-mobile-platform Mobile Platform team labels Sep 29, 2025
@metamaskbot metamaskbot removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Sep 29, 2025
@georgewrmarshall georgewrmarshall added the Run Smoke E2E Requires smoke E2E testing label Sep 29, 2025
@georgewrmarshall georgewrmarshall force-pushed the tabs-hide-network-selectors branch from 1100843 to ea81d55 Compare October 1, 2025 16:29
RefreshControl,
ActivityIndicator,
} from 'react-native';
import { useTailwind } from '@metamask/design-system-twrnc-preset';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer using useTailwind hook because we can use the twClassName prop directly in the CollectiblesEmptyState component

@georgewrmarshall georgewrmarshall force-pushed the tabs-hide-network-selectors branch 2 times, most recently from f384f42 to d9edc95 Compare October 1, 2025 17:28
Comment on lines 1165 to 1172
collectibleContracts={{
'0x1': [
{
address: '0x1234567890123456789012345678901234567890',
name: 'Test NFT Collection',
symbol: 'TNFT',
},
],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We shouldn't be passing state directly like this

@georgewrmarshall georgewrmarshall force-pushed the tabs-hide-network-selectors branch from ab73ca1 to d49c8ea Compare October 1, 2025 18:33
Comment on lines -578 to +588
<View style={styles.actionBarWrapper}>
<View style={styles.controlButtonOuterWrapper}>
<ButtonBase
testID={WalletViewSelectorsIDs.COLLECTIBLES_NETWORK_FILTER}
label={
<>
{isRemoveGlobalNetworkSelectorEnabled() ? (
<View style={styles.networkManagerWrapper}>
{!areAllNetworksSelected && (
<Avatar
variant={AvatarVariant.Network}
size={AvatarSize.Xs}
name={networkName}
imageSource={networkImageSource}
/>
)}
{shouldShowNetworkSelector && (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bad visualization of changes here but we are changing the network selector to be rendered conditionally. No other changes


it('calls onDiscoverCollectibles when action button is pressed', () => {
const mockOnDiscoverCollectibles = jest.fn();
it('calls onAction when action button is pressed', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move these rename changes into a different PR

Comment on lines -331 to -333
expect(
await findByTestId(WalletViewSelectorsIDs.DEFI_POSITIONS_NETWORK_FILTER),
).toBeOnTheScreen();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will need to improve the tests here

import { View, FlatList } from 'react-native';
import { strings } from '../../../../locales/i18n';
import { useSelector } from 'react-redux';
import { useTailwind } from '@metamask/design-system-twrnc-preset';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move this out in to a different PR

Copy link

sonarqubecloud bot commented Oct 1, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No QA Needed Apply this label when your PR does not need any QA effort. Run Smoke E2E Requires smoke E2E testing size-M team-design-system All issues relating to design system in Mobile
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants