Skip to content

Commit

Permalink
style(xudt-tag): move function to object for filter item list
Browse files Browse the repository at this point in the history
  • Loading branch information
Daryl-L committed Jun 27, 2024
1 parent f0a2198 commit 94201e5
Showing 1 changed file with 71 additions and 73 deletions.
144 changes: 71 additions & 73 deletions src/pages/Xudts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,75 @@ import XUDTTokenIcon from '../../assets/sudt_token.png'

type SortField = 'transactions' | 'addresses_count' | 'created_time' | 'mint_status'

const filterList = [
{
key: 'invalid',
value: 'invalid',
title: <XUDTTag tagName="invalid" />,
to: '',
},
{
key: 'suspicious',
value: 'suspicious',
title: <XUDTTag tagName="suspicious" />,
to: '',
},
{
key: 'out-of-length-range',
value: 'out-of-length-range',
title: <XUDTTag tagName="out-of-length-range" />,
to: '',
},
{
key: 'duplicate',
value: 'duplicate',
title: <XUDTTag tagName="duplicate" />,
to: '',
},
{
key: 'layer-1-asset',
value: 'layer-1-asset',
title: <XUDTTag tagName="layer-1-asset" />,
to: '',
},
{
key: 'layer-2-asset',
value: 'layer-2-asset',
title: <XUDTTag tagName="layer-2-asset" />,
to: '',
},
{
key: 'verified-on',
value: 'verified-on',
title: <XUDTTag tagName="verified-on" />,
to: '',
},
{
key: 'supply-limited',
value: 'supply-limited',
title: <XUDTTag tagName="supply-limited" />,
to: '',
},
{
key: 'supply-unlimited',
value: 'supply-unlimited',
title: <XUDTTag tagName="supply-unlimited" />,
to: '',
},
{
key: 'rgbpp-compatible',
value: 'rgbpp-compatible',
title: <XUDTTag tagName="rgbpp-compatible" />,
to: '',
},
{
key: 'category',
value: 'category',
title: <XUDTTag tagName="category" />,
to: '',
},
]

const TokenInfo: FC<{ token: XUDT }> = ({ token }) => {
const { t } = useTranslation()

Expand Down Expand Up @@ -118,7 +187,7 @@ export function TokensCard({
</span>
<span className={styles.sortOption}>
{t('xudt.title.tags')}
<MultiFilterButton filterName="tags" key="" filteredList={getFilterList()} />
<MultiFilterButton filterName="tags" key="" filteredList={filterList} />
</span>
</FilterSortContainerOnMobile>
</Card>
Expand All @@ -144,77 +213,6 @@ export function TokensCard({
)
}

const getFilterList = (): { key: string; value: string; to: string; title: string | JSX.Element }[] => {
return [
{
key: 'invalid',
value: 'invalid',
title: <XUDTTag tagName="invalid" />,
to: '',
},
{
key: 'suspicious',
value: 'suspicious',
title: <XUDTTag tagName="suspicious" />,
to: '',
},
{
key: 'out-of-length-range',
value: 'out-of-length-range',
title: <XUDTTag tagName="out-of-length-range" />,
to: '',
},
{
key: 'duplicate',
value: 'duplicate',
title: <XUDTTag tagName="duplicate" />,
to: '',
},
{
key: 'layer-1-asset',
value: 'layer-1-asset',
title: <XUDTTag tagName="layer-1-asset" />,
to: '',
},
{
key: 'layer-2-asset',
value: 'layer-2-asset',
title: <XUDTTag tagName="layer-2-asset" />,
to: '',
},
{
key: 'verified-on',
value: 'verified-on',
title: <XUDTTag tagName="verified-on" />,
to: '',
},
{
key: 'supply-limited',
value: 'supply-limited',
title: <XUDTTag tagName="supply-limited" />,
to: '',
},
{
key: 'supply-unlimited',
value: 'supply-unlimited',
title: <XUDTTag tagName="supply-unlimited" />,
to: '',
},
{
key: 'rgbpp-compatible',
value: 'rgbpp-compatible',
title: <XUDTTag tagName="rgbpp-compatible" />,
to: '',
},
{
key: 'category',
value: 'category',
title: <XUDTTag tagName="category" />,
to: '',
},
]
}

const TokenTable: FC<{
query: UseQueryResult<
{
Expand Down Expand Up @@ -259,7 +257,7 @@ const TokenTable: FC<{
title: (
<>
{t('xudt.title.tags')}
<MultiFilterButton filterName="tags" key="" filteredList={getFilterList()} />
<MultiFilterButton filterName="tags" key="" filteredList={filterList} />
</>
),
className: styles.colTags,
Expand Down

0 comments on commit 94201e5

Please sign in to comment.