Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/components/UI/Perps/Views/PerpsHomeView/PerpsHomeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const PerpsHomeView = () => {
orders,
watchlistMarkets,
perpsMarkets, // Crypto markets (renamed from trendingMarkets)
commoditiesMarkets, // Commodity markets
stocksMarkets, // Equity markets only
forexMarkets,
recentActivity,
Expand Down Expand Up @@ -503,6 +504,15 @@ const PerpsHomeView = () => {
/>
</View>

{/* Commodities Markets List */}
<PerpsMarketTypeSection
title={strings('perps.home.commodities')}
markets={commoditiesMarkets}
marketType="commodities"
sortBy={sortBy}
isLoading={isLoading.markets}
/>

{/* Stocks Markets List */}
<View onLayout={handleSectionLayout('explore_stocks')}>
<PerpsMarketTypeSection
Expand Down
7 changes: 5 additions & 2 deletions app/components/UI/Perps/Views/PerpsTabView/PerpsTabView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,11 @@ const PerpsTabView = () => {

const handleSeeAllPerps = useCallback(() => {
navigation.navigate(Routes.PERPS.ROOT, {
screen: Routes.PERPS.PERPS_HOME,
params: { source: PerpsEventValues.SOURCE.HOMESCREEN_TAB },
screen: Routes.PERPS.MARKET_LIST,
params: {
defaultMarketTypeFilter: 'all',
source: PerpsEventValues.SOURCE.HOMESCREEN_TAB,
},
});
}, [navigation]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const PerpsMarketRowItem = ({
onPress,
iconSize = HOME_SCREEN_CONFIG.DefaultIconSize,
displayMetric = 'volume',
showBadge = true,
showBadge = false, // We can re-enable this if/when we decide to render the badges for stocks and commodities
}: PerpsMarketRowItemProps) => {
const { styles } = useStyles(styleSheet, {});

Expand Down
18 changes: 9 additions & 9 deletions app/components/UI/Perps/hooks/usePerpsTabExploreData.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,15 @@ describe('usePerpsTabExploreData', () => {
expect(result.current.exploreMarkets[7].symbol).toBe('TOKEN7');
});

it('filters out non-crypto/equity market types', () => {
it('includes all market types without filtering', () => {
// Arrange
const mixedMarkets: PerpsMarketDataWithVolumeNumber[] = [
{ ...mockMarkets[0], marketType: undefined }, // crypto (no type)
{ ...mockMarkets[1], marketType: 'equity' }, // equity
{
...mockMarkets[2],
marketType: 'forex' as PerpsMarketData['marketType'],
}, // forex - should be filtered out
}, // forex
];
mockUsePerpsMarkets.mockReturnValue({
markets: mixedMarkets,
Expand All @@ -212,13 +212,13 @@ describe('usePerpsTabExploreData', () => {
usePerpsTabExploreData({ enabled: true }),
);

// Assert - forex should be filtered out
expect(result.current.exploreMarkets).toHaveLength(2);
expect(
result.current.exploreMarkets.every(
(m) => !m.marketType || m.marketType === 'equity',
),
).toBe(true);
// Assert - all market types are included (no filtering)
expect(result.current.exploreMarkets).toHaveLength(3);
expect(result.current.exploreMarkets.map((m) => m.symbol)).toEqual([
'BTC',
'ETH',
'SOL',
]);
});

it('returns empty watchlist when no symbols match', () => {
Expand Down
11 changes: 2 additions & 9 deletions app/components/UI/Perps/hooks/usePerpsTabExploreData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,11 @@ export const usePerpsTabExploreData = ({
// Get watchlist symbols from Redux
const watchlistSymbols = useSelector(selectPerpsWatchlistMarkets);

// Filter explore markets: crypto + equity, top 8 by volume
// Filter explore markets: all market types, top 8 by volume
// Markets are already sorted by volume from usePerpsMarkets
const exploreMarkets = useMemo(() => {
if (!enabled) return [];
return markets
.filter(
(m) =>
!m.marketType ||
m.marketType === 'crypto' ||
m.marketType === 'equity',
)
.slice(0, EXPLORE_MARKETS_LIMIT);
return markets.slice(0, EXPLORE_MARKETS_LIMIT);
}, [markets, enabled]);

// Filter watchlist markets
Expand Down