diff --git a/packages/nextjs/components/rep-tokens/cards/token-card/TokenCard.tsx b/packages/nextjs/components/rep-tokens/cards/token-card/TokenCard.tsx index a8f0d4e..c66c794 100644 --- a/packages/nextjs/components/rep-tokens/cards/token-card/TokenCard.tsx +++ b/packages/nextjs/components/rep-tokens/cards/token-card/TokenCard.tsx @@ -37,21 +37,37 @@ export const TokenCard = ({ props }: TokenCardInternalProps) => { ); + let isDoneLoading = true; + + if (props) { + if (props.isPrettyLoading) { + if (props.valuesProps) { + if (Object.keys(props.valuesProps).length === 0) { + isDoneLoading &&= false; + } + let t: keyof typeof props.valuesProps; + for (t in props.valuesProps) { + if (props.valuesProps[t]) { + if (props.valuesProps[t]?.value === undefined) { + isDoneLoading &&= false; + } + } else { + isDoneLoading &&= false; + } + } + } else { + isDoneLoading &&= false; + } + } + } + return ( <>
- {props?.isPrettyLoading ? ( - props?.valuesProps?.imageProps?.value !== undefined && - props?.valuesProps?.balanceProps?.value !== undefined && - props?.valuesProps?.nameProps?.value !== undefined && - props?.valuesProps?.descriptionProps?.value !== undefined && - props?.valuesProps?.addressProps?.value !== undefined ? ( -
{output}
- ) : ( -

{props?.isPrettyLoading?.message}

- ) - ) : ( + {isDoneLoading ? (
{output}
+ ) : ( +

{props?.isPrettyLoading?.message}

)}
diff --git a/packages/nextjs/components/rep-tokens/utils/buildTokensCard.tsx b/packages/nextjs/components/rep-tokens/utils/buildTokensCard.tsx index bc6c39b..c7c1c54 100644 --- a/packages/nextjs/components/rep-tokens/utils/buildTokensCard.tsx +++ b/packages/nextjs/components/rep-tokens/utils/buildTokensCard.tsx @@ -71,32 +71,33 @@ export function buildTokenCard(token: Token, address?: string, tokenCardProps?: if (tokenCardProps?.cardClasses) obj.cardClasses = tokenCardProps?.cardClasses; if (tokenCardProps?.valuesProps) { - obj.valueProps = {}; + obj.valuesProps = {}; + if (tokenCardProps?.valuesProps?.balanceConfigProps) - obj.valueProps.balanceProps = buildBalanceCard(token.balance, tokenCardProps?.valuesProps?.balanceConfigProps); + obj.valuesProps.balanceProps = buildBalanceCard(token.balance, tokenCardProps?.valuesProps?.balanceConfigProps); if (tokenCardProps?.valuesProps?.nameConfigProps) - obj.valueProps.nameProps = buildStringCard(token.name, tokenCardProps?.valuesProps?.nameConfigProps); + obj.valuesProps.nameProps = buildStringCard(token.name, tokenCardProps?.valuesProps?.nameConfigProps); if (tokenCardProps?.valuesProps?.descriptionConfigProps) - obj.valueProps.descriptionProps = buildStringCard( + obj.valuesProps.descriptionProps = buildStringCard( token.description, tokenCardProps?.valuesProps?.descriptionConfigProps, ); if (tokenCardProps?.valuesProps?.imageConfigProps) - obj.valueProps.imageProps = buildImageCard(token.image, tokenCardProps?.valuesProps?.imageConfigProps); + obj.valuesProps.imageProps = buildImageCard(token.image, tokenCardProps?.valuesProps?.imageConfigProps); if (tokenCardProps?.valuesProps?.addressConfigProps) - obj.valueProps.addressProps = buildStringCard(address, tokenCardProps?.valuesProps?.addressConfigProps); + obj.valuesProps.addressProps = buildStringCard(address, tokenCardProps?.valuesProps?.addressConfigProps); if (tokenCardProps?.valuesProps?.isTradeableConfigProps) - obj.valueProps.isTradeableProps = buildStringCard( + obj.valuesProps.isTradeableProps = buildStringCard( `Is Tradeable: ${token.properties.isTradeable}`, tokenCardProps?.valuesProps?.isTradeableConfigProps, ); if (tokenCardProps?.valuesProps?.maxMintAmountConfigProps) - obj.valueProps.maxMintAmountProps = buildStringCard( + obj.valuesProps.maxMintAmountProps = buildStringCard( `Max Mint Amount Per Tx: ${token.properties.maxMintAmountPerTx}`, tokenCardProps?.valuesProps?.maxMintAmountConfigProps, );