Commit 2adf101e authored by Igor Stuev's avatar Igor Stuev Committed by GitHub

Merge pull request #1558 from blockscout/fe-1538

token id can be null
parents 74c586cf 47a938de
...@@ -7,13 +7,13 @@ export type Erc20TotalPayload = { ...@@ -7,13 +7,13 @@ export type Erc20TotalPayload = {
} }
export type Erc721TotalPayload = { export type Erc721TotalPayload = {
token_id: string; token_id: string | null;
} }
export type Erc1155TotalPayload = { export type Erc1155TotalPayload = {
decimals: string | null; decimals: string | null;
value: string; value: string;
token_id: string; token_id: string | null;
} }
export type TokenTransfer = ( export type TokenTransfer = (
......
...@@ -61,7 +61,7 @@ const TokenTransferListItem = ({ ...@@ -61,7 +61,7 @@ const TokenTransferListItem = ({
<TxAdditionalInfo hash={ txHash } isMobile isLoading={ isLoading }/> <TxAdditionalInfo hash={ txHash } isMobile isLoading={ isLoading }/>
) } ) }
</Flex> </Flex>
{ 'token_id' in total && <NftEntity hash={ token.address } id={ total.token_id } isLoading={ isLoading }/> } { 'token_id' in total && total.token_id !== null && <NftEntity hash={ token.address } id={ total.token_id } isLoading={ isLoading }/> }
{ showTxInfo && txHash && ( { showTxInfo && txHash && (
<Flex justifyContent="space-between" alignItems="center" lineHeight="24px" width="100%"> <Flex justifyContent="space-between" alignItems="center" lineHeight="24px" width="100%">
<TxEntity <TxEntity
......
...@@ -65,7 +65,7 @@ const TokenTransferTableItem = ({ ...@@ -65,7 +65,7 @@ const TokenTransferTableItem = ({
</Flex> </Flex>
</Td> </Td>
<Td> <Td>
{ 'token_id' in total && <NftEntity hash={ token.address } id={ total.token_id } isLoading={ isLoading }/> } { 'token_id' in total && total.token_id !== null && <NftEntity hash={ token.address } id={ total.token_id } isLoading={ isLoading }/> }
</Td> </Td>
{ showTxInfo && txHash && ( { showTxInfo && txHash && (
<Td> <Td>
......
...@@ -87,7 +87,7 @@ const TokenTransferListItem = ({ ...@@ -87,7 +87,7 @@ const TokenTransferListItem = ({
) } ) }
</Grid> </Grid>
) } ) }
{ 'token_id' in total && (token.type === 'ERC-721' || token.type === 'ERC-1155') && ( { 'token_id' in total && (token.type === 'ERC-721' || token.type === 'ERC-1155') && total.token_id !== null && (
<NftEntity <NftEntity
hash={ token.address } hash={ token.address }
id={ total.token_id } id={ total.token_id }
......
...@@ -70,7 +70,7 @@ const TokenTransferTableItem = ({ ...@@ -70,7 +70,7 @@ const TokenTransferTableItem = ({
</Td> </Td>
{ (token.type === 'ERC-721' || token.type === 'ERC-1155') && ( { (token.type === 'ERC-721' || token.type === 'ERC-1155') && (
<Td> <Td>
{ 'token_id' in total ? ( { 'token_id' in total && total.token_id !== null ? (
<NftEntity <NftEntity
hash={ token.address } hash={ token.address }
id={ total.token_id } id={ total.token_id }
......
...@@ -9,7 +9,7 @@ import TokenEntity from 'ui/shared/entities/token/TokenEntity'; ...@@ -9,7 +9,7 @@ import TokenEntity from 'ui/shared/entities/token/TokenEntity';
interface Props { interface Props {
token: TokenInfo; token: TokenInfo;
value: string; value: string;
tokenId: string; tokenId: string | null;
} }
const NftTokenTransferSnippet = ({ value, token, tokenId }: Props) => { const NftTokenTransferSnippet = ({ value, token, tokenId }: Props) => {
...@@ -26,15 +26,18 @@ const NftTokenTransferSnippet = ({ value, token, tokenId }: Props) => { ...@@ -26,15 +26,18 @@ const NftTokenTransferSnippet = ({ value, token, tokenId }: Props) => {
) : ( ) : (
<chakra.span color="text_secondary">for token ID</chakra.span> <chakra.span color="text_secondary">for token ID</chakra.span>
) } ) }
<NftEntity { tokenId !== null ? (
hash={ token.address } <NftEntity
id={ tokenId } hash={ token.address }
fontWeight={ 600 } id={ tokenId }
iconSize="md" fontWeight={ 600 }
maxW={{ base: '100%', lg: '150px' }} iconSize="md"
w="auto" maxW={{ base: '100%', lg: '150px' }}
flexShrink={ 0 } w="auto"
/> flexShrink={ 0 }
/>
) : <chakra.span color="text_secondary"> N/A </chakra.span>
}
<chakra.span color="text_secondary">of</chakra.span> <chakra.span color="text_secondary">of</chakra.span>
<TokenEntity <TokenEntity
token={ token } token={ token }
......
import { Flex, Link, useBoolean } from '@chakra-ui/react'; import { Flex, Text, Link, useBoolean } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import NftEntity from 'ui/shared/entities/nft/NftEntity'; import NftEntity from 'ui/shared/entities/nft/NftEntity';
interface Props { interface Props {
items: Array<{total: { token_id: string} }>; items: Array<{total: { token_id: string | null} }>;
tokenAddress: string; tokenAddress: string;
isLoading?: boolean; isLoading?: boolean;
} }
...@@ -14,14 +14,20 @@ const TxStateTokenIdList = ({ items, tokenAddress, isLoading }: Props) => { ...@@ -14,14 +14,20 @@ const TxStateTokenIdList = ({ items, tokenAddress, isLoading }: Props) => {
return ( return (
<Flex flexDir="column" rowGap={ 2 }> <Flex flexDir="column" rowGap={ 2 }>
{ items.slice(0, isCut ? 3 : items.length).map((item, index) => ( { items.slice(0, isCut ? 3 : items.length).map((item, index) => {
<NftEntity if (item.total.token_id !== null) {
key={ index } return (
hash={ tokenAddress } <NftEntity
id={ item.total.token_id } key={ index }
isLoading={ isLoading } hash={ tokenAddress }
/> id={ item.total.token_id }
)) } isLoading={ isLoading }
/>
);
} else {
return <Text key={ index } color="text_secondary">N/A</Text>;
}
}) }
{ items.length > 3 && ( { items.length > 3 && (
<Link <Link
fontWeight={ 400 } fontWeight={ 400 }
......
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