Commit 79b02e11 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Adjust NFT token title (#1797)

Fixes #1790
parent f95bb0f8
...@@ -174,8 +174,21 @@ const TokenInstanceContent = () => { ...@@ -174,8 +174,21 @@ const TokenInstanceContent = () => {
pagination = holdersQuery.pagination; pagination = holdersQuery.pagination;
} }
const title = (() => {
if (typeof tokenInstanceQuery.data?.metadata?.name === 'string') {
return tokenInstanceQuery.data.metadata.name;
}
if (tokenQuery.data?.symbol) {
return (tokenQuery.data.name || tokenQuery.data.symbol) + ' #' + tokenInstanceQuery.data?.id;
}
return `ID ${ tokenInstanceQuery.data?.id }`;
})();
const titleSecondRow = ( const titleSecondRow = (
<Flex alignItems="center" w="100%" minW={ 0 } columnGap={ 2 } rowGap={ 2 } flexWrap={{ base: 'wrap', lg: 'nowrap' }}> <Flex alignItems="center" w="100%" minW={ 0 } columnGap={ 2 } rowGap={ 2 } flexWrap={{ base: 'wrap', lg: 'nowrap' }}>
{ tokenQuery.data && (
<TokenEntity <TokenEntity
token={ tokenQuery.data } token={ tokenQuery.data }
isLoading={ isLoading } isLoading={ isLoading }
...@@ -188,6 +201,7 @@ const TokenInstanceContent = () => { ...@@ -188,6 +201,7 @@ const TokenInstanceContent = () => {
w="auto" w="auto"
maxW="700px" maxW="700px"
/> />
) }
{ !isLoading && tokenInstanceQuery.data && <AddressAddToWallet token={ tokenQuery.data } variant="button"/> } { !isLoading && tokenInstanceQuery.data && <AddressAddToWallet token={ tokenQuery.data } variant="button"/> }
<AddressQrCode address={ address } isLoading={ isLoading }/> <AddressQrCode address={ address } isLoading={ isLoading }/>
<AccountActionsMenu isLoading={ isLoading }/> <AccountActionsMenu isLoading={ isLoading }/>
...@@ -199,7 +213,7 @@ const TokenInstanceContent = () => { ...@@ -199,7 +213,7 @@ const TokenInstanceContent = () => {
<> <>
<TextAd mb={ 6 }/> <TextAd mb={ 6 }/>
<PageTitle <PageTitle
title={ `ID ${ tokenInstanceQuery.data?.id }` } title={ title }
backLink={ backLink } backLink={ backLink }
contentAfter={ tokenTag } contentAfter={ tokenTag }
secondRow={ titleSecondRow } secondRow={ titleSecondRow }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment