@@ -178,15 +178,16 @@ const ClaimButton: React.FC<ClaimPageProps> = ({
178178 const address = useAddress ( ) ;
179179 const [ { data : network } ] = useNetwork ( ) ;
180180 const chainId = useMemo ( ( ) => network ?. chain ?. id , [ network ] ) ;
181-
182181 const [ claimSuccess , setClaimSuccess ] = useState ( false ) ;
183182
183+ const isEnabled = ! ! module && ! ! address && chainId === expectedChainId
184+
184185 const activeClaimCondition = useQuery (
185186 [ "claim-condition" , { tokenId } ] ,
186187 async ( ) => {
187188 return module ?. getActiveClaimCondition ( tokenId ) ;
188189 } ,
189- { enabled : ! ! module && tokenId . length > 0 } ,
190+ { enabled : isEnabled && tokenId . length > 0 } ,
190191 ) ;
191192
192193 const [ quantity , setQuantity ] = useState ( 1 ) ;
@@ -272,57 +273,59 @@ const ClaimButton: React.FC<ClaimPageProps> = ({
272273 quantityLimitBigNumber . gt ( 1 ) &&
273274 quantityLimitBigNumber . lte ( 1000 ) ;
274275
276+ if ( ! isEnabled ) {
277+ return (
278+ < ConnectWalletButton expectedChainId = { expectedChainId } />
279+ )
280+ }
281+
275282 return (
276283 < Stack spacing = { 4 } align = "center" w = "100%" >
277- { address && chainId === expectedChainId ? (
278- < Flex w = "100%" direction = { { base : "column" , md : "row" } } gap = { 2 } >
279- { showQuantityInput && (
280- < NumberInput
281- inputMode = "numeric"
282- value = { quantity }
283- onChange = { ( stringValue , value ) => {
284- if ( stringValue === "" ) {
285- setQuantity ( 0 ) ;
286- } else {
287- setQuantity ( value ) ;
288- }
289- } }
290- min = { 1 }
291- max = { quantityLimitBigNumber . toNumber ( ) }
292- maxW = { { base : "100%" , md : "100px" } }
293- >
294- < NumberInputField />
295- < NumberInputStepper >
296- < NumberIncrementStepper />
297- < NumberDecrementStepper />
298- </ NumberInputStepper >
299- </ NumberInput >
300- ) }
301- < Button
302- isLoading = { isLoading || claimMutation . isLoading }
303- isDisabled = { ! canClaim }
304- leftIcon = { < IoDiamondOutline /> }
305- onClick = { ( ) => claimMutation . mutate ( ) }
306- isFullWidth
307- colorScheme = "blue"
308- fontSize = { { base : "label.md" , md : "label.lg" } }
284+ < Flex w = "100%" direction = { { base : "column" , md : "row" } } gap = { 2 } >
285+ { showQuantityInput && (
286+ < NumberInput
287+ inputMode = "numeric"
288+ value = { quantity }
289+ onChange = { ( stringValue , value ) => {
290+ if ( stringValue === "" ) {
291+ setQuantity ( 0 ) ;
292+ } else {
293+ setQuantity ( value ) ;
294+ }
295+ } }
296+ min = { 1 }
297+ max = { quantityLimitBigNumber . toNumber ( ) }
298+ maxW = { { base : "100%" , md : "100px" } }
309299 >
310- { ! isNotSoldOut
311- ? "Sold out"
312- : canClaim
313- ? `Mint${
314- priceToMint . eq ( 0 )
315- ? " (Free)"
316- : formatedPrice
317- ? ` (${ formatedPrice } )`
318- : ""
319- } `
320- : "Minting Unavailable" }
321- </ Button >
322- </ Flex >
323- ) : (
324- < ConnectWalletButton expectedChainId = { expectedChainId } />
325- ) }
300+ < NumberInputField />
301+ < NumberInputStepper >
302+ < NumberIncrementStepper />
303+ < NumberDecrementStepper />
304+ </ NumberInputStepper >
305+ </ NumberInput >
306+ ) }
307+ < Button
308+ isLoading = { isLoading || claimMutation . isLoading }
309+ isDisabled = { ! canClaim }
310+ leftIcon = { < IoDiamondOutline /> }
311+ onClick = { ( ) => claimMutation . mutate ( ) }
312+ isFullWidth
313+ colorScheme = "blue"
314+ fontSize = { { base : "label.md" , md : "label.lg" } }
315+ >
316+ { ! isNotSoldOut
317+ ? "Sold out"
318+ : canClaim
319+ ? `Mint${
320+ priceToMint . eq ( 0 )
321+ ? " (Free)"
322+ : formatedPrice
323+ ? ` (${ formatedPrice } )`
324+ : ""
325+ } `
326+ : "Minting Unavailable" }
327+ </ Button >
328+ </ Flex >
326329 < Text size = "label.md" color = "green.800" >
327330 { `${ parseHugeNumber ( claimed ) } / ${ parseHugeNumber (
328331 totalAvailable ,
0 commit comments