Commit cdfd9cfd authored by Max Alekseenko's avatar Max Alekseenko

add more checks!

parent f15f9095
...@@ -21,9 +21,9 @@ const AppActionButton = ({ data, className, txHash, source }: Props) => { ...@@ -21,9 +21,9 @@ const AppActionButton = ({ data, className, txHash, source }: Props) => {
const defaultTextColor = useColorModeValue('blue.600', 'blue.300'); const defaultTextColor = useColorModeValue('blue.600', 'blue.300');
const defaultBg = useColorModeValue('gray.100', 'gray.700'); const defaultBg = useColorModeValue('gray.100', 'gray.700');
const { appID, textColor, bgColor, appActionButtonText, appLogoURL } = data; const { appID, textColor, bgColor, appActionButtonText, appLogoURL, appMarketplaceURL } = data;
const actionURL = data.appMarketplaceURL?.replace('{chainId}', config.chain.id || '').replace('{txHash}', txHash || ''); const actionURL = appMarketplaceURL?.replace('{chainId}', config.chain.id || '').replace('{txHash}', txHash || '');
const handleClick = React.useCallback(() => { const handleClick = React.useCallback(() => {
const info = appID || actionURL; const info = appID || actionURL;
...@@ -32,15 +32,21 @@ const AppActionButton = ({ data, className, txHash, source }: Props) => { ...@@ -32,15 +32,21 @@ const AppActionButton = ({ data, className, txHash, source }: Props) => {
} }
}, [ source, appID, actionURL ]); }, [ source, appID, actionURL ]);
if ((!appID && !appMarketplaceURL) || (!appActionButtonText && !appLogoURL)) {
return null;
}
const content = ( const content = (
<> <>
<Image { appLogoURL && (
src={ appLogoURL } <Image
alt={ `${ appActionButtonText } button` } src={ appLogoURL }
boxSize={ 5 } alt={ `${ appActionButtonText } button` }
borderRadius="sm" boxSize={ 5 }
mr={ 2 } borderRadius="sm"
/> mr={ 2 }
/>
) }
<Text fontSize="sm" fontWeight="500" color="currentColor"> <Text fontSize="sm" fontWeight="500" color="currentColor">
{ appActionButtonText } { appActionButtonText }
</Text> </Text>
......
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