Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Meta, StoryObj } from "@storybook/nextjs";
import { maxUint256 } from "thirdweb/utils";
import { BadgeContainer } from "../../../../../../../../@/storybook/utils";
import { BadgeContainer } from "@/storybook/utils";
import { SupplyClaimedProgress } from "./supply-claimed-progress";

const meta = {
Expand All @@ -19,7 +18,7 @@ function StoryVariants() {
return (
<div className="container max-w-md space-y-10 py-10">
<BadgeContainer label="10 / Unlimited Supply">
<SupplyClaimedProgress claimedSupply={10n} totalSupply={maxUint256} />
<SupplyClaimedProgress claimedSupply={10n} totalSupply="unlimited" />
</BadgeContainer>

<BadgeContainer label="500/1000 Supply">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { InfinityIcon } from "lucide-react";
import { maxUint256 } from "thirdweb/utils";
import { Progress } from "@/components/ui/progress";
import { supplyFormatter } from "../nft/format";

export function SupplyClaimedProgress(props: {
claimedSupply: bigint;
totalSupply: bigint;
totalSupply: bigint | "unlimited";
}) {
// if total supply is unlimited
if (props.totalSupply === maxUint256) {
if (props.totalSupply === "unlimited") {
return (
<p className="flex items-center justify-between gap-2">
<span className="font-medium text-sm">Claimed Supply </span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
getApprovalForTransaction,
} from "thirdweb/extensions/erc20";
import { useActiveAccount, useSendTransaction } from "thirdweb/react";
import { getClaimParams } from "thirdweb/utils";
import { getClaimParams, maxUint256 } from "thirdweb/utils";
import {
reportAssetBuyFailed,
reportAssetBuySuccessful,
Expand Down Expand Up @@ -328,9 +328,16 @@ export function TokenDropClaim(props: {
claimedSupply={BigInt(
toTokens(props.claimCondition.supplyClaimed, props.decimals),
)}
totalSupply={BigInt(
toTokens(props.claimCondition.maxClaimableSupply, props.decimals),
)}
totalSupply={
props.claimCondition.maxClaimableSupply === maxUint256
? "unlimited"
: BigInt(
toTokens(
props.claimCondition.maxClaimableSupply,
props.decimals,
),
)
}
/>

<div className="h-4" />
Expand Down
Loading