@@ -11,6 +11,7 @@ import { TransactionButton } from "components/buttons/TransactionButton";
11
11
import { useTrack } from "hooks/analytics/useTrack" ;
12
12
import {
13
13
CheckIcon ,
14
+ CircleAlertIcon ,
14
15
CircleIcon ,
15
16
ExternalLinkIcon ,
16
17
InfinityIcon ,
@@ -40,6 +41,7 @@ import {
40
41
} from "thirdweb/react" ;
41
42
import { getClaimParams , maxUint256 } from "thirdweb/utils" ;
42
43
import { tryCatch } from "utils/try-catch" ;
44
+ import { ToolTipLabel } from "../../../../../../../../../../@/components/ui/tooltip" ;
43
45
import { getSDKTheme } from "../../../../../../../../components/sdk-component-theme" ;
44
46
import { PublicPageConnectButton } from "../../../_components/PublicPageConnectButton" ;
45
47
import { getCurrencyMeta } from "../../_utils/getCurrencyMeta" ;
@@ -222,23 +224,23 @@ export function ClaimTokenCardUI(props: {
222
224
} ,
223
225
} ) ;
224
226
227
+ const publicPrice = {
228
+ pricePerTokenWei : props . claimCondition . pricePerToken ,
229
+ currencyAddress : props . claimCondition . currency ,
230
+ decimals : props . claimConditionCurrency . decimals ,
231
+ symbol : props . claimConditionCurrency . symbol ,
232
+ } ;
233
+
225
234
const claimParamsQuery = useQuery ( {
226
235
queryKey : [ "claim-params" , props . contract . address , account ?. address ] ,
227
236
queryFn : async ( ) => {
228
- const defaultPricing = {
229
- pricePerTokenWei : props . claimCondition . pricePerToken ,
230
- currencyAddress : props . claimCondition . currency ,
231
- decimals : props . claimConditionCurrency . decimals ,
232
- symbol : props . claimConditionCurrency . symbol ,
233
- } ;
234
-
235
237
if ( ! account ) {
236
- return defaultPricing ;
238
+ return publicPrice ;
237
239
}
238
240
239
241
const merkleRoot = props . claimCondition . merkleRoot ;
240
242
if ( ! merkleRoot || merkleRoot === padHex ( "0x" , { size : 32 } ) ) {
241
- return defaultPricing ;
243
+ return publicPrice ;
242
244
}
243
245
244
246
const claimParams = await getClaimParams ( {
@@ -313,6 +315,11 @@ export function ClaimTokenCardUI(props: {
313
315
) ;
314
316
}
315
317
318
+ const isShowingCustomPrice =
319
+ claimParamsData &&
320
+ ( claimParamsData . pricePerTokenWei !== publicPrice . pricePerTokenWei ||
321
+ claimParamsData . currencyAddress !== publicPrice . currencyAddress ) ;
322
+
316
323
return (
317
324
< div className = "rounded-xl border bg-card " >
318
325
< div className = "border-b px-4 py-5 lg:px-5" >
@@ -348,25 +355,22 @@ export function ClaimTokenCardUI(props: {
348
355
349
356
< div className = "space-y-3 rounded-lg bg-muted/50 p-3" >
350
357
{ /* Price per token */ }
351
- < div className = "flex justify-between font-medium text-sm" >
352
- < span > Price per token</ span >
353
-
354
- < SkeletonContainer
355
- skeletonData = { `0.00 ${ props . claimConditionCurrency . symbol } ` }
356
- loadedData = {
357
- claimParamsData
358
- ? claimParamsData . pricePerTokenWei === 0n
359
- ? "FREE"
360
- : `${ toTokens (
361
- claimParamsData . pricePerTokenWei ,
362
- claimParamsData . decimals ,
363
- ) } ${ claimParamsData . symbol } `
364
- : undefined
365
- }
366
- render = { ( v ) => {
367
- return < span className = "" > { v } </ span > ;
368
- } }
369
- />
358
+ < div className = "flex items-start justify-between font-medium text-sm" >
359
+ < span className = "flex items-center gap-2" >
360
+ Price per token
361
+ { isShowingCustomPrice && (
362
+ < ToolTipLabel label = "Your connected wallet address is added in the allowlist and is getting a special price" >
363
+ < CircleAlertIcon className = "size-3.5 text-muted-foreground" />
364
+ </ ToolTipLabel >
365
+ ) }
366
+ </ span >
367
+
368
+ < div className = "flex flex-col items-end gap-1" >
369
+ { isShowingCustomPrice && (
370
+ < TokenPrice data = { publicPrice } strikethrough = { true } />
371
+ ) }
372
+ < TokenPrice data = { claimParamsData } strikethrough = { false } />
373
+ </ div >
370
374
</ div >
371
375
372
376
{ /* Quantity */ }
@@ -447,6 +451,43 @@ export function ClaimTokenCardUI(props: {
447
451
) ;
448
452
}
449
453
454
+ function TokenPrice ( props : {
455
+ strikethrough : boolean ;
456
+ data :
457
+ | {
458
+ pricePerTokenWei : bigint ;
459
+ decimals : number ;
460
+ symbol : string ;
461
+ }
462
+ | undefined ;
463
+ } ) {
464
+ return (
465
+ < SkeletonContainer
466
+ skeletonData = { "0.00 ETH" }
467
+ loadedData = {
468
+ props . data
469
+ ? props . data . pricePerTokenWei === 0n
470
+ ? "FREE"
471
+ : `${ toTokens (
472
+ props . data . pricePerTokenWei ,
473
+ props . data . decimals ,
474
+ ) } ${ props . data . symbol } `
475
+ : undefined
476
+ }
477
+ render = { ( v ) => {
478
+ if ( props . strikethrough ) {
479
+ return (
480
+ < s className = "font-medium text-muted-foreground text-sm line-through decoration-muted-foreground/50" >
481
+ { v }
482
+ </ s >
483
+ ) ;
484
+ }
485
+ return < span className = "font-medium text-foreground text-sm" > { v } </ span > ;
486
+ } }
487
+ />
488
+ ) ;
489
+ }
490
+
450
491
function SupplyRemaining ( props : {
451
492
supplyClaimed : bigint ;
452
493
maxClaimableSupply : bigint ;
0 commit comments