From fb3ca59e589fbc0adced0dec669aa27f0a063858 Mon Sep 17 00:00:00 2001 From: daryl Date: Wed, 31 Jul 2024 15:06:58 +0800 Subject: [PATCH] feat(nft-tag): white list --- src/components/NFTTag/index.tsx | 6 ++++-- src/pages/NftCollections/List.tsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/NFTTag/index.tsx b/src/components/NFTTag/index.tsx index 556269b92..35e45418e 100644 --- a/src/components/NFTTag/index.tsx +++ b/src/components/NFTTag/index.tsx @@ -3,6 +3,8 @@ import { useTranslation } from 'react-i18next' import { useHistory } from 'react-router-dom' import styles from './styles.module.scss' +export const whiteList = ['invalid', 'suspicious', 'out-of-length-range', 'rgb++', 'layer-1-asset', 'layer-2-asset'] + const NFTTag = ({ tagName, to }: { tagName: string; to?: string }) => { const { t } = useTranslation() const { push } = useHistory() @@ -30,7 +32,7 @@ const NFTTag = ({ tagName, to }: { tagName: string; to?: string }) => { push(`${to ?? window.location.pathname}?${search}`) } - return ( + return whiteList.includes(tagName) ? ( - ) + ) : null } export default NFTTag diff --git a/src/pages/NftCollections/List.tsx b/src/pages/NftCollections/List.tsx index dd88d8648..288892a37 100644 --- a/src/pages/NftCollections/List.tsx +++ b/src/pages/NftCollections/List.tsx @@ -14,7 +14,7 @@ import type { NFTCollection } from '../../services/ExplorerService/fetcher' import { useNFTCollectionsSortParam } from './util' import { parseSimpleDate } from '../../utils/date' import MultiFilterButton from '../../components/MultiFilterButton' -import NFTTag from '../../components/NFTTag' +import NFTTag, { whiteList } from '../../components/NFTTag' import { Card } from '../../components/Card' import { FilterSortContainerOnMobile } from '../../components/FilterSortContainer' import AddressText from '../../components/AddressText' @@ -89,7 +89,7 @@ const filterList = [ title: , to: '/nft-collections', }, -] +].filter(f => whiteList.includes(f.key)) export const isTxFilterType = (s?: string): boolean => { return s ? ['all', 'm_nft', 'nrc721', 'cota', 'spore'].includes(s) : false