From 019d43ef025389a3909c5e874d003d4c060c859d Mon Sep 17 00:00:00 2001 From: daryl Date: Sat, 11 May 2024 14:44:24 +0800 Subject: [PATCH] feat(address): nrc 721 (#298) * feat(address): nrc 721 * feat(nrc721): add the prefix word `id:` for token id --------- Signed-off-by: Chen Yu Co-authored-by: Chen Yu --- src/pages/Address/AddressAssetComp.tsx | 25 ++++--------------- src/pages/Address/AddressComp.tsx | 2 ++ src/pages/Address/Cells.tsx | 9 ++++--- src/pages/Address/MergedAssetList.tsx | 2 +- .../Address/addressAssetComp.module.scss | 1 + src/pages/Address/cells.module.scss | 6 +++++ 6 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/pages/Address/AddressAssetComp.tsx b/src/pages/Address/AddressAssetComp.tsx index e2b6e4c03..453dba981 100644 --- a/src/pages/Address/AddressAssetComp.tsx +++ b/src/pages/Address/AddressAssetComp.tsx @@ -10,6 +10,7 @@ import { formatNftDisplayId, handleNftImgError, hexToBase64, patchMibaoImg } fro import { getDobs } from '../../services/DobsService' import { sliceNftName } from '../../utils/string' import styles from './addressAssetComp.module.scss' +import EllipsisMiddle from '../../components/EllipsisMiddle' export const AddressAssetComp = ({ href, @@ -51,9 +52,7 @@ export const AddressAssetComp = ({ )}
{name}
-
- {property} -
+
@@ -177,16 +176,7 @@ export const AddressMNFTComp = ({ account, isRGBPP }: { account: MNFT; isRGBPP?: ) } -export const AddressNRC721Comp = ({ - account, - isRGBPP, - isMerged = false, -}: { - account: NRC721 - isRGBPP?: boolean - isMerged?: boolean -}) => { - const { t } = useTranslation() +export const AddressNRC721Comp = ({ account, isRGBPP }: { account: NRC721; isRGBPP?: boolean }) => { const { symbol, amount, udtIconFile, collection } = account const [icon, setIcon] = useState(udtIconFile) @@ -205,17 +195,12 @@ export const AddressNRC721Comp = ({ }) }, [udtIconFile]) - let name = !symbol ? '?' : sliceNftName(symbol) - if (isMerged) { - name = `${t('rgbpp.amount')}: ${(+amount).toLocaleString('en')}` - } - return ( = ({ address }) => { case 'm_nft_token': return + case 'nrc_721_token': return + default: return null } diff --git a/src/pages/Address/Cells.tsx b/src/pages/Address/Cells.tsx index 756b493eb..872c56ddd 100644 --- a/src/pages/Address/Cells.tsx +++ b/src/pages/Address/Cells.tsx @@ -22,6 +22,7 @@ import { useSetToast } from '../../components/Toast' import { PAGE_SIZE } from '../../constants/common' import styles from './cells.module.scss' import SmallLoading from '../../components/Loading/SmallLoading' +import { sliceNftName } from '../../utils/string' enum Sort { TimeAsc = 'block_timestamp.asc', @@ -164,8 +165,10 @@ const Cell: FC<{ cell: LiveCell }> = ({ cell }) => { } case 'nrc_721': { icon = SUDTTokenIcon - assetName = 'NRC 721' - attribute = '-' + assetName = !cell.extraInfo.symbol + ? '?' + : sliceNftName(`${cell.extraInfo.symbol} #${cell.extraInfo.typeHash.slice(0, 3)}`) + attribute = cell.extraInfo.amount break } case 'm_nft': { @@ -201,7 +204,7 @@ const Cell: FC<{ cell: LiveCell }> = ({ cell }) => {
{assetName}
- {attribute} +
{attribute}
{detailInfo ? (