Skip to content

Commit

Permalink
feat(nft-tag): white list
Browse files Browse the repository at this point in the history
  • Loading branch information
Daryl-L committed Jul 31, 2024
1 parent 5472b20 commit fb3ca59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/components/NFTTag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -30,7 +32,7 @@ const NFTTag = ({ tagName, to }: { tagName: string; to?: string }) => {
push(`${to ?? window.location.pathname}?${search}`)
}

return (
return whiteList.includes(tagName) ? (
<button
type="button"
className={classNames(styles.container, styles.normal)}
Expand All @@ -39,7 +41,7 @@ const NFTTag = ({ tagName, to }: { tagName: string; to?: string }) => {
>
{content}
</button>
)
) : null
}

export default NFTTag
4 changes: 2 additions & 2 deletions src/pages/NftCollections/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -89,7 +89,7 @@ const filterList = [
title: <NFTTag key="layer-2-asset" tagName="layer-2-asset" />,
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
Expand Down

0 comments on commit fb3ca59

Please sign in to comment.