From c474fef53dbe33c05ed7af115eabb8d6aa08ead7 Mon Sep 17 00:00:00 2001 From: maciek Date: Thu, 10 Aug 2023 12:38:22 +0200 Subject: [PATCH] chore: all markets in market selector - small fixes --- apps/trading/components/market-selector/market-selector.tsx | 2 +- apps/trading/components/market-selector/product-selector.tsx | 3 ++- .../market-selector/use-market-selector-list.spec.tsx | 2 +- .../components/market-selector/use-market-selector-list.ts | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/trading/components/market-selector/market-selector.tsx b/apps/trading/components/market-selector/market-selector.tsx index a5d3ba774..dfcca13c9 100644 --- a/apps/trading/components/market-selector/market-selector.tsx +++ b/apps/trading/components/market-selector/market-selector.tsx @@ -39,7 +39,7 @@ export const MarketSelector = ({ }) => { const [filter, setFilter] = useState({ searchTerm: '', - product: 'All', + product: Product.All, sort: Sort.None, assets: [], }); diff --git a/apps/trading/components/market-selector/product-selector.tsx b/apps/trading/components/market-selector/product-selector.tsx index 5fef50dbc..6669ae183 100644 --- a/apps/trading/components/market-selector/product-selector.tsx +++ b/apps/trading/components/market-selector/product-selector.tsx @@ -17,7 +17,7 @@ export type ProductType = keyof typeof Product; const ProductTypeMapping: { [key in ProductType]: string; } = { - All: 'All', + [Product.All]: 'All', [Product.Future]: 'Futures', [Product.Spot]: 'Spot', [Product.Perpetual]: 'Perpetuals', @@ -56,6 +56,7 @@ export const ProductSelector = ({ className="flex items-center gap-2 ml-auto" title={t('See all markets')} > + {t('Browse')} diff --git a/apps/trading/components/market-selector/use-market-selector-list.spec.tsx b/apps/trading/components/market-selector/use-market-selector-list.spec.tsx index 936dba08d..0741aa889 100644 --- a/apps/trading/components/market-selector/use-market-selector-list.spec.tsx +++ b/apps/trading/components/market-selector/use-market-selector-list.spec.tsx @@ -122,7 +122,7 @@ describe('useMarketSelectorList', () => { expect(result.current.markets).toEqual([markets[2]]); rerender({ searchTerm: '', - product: 'All', + product: Product.All, sort: Sort.None, assets: [], }); diff --git a/apps/trading/components/market-selector/use-market-selector-list.ts b/apps/trading/components/market-selector/use-market-selector-list.ts index 671c686eb..a9626fd66 100644 --- a/apps/trading/components/market-selector/use-market-selector-list.ts +++ b/apps/trading/components/market-selector/use-market-selector-list.ts @@ -5,6 +5,7 @@ import { calcCandleVolume, useMarketList } from '@vegaprotocol/markets'; import { priceChangePercentage } from '@vegaprotocol/utils'; import type { Filter } from '../../components/market-selector/market-selector'; import { Sort } from './sort-dropdown'; +import { Product } from './product-selector'; // Used for sort order and filter const MARKET_TEMPLATE = [ @@ -29,7 +30,7 @@ export const useMarketSelectorList = ({ // only selected product type .filter((m) => { if ( - product === 'All' || + product === Product.All || m.tradableInstrument.instrument.product.__typename === product ) { return true;