From 92c96fc24011de36b5077088b317f2f1c1c9ad73 Mon Sep 17 00:00:00 2001 From: "Michael D. Norman" Date: Thu, 12 May 2022 08:48:41 -0500 Subject: [PATCH] chore: [#3] don't try to go to show minted NFTs when more to claim --- components/ClaimButton.tsx | 15 ++++++++------- pages/index.tsx | 4 +++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/components/ClaimButton.tsx b/components/ClaimButton.tsx index 750bfbe..2c5f876 100644 --- a/components/ClaimButton.tsx +++ b/components/ClaimButton.tsx @@ -8,18 +8,19 @@ export interface ClaimButtonProps extends DefaultButtonProps { const ClaimButton = ({ allowance, walletAlreadyClaimed, disabled, ...rest }: ClaimButtonProps) => { const getClaimButtonText = () => { - if (walletAlreadyClaimed === 0 && allowance === 0) { - return 'CLAIM PLOTS'; - } else if (walletAlreadyClaimed > 0) { + if (allowance > 0 && allowance > walletAlreadyClaimed) { + return `CLAIM ${allowance - walletAlreadyClaimed} PLOTS`; + } + + if (walletAlreadyClaimed > 0) { return `${walletAlreadyClaimed} PLOTS CLAIMED`; - } else if (allowance > 0) { - return `CLAIM ${allowance} PLOTS`; } - return ''; + + return 'CLAIM PLOTS'; }; return ( - + {getClaimButtonText()} ); diff --git a/pages/index.tsx b/pages/index.tsx index 465e2be..9d311bd 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -156,7 +156,9 @@ const Home: NextPage = () => { walletAlreadyClaimed={walletAlreadyClaimed} allowance={allowance} disabled={!address} - onClick={walletAlreadyClaimed === 0 ? handleOpenClaimModal : showMintedNfts} + onClick={ + walletAlreadyClaimed === 0 || walletAlreadyClaimed < allowance ? handleOpenClaimModal : showMintedNfts + } />