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
2 changes: 1 addition & 1 deletion apps/dashboard/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only";
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
import { FormControl, Input, Select } from "@chakra-ui/react";
Expand Down Expand Up @@ -48,6 +49,27 @@ export const NFTRevealButton: React.FC<NFTRevealButtonProps> = ({

const [open, setOpen] = useState(false);

if (!batchesQuery.data?.length) {
return null;
}

/**
* When a batch is revealed / decrypted / non-revealable, its batchUri will be "0x"
*/
const allBatchesRevealed = batchesQuery.data.every(
(o) => o.batchUri === "0x",
);

if (allBatchesRevealed) {
return (
<ToolTipLabel label="All batches are revealed">
<Button variant="primary" className="gap-2" disabled>
<EyeIcon className="size-4" /> Reveal NFTs
</Button>
</ToolTipLabel>
);
}

return batchesQuery.data?.length ? (
<MinterOnly contract={contract}>
<Sheet open={open} onOpenChange={setOpen}>
Expand Down Expand Up @@ -109,9 +131,11 @@ export const NFTRevealButton: React.FC<NFTRevealButtonProps> = ({
<option
key={batch.batchId.toString()}
value={batch.batchId.toString()}
disabled={batch.batchUri === "0x"}
>
{batch.placeholderMetadata?.name ||
batch.batchId.toString()}
batch.batchId.toString()}{" "}
{batch.batchUri === "0x" && "(REVEALED)"}
</option>
))}
</Select>
Expand Down
Loading