Skip to content

Commit

Permalink
Merge pull request #1804 from nervosnetwork/testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY authored Nov 15, 2024
2 parents 6fbb020 + b7a58cb commit 489835c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,9 @@
"type_script_hash": "Type Script Hash",
"holders": "Holders",
"unique_addresses": "Unique CKB Addresses",
"rgbpp_holders_count": "Holders",
"display_unique_ckb_addresses": "Display Unique CKB Addresses",
"display_rgbpp_holders": "Display RGB++ Holders",
"decimal": "Decimal",
"transactions": "24hr Transactions",
"address_count": "Address Count",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,9 @@
"type_script_hash": "Type Script Hash",
"holders": "用户数",
"unique_addresses": "CKB 地址数",
"rgbpp_holders_count": "持有人数",
"display_unique_ckb_addresses": "展示 CKB 地址数",
"display_rgbpp_holders": "展示 RGB++ 持有人数",
"decimal": "小数位",
"transactions": "24小时交易数",
"address_count": "用户数",
Expand Down
1 change: 1 addition & 0 deletions src/models/Xudt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface XUDTHolderAllocation {
}

export interface XUDT {
holdersCount: string
addressesCount: string
createdAt: string
h24CkbTransactionsCount: string
Expand Down
47 changes: 36 additions & 11 deletions src/pages/Xudts/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Table } from 'antd'
import { Table, Tooltip } from 'antd'
import { useHistory } from 'react-router'
import { useQuery, UseQueryResult } from '@tanstack/react-query'
import { useTranslation } from 'react-i18next'
import { FC, ReactNode, useState } from 'react'
Expand Down Expand Up @@ -197,6 +198,10 @@ const TokenTable: FC<{
isEmpty: boolean
}> = ({ query, sortParam, isEmpty }) => {
const { t } = useTranslation()
const RGBPP_VIEW = 'rgbpp'
const { location } = useHistory()
const urlQuery = new URLSearchParams(location.search)
const isRgbppView = urlQuery.get('view') === RGBPP_VIEW

const nullableColumns: (ColumnGroupType<XUDT> | ColumnType<XUDT> | false | undefined)[] = [
{
Expand Down Expand Up @@ -251,16 +256,36 @@ const TokenTable: FC<{
className: styles.colTransactions,
render: (_, token) => localeNumberString(token.h24CkbTransactionsCount),
},
{
title: (
<>
<span>{t('xudt.unique_addresses')}</span>
<SortButton field="addresses_count" sortParam={sortParam} />
</>
),
className: styles.colAddressCount,
render: (_, token) => localeNumberString(token.addressesCount),
},
isRgbppView
? {
title: (
<Tooltip title={t('xudt.display_rgbpp_holders')}>
<Link
to={`${location.pathname}?${new URLSearchParams({ ...urlQuery, view: 'ckb' })}`}
style={{ color: 'var(--primary-color)' }}
>
{t('xudt.rgbpp_holders_count')}
</Link>
</Tooltip>
),
className: styles.colAddressCount,
render: (_, token) => localeNumberString(token.holdersCount),
}
: {
title: (
<Tooltip title={t('xudt.display_unique_ckb_addresses')}>
<Link
to={`${location.pathname}?${new URLSearchParams({ ...urlQuery, view: RGBPP_VIEW })}`}
style={{ color: 'var(--primary-color)' }}
>
{t('xudt.unique_addresses')}
</Link>
<SortButton field="addresses_count" sortParam={sortParam} />
</Tooltip>
),
className: styles.colAddressCount,
render: (_, token) => localeNumberString(token.addressesCount),
},
{
title: (
<>
Expand Down

0 comments on commit 489835c

Please sign in to comment.