Skip to content

Commit

Permalink
this has really turned into something
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobHomanics committed Apr 5, 2024
1 parent 264b4b7 commit a191ded
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 39 deletions.
12 changes: 12 additions & 0 deletions packages/nextjs/app/rep-tokens-demo/_components/RepTokensDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ export function RepTokensDemo() {
<RedeemableCard token={token} />
<MaxMintAmountPerTxCard token={token} />
</div>

<div>
<p className="text-center text-4xl">Individual Components 3</p>
<BalanceCard balance={token?.balance} />
<ImageCard src={token?.image} />
<NameCard name={token?.name} />
<DescriptionCard description={token?.description} />
<AddressCard address={token?.address} />
<SoulboundCard isSoulbound={token?.properties?.isSoulbound} />
<RedeemableCard isRedeemable={token?.properties?.isRedeemable} />
<MaxMintAmountPerTxCard maxMintAmountPerTx={token?.properties?.maxMintAmountPerTx} />
</div>
</div>

<div className="flex">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,22 @@ export const StylizedTokenCard = ({
}

if (components[j] === "IsSoulbound") {
cardContent.push(<StylizedStringCard key={j} value={`Soulbound: ${token?.properties.isSoulbound.toString()}`} />);
cardContent.push(
<StylizedStringCard key={j} value={`Soulbound: ${token?.properties?.isSoulbound?.toString()}`} />,
);
}

if (components[j] === "IsRedeemable") {
cardContent.push(
<StylizedStringCard key={j} value={`Redeemable: ${token?.properties.isRedeemable.toString()}`} />,
<StylizedStringCard key={j} value={`Redeemable: ${token?.properties?.isRedeemable?.toString()}`} />,
);
}

if (components[j] === "MaxMintAmountPerTx") {
cardContent.push(
<StylizedStringCard
key={j}
value={`Max Mint Amount Per Tx: ${token?.properties.maxMintAmountPerTx.toString()}`}
value={`Max Mint Amount Per Tx: ${token?.properties?.maxMintAmountPerTx?.toString()}`}
/>,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { StylizedAddressCard } from "../StylizedAddressCard";
import { Token } from "~~/components/rep-tokens/hooks/Hooks";

type Props = {
token: Token;
token?: Token;
address?: string;
};

export const AddressCard = ({ token }: Props) => {
return <StylizedAddressCard address={token?.address} />;
export const AddressCard = ({ token, address = "" }: Props) => {
return <StylizedAddressCard address={token ? token?.address : address} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { StylizedBalanceCard } from "../StylizedBalanceCard";
import { Token } from "~~/components/rep-tokens/hooks/Hooks";

type Props = {
token: Token;
token?: Token;
balance?: bigint;
};

export const BalanceCard = ({ token }: Props) => {
return <StylizedBalanceCard value={Number(token?.balance)} />;
export const BalanceCard = ({ token, balance }: Props) => {
return <StylizedBalanceCard value={token ? Number(token?.balance) : Number(balance)} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { StylizedStringCard } from "../StylizedStringCard";
import { Token } from "~~/components/rep-tokens/hooks/Hooks";

type Props = {
token: Token;
token?: Token;
description?: string;

type?: "default" | "bold";
};

export const DescriptionCard = ({ token, type = "default" }: Props) => {
return <StylizedStringCard value={token?.description} type={type} />;
export const DescriptionCard = ({ token, description = "", type = "default" }: Props) => {
return <StylizedStringCard value={token ? token?.description : description} type={type} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { StylizedImageCard } from "../StylizedImageCard";
import { Token } from "~~/components/rep-tokens/hooks/Hooks";

type Props = {
token: Token;
token?: Token;
src?: string;
alt?: string;
};

export const ImageCard = ({ token }: Props) => {
return <StylizedImageCard src={token?.image} />;
export const ImageCard = ({ token, src = "" }: Props) => {
return <StylizedImageCard src={token ? token?.image : src} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ import { StylizedStringCard } from "../StylizedStringCard";
import { Token } from "~~/components/rep-tokens/hooks/Hooks";

type Props = {
token: Token;
token?: Token;
maxMintAmountPerTx?: number;
type?: "default" | "bold";
};

export const MaxMintAmountPerTxCard = ({ token, type = "default" }: Props) => {
export const MaxMintAmountPerTxCard = ({ token, maxMintAmountPerTx, type = "default" }: Props) => {
return (
<StylizedStringCard
value={`Max Mint Amount Per Tx: ` + token?.properties?.maxMintAmountPerTx?.toString()}
value={
`Max Mint Amount Per Tx: ` + (token ? token?.properties?.maxMintAmountPerTx?.toString() : maxMintAmountPerTx)
}
type={type}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { StylizedStringCard } from "../StylizedStringCard";
import { Token } from "~~/components/rep-tokens/hooks/Hooks";

type Props = {
token: Token;
token?: Token;
name?: string;
type?: "default" | "bold";
};

export const NameCard = ({ token, type = "bold" }: Props) => {
return <StylizedStringCard value={token?.name} type={type} />;
export const NameCard = ({ token, name = "", type = "bold" }: Props) => {
return <StylizedStringCard value={token ? token?.name : name} type={type} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ import { StylizedStringCard } from "../StylizedStringCard";
import { Token } from "~~/components/rep-tokens/hooks/Hooks";

type Props = {
token: Token;
token?: Token;
isRedeemable?: boolean;
type?: "default" | "bold";
};

export const RedeemableCard = ({ token, type = "default" }: Props) => {
return <StylizedStringCard value={`Redeemable: ` + token?.properties?.isRedeemable?.toString()} type={type} />;
export const RedeemableCard = ({ token, isRedeemable, type = "default" }: Props) => {
return (
<StylizedStringCard
value={`Redeemable: ` + (token ? token?.properties?.isRedeemable?.toString() : isRedeemable?.toString())}
type={type}
/>
);
};

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ import { StylizedStringCard } from "../StylizedStringCard";
import { Token } from "~~/components/rep-tokens/hooks/Hooks";

type Props = {
token: Token;
token?: Token;
isSoulbound?: boolean;
type?: "default" | "bold";
};

export const SoulboundCard = ({ token, type = "default" }: Props) => {
return <StylizedStringCard value={`Soulbound: ` + token?.properties?.isSoulbound?.toString()} type={type} />;
export const SoulboundCard = ({ token, isSoulbound, type = "default" }: Props) => {
return (
<StylizedStringCard
value={`Soulbound: ` + (token ? token?.properties?.isSoulbound?.toString() : isSoulbound?.toString())}
type={type}
/>
);
};

0 comments on commit a191ded

Please sign in to comment.