Skip to content

Commit

Permalink
feat: update tags of xudt
Browse files Browse the repository at this point in the history
1. hide supply-unlimited
2. rename rgbpp-compatible to rgb++
3. hide rgbpp tags in xudt token list
4. display rgbpp tag on xudt detail page

ref:
1. unlimited: Magickbase/ckb-explorer-public-issues#755
2. rgbpp: Magickbase/ckb-explorer-public-issues#755
  • Loading branch information
Keith-CY committed Jul 17, 2024
1 parent 4150723 commit 3dd5604
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
9 changes: 8 additions & 1 deletion src/components/XUDTTag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import { useHistory } from 'react-router-dom'
import styles from './styles.module.scss'

const HIDDEN_TAGS = ['duplicate', 'suspicious']
const HIDDEN_TAGS = ['duplicate', 'suspicious', 'supply-unlimited']

const XUDTTag = ({ tagName }: { tagName: string }) => {
const { t } = useTranslation()
Expand All @@ -19,6 +19,13 @@ const XUDTTag = ({ tagName }: { tagName: string }) => {
content = content.replace('Platform', tag.replace('verified-on-', ''))
tag = 'verified-on'
}

// FIXME: data should be updated in the backend
// issue: https://github.com/Magickbase/ckb-explorer-public-issues/issues/754
if (tag === 'rgbpp-compatible') {
content = 'RGB++'
}

const handleClick = () => {
const search = new URLSearchParams(window.location.search)
const tags = search.get('tags')?.split(',') ?? []
Expand Down
9 changes: 8 additions & 1 deletion src/pages/Xudt/UDTComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ export const UDTOverviewCard = ({
</div>
)

const tags = xudt?.xudtTags ?? []
// FIXME: data should be updated in the backend
// issue: https://github.com/Magickbase/ckb-explorer-public-issues/issues/754
if (!tags.includes('rgbpp-compatible')) {
tags.unshift('rgbpp-compatible')
}

return (
<>
<Card className={styles.udtOverviewCard} style={{ marginBottom: 16 }}>
Expand All @@ -194,7 +201,7 @@ export const UDTOverviewCard = ({
/>

<div className={styles.tags}>
{xudt?.xudtTags?.map(tag => (
{tags.map(tag => (
<XUDTTag tagName={tag} />
))}
</div>
Expand Down
19 changes: 6 additions & 13 deletions src/pages/Xudts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ const filterList = [
title: <XUDTTag tagName="supply-limited" />,
to: '/xudts',
},
{
key: 'supply-unlimited',
value: 'supply-unlimited',
title: <XUDTTag tagName="supply-unlimited" />,
to: '/xudts',
},
{
key: 'rgbpp-compatible',
value: 'rgbpp-compatible',
title: <XUDTTag tagName="rgbpp-compatible" />,
to: '/xudts',
},
]

const TokenInfo: FC<{ token: XUDT }> = ({ token }) => {
Expand Down Expand Up @@ -311,7 +299,12 @@ const Xudts = () => {
throw new Error('Tokens empty')
}
return {
tokens,
tokens: tokens.map(token => ({
...token,
// FIXME: data should be updated in the backend
// issue: https://github.com/Magickbase/ckb-explorer-public-issues/issues/754
xudtTags: token.xudtTags?.filter(tag => tag !== 'rgbpp-compatible'),
})),
total,
pageSize,
}
Expand Down

0 comments on commit 3dd5604

Please sign in to comment.