diff --git a/src/locales/en.json b/src/locales/en.json index f26b887ce3..03f2528469 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -735,6 +735,10 @@ "repeat_inscription_symbol": "This inscription is a duplicate with an earlier release of the same symbol." }, "xudt": { + "holder_allocation": "Holder Allocation", + "holder_allocation_description": "There are {{ckb}} CKB Holders and {{btc}} BTC holders of current asset.", + "lock_hash": "Lock Hash", + "count": "Count", "xudt": "xUDT", "xudts": "xUDTs", "name": "Name", diff --git a/src/locales/zh.json b/src/locales/zh.json index ccfe1fbbbc..a36049fc26 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -736,6 +736,10 @@ "repeat_inscription_symbol": "此铭文与早期发布的铭文同名" }, "xudt": { + "holder_allocation": "地址分布", + "holder_allocation_description": "当前地址有{{ckb}} CKB地址持有人及{{btc}} BTC 地址持有人", + "lock_hash": "Lock Hash", + "count": "Count", "xudt": "xUDT", "xudts": "xUDTs", "name": "名称", diff --git a/src/pages/Xudt/HolderAllocation.module.scss b/src/pages/Xudt/HolderAllocation.module.scss new file mode 100644 index 0000000000..60b09f14ea --- /dev/null +++ b/src/pages/Xudt/HolderAllocation.module.scss @@ -0,0 +1,92 @@ +@import '../../styles/variables.module'; + +.holderAllocationContainer { + background-color: #fff; + margin: 15% auto; + padding: 20px 40px; + width: 497px; + border-radius: 4px; + display: flex; + flex-direction: column; + align-items: center; + gap: 24px; + + @media (max-width: $mobileBreakPoint) { + width: 90%; + margin-top: 40%; + padding: 24px 16px; + align-items: flex-start; + + p { + line-height: 24px; + } + } + + h2 { + color: #333; + font-size: 16px; + font-style: normal; + font-weight: 700; + margin: 0; + } + + p { + margin: 0; + color: #333; + font-size: 14px; + font-style: normal; + font-weight: 400; + width: 100%; + word-wrap: break-word; + } + + .table { + border-radius: 4px; + border: 1px solid #e5e5e5; + padding: 1px; + + table { + thead { + background: #fafafa; + + tr { + div { + color: #666; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: normal; + text-transform: capitalize; + } + } + } + + tbody { + tr { + div { + color: #333; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: normal; + } + } + } + + thead, + tbody { + tr { + border-radius: 4px; + + div { + font-size: 14px; + padding: 12px 16px; + } + } + } + + width: 312px; + background: #fff; + } + } +} diff --git a/src/pages/Xudt/HolderAllocation.tsx b/src/pages/Xudt/HolderAllocation.tsx new file mode 100644 index 0000000000..309ec0bd96 --- /dev/null +++ b/src/pages/Xudt/HolderAllocation.tsx @@ -0,0 +1,76 @@ +import { useTranslation } from 'react-i18next' +import styles from './HolderAllocation.module.scss' + +const HolderAllocation = ({ typeHash }: { typeHash: string }) => { + const [t] = useTranslation() + return ( +
+

{t('xudt.holder_allocation')}

+

+ {t('xudt.holder_allocation_description', { + ckb: '1,000', + btc: '200', + })} + {typeHash} +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
{t('xudt.lock_hash')}
+
+
{t('xudt.count')}
+
+
secp256k1
+
+
200
+
+
omnilock
+
+
400
+
+
joyid
+
+
100
+
+
RGB++
+
+
400
+
+
other
+
+
300
+
+
+
+ ) +} + +export default HolderAllocation diff --git a/src/pages/Xudt/UDTComp.tsx b/src/pages/Xudt/UDTComp.tsx index 972beba9f1..53c658a808 100644 --- a/src/pages/Xudt/UDTComp.tsx +++ b/src/pages/Xudt/UDTComp.tsx @@ -8,7 +8,6 @@ import { EyeClosedIcon, EyeOpenIcon } from '@radix-ui/react-icons' import { Link } from '../../components/Link' import { CsvExport } from '../../components/CsvExport' import TransactionItem from '../../components/TransactionItem/index' -import { UDTTransactionsPagination, UDTTransactionsPanel, TypeScriptController, UDTNoResultPanel } from './styled' import { parseUDTAmount } from '../../utils/number' import { ReactComponent as OpenInNew } from '../../assets/open_in_new.svg' import { deprecatedAddrToNewAddr, getBtcUtxo } from '../../utils/util' @@ -23,6 +22,9 @@ import { RawBtcRPC } from '../../services/ExplorerService' import { XUDT } from '../../models/Xudt' import { getBtcTxList } from '../../services/ExplorerService/fetcher' import XUDTTag from '../../components/XUDTTag' +import SimpleButton from '../../components/SimpleButton' +import SimpleModal from '../../components/Modal' +import HolderAllocation from './HolderAllocation' const IssuerContent: FC<{ address: string }> = ({ address }) => { const { t } = useTranslation() @@ -56,6 +58,7 @@ export const UDTOverviewCard = ({ typeHash, xudt }: { typeHash: string; xudt: XU const { t } = useTranslation() const isMobile = useIsMobile() const [isScriptDisplayed, setIsScriptDisplayed] = useState(false) + const [showHolderAmountModal, setShowHolderAmountModal] = useState(false) const issuer = xudt?.issuerAddress const script = xudt?.typeScript ?? null @@ -104,7 +107,18 @@ export const UDTOverviewCard = ({ typeHash, xudt }: { typeHash: string; xudt: XU }, { title: t('xudt.holder_addresses'), - content: xudt?.addressesCount ?? '-', + content: xudt?.addressesCount ? ( + { + setShowHolderAmountModal(true) + }} + > + {xudt.addressesCount} + + ) : ( + '-' + ), }, { title: t('xudt.symbol'), @@ -137,8 +151,11 @@ export const UDTOverviewCard = ({ typeHash, xudt }: { typeHash: string; xudt: XU + + + - + {isScriptDisplayed ? (
@@ -150,7 +167,7 @@ export const UDTOverviewCard = ({ typeHash, xudt }: { typeHash: string; xudt: XU
{t('xudt.type_script_hash')}
)} -
+ {isScriptDisplayed ? ( script &&