Skip to content
Closed
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 src/embeds/edition-drop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const EditionDropEmbed: React.FC<EditionDropEmbedProps> = ({
>
<Header primaryColor={primaryColor} colorScheme={colorScheme} />
<Body>
<ClaimPage contract={editionDrop}>
<ClaimPage contract={editionDrop} tokenId={tokenId}>
<ERC1155ClaimButton
contract={editionDrop}
tokenId={tokenId}
Expand Down
25 changes: 14 additions & 11 deletions src/shared/claim-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,31 @@ import {
Grid,
Heading,
Icon,
Image,
Skeleton,
Text,
} from "@chakra-ui/react";
import { DropContract, useContractMetadata } from "@thirdweb-dev/react";
import {
DropContract,
ThirdwebNftMedia,
useContractMetadata,
useNFT,
} from "@thirdweb-dev/react";
import React from "react";
import { DropSvg } from "./svg/drop";

interface ClaimPageProps {
contract?: Exclude<DropContract, null>;
tokenId?: string;
}

export const ClaimPage: React.FC<React.PropsWithChildren<ClaimPageProps>> = ({
contract,

tokenId,
children,
}) => {
const { data: metadata, isLoading } = useContractMetadata(contract);
const { data: nft } = useNFT(contract, tokenId);

Comment on lines 24 to +31
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to split this into 2 again now, TokenClaimPage (with the token) and ContractClaimPage (without the token)

we shouldn't even hav useNFT in the contract claim page case and we might not need contract metadata in the token claim page case? might just want to render token name and description instead?

return (
<Center w="100%" h="100%">
<Flex direction="column" align="center" gap={4} w="100%">
Expand All @@ -35,14 +42,10 @@ export const ClaimPage: React.FC<React.PropsWithChildren<ClaimPageProps>> = ({
placeContent="center"
overflow="hidden"
>
{metadata?.image ? (
<Image
objectFit="contain"
w="100%"
h="100%"
src={metadata?.image}
alt={metadata?.name}
/>
{tokenId && nft?.metadata ? (
<ThirdwebNftMedia metadata={nft.metadata} />
) : metadata?.image ? (
<ThirdwebNftMedia metadata={metadata} />
Comment on lines +45 to +48
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah ideally we split these high level into 2 components, one for erc20 and erc721 and one for erc1155

) : (
<Icon maxW="100%" maxH="100%" as={DropSvg} />
)}
Expand Down