Added a 'Verify contract details' link to SetApprovalForAll confirmation screens (#15756)
parent
a87c1750b0
commit
bf1db006fd
@ -0,0 +1 @@ |
||||
export { default } from './nft-collection-image'; |
@ -0,0 +1,7 @@ |
||||
.collection-image-alt { |
||||
border-radius: 50%; |
||||
width: 24px; |
||||
height: 24px; |
||||
padding: 2px; |
||||
background: var(--color-overlay-alternative); |
||||
} |
@ -0,0 +1,45 @@ |
||||
import React from 'react'; |
||||
import PropTypes from 'prop-types'; |
||||
import { useSelector } from 'react-redux'; |
||||
import Box from '../box'; |
||||
import { COLORS, TEXT_ALIGN } from '../../../helpers/constants/design-system'; |
||||
import Identicon from '../identicon'; |
||||
import { getTokenList } from '../../../selectors'; |
||||
import { useCollectiblesCollections } from '../../../hooks/useCollectiblesCollections'; |
||||
|
||||
export default function NftCollectionImage({ assetName, tokenAddress }) { |
||||
const { collections } = useCollectiblesCollections(); |
||||
const tokenList = useSelector(getTokenList); |
||||
const nftTokenListImage = tokenList[tokenAddress.toLowerCase()]?.iconUrl; |
||||
|
||||
const renderCollectionImageOrName = () => { |
||||
const collection = Object.values(collections).find( |
||||
({ collectionName }) => collectionName === assetName, |
||||
); |
||||
|
||||
if (collection?.collectionImage || nftTokenListImage) { |
||||
return ( |
||||
<Identicon |
||||
diameter={24} |
||||
image={collection?.collectionImage || nftTokenListImage} |
||||
/> |
||||
); |
||||
} |
||||
return ( |
||||
<Box |
||||
color={COLORS.OVERLAY_INVERSE} |
||||
textAlign={TEXT_ALIGN.CENTER} |
||||
className="collection-image-alt" |
||||
> |
||||
{assetName?.[0]?.toUpperCase() ?? null} |
||||
</Box> |
||||
); |
||||
}; |
||||
|
||||
return <Box>{renderCollectionImageOrName()}</Box>; |
||||
} |
||||
|
||||
NftCollectionImage.propTypes = { |
||||
assetName: PropTypes.string, |
||||
tokenAddress: PropTypes.string, |
||||
}; |
Loading…
Reference in new issue