chore: all markets in market selector - small fixes

This commit is contained in:
maciek
2023-08-10 12:38:22 +02:00
parent fe9dfcf911
commit c474fef53d
4 changed files with 6 additions and 4 deletions
@@ -39,7 +39,7 @@ export const MarketSelector = ({
}) => {
const [filter, setFilter] = useState<Filter>({
searchTerm: '',
product: 'All',
product: Product.All,
sort: Sort.None,
assets: [],
});
@@ -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')}
>
<span className="underline underline-offset-4">{t('Browse')}</span>
<VegaIcon name={VegaIconNames.ARROW_RIGHT} />
</Link>
</div>
@@ -122,7 +122,7 @@ describe('useMarketSelectorList', () => {
expect(result.current.markets).toEqual([markets[2]]);
rerender({
searchTerm: '',
product: 'All',
product: Product.All,
sort: Sort.None,
assets: [],
});
@@ -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;