Skip to content

Commit 5bad90c

Browse files
committed
Add implementation
1 parent cd9bb1b commit 5bad90c

File tree

26 files changed

+1113
-197
lines changed

26 files changed

+1113
-197
lines changed

apps/dashboard/src/@/components/blocks/TokenSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export function TokenSelector(props: {
186186
showCheck={props.showCheck}
187187
placeholder={
188188
tokensQuery.isPending
189-
? "Loading Tokens..."
189+
? "Loading Tokens"
190190
: props.placeholder || "Select Token"
191191
}
192192
overrideSearchFn={searchFn}

apps/dashboard/src/@/components/blocks/multi-step-status/multi-step-status.stories.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,34 @@ const meta = {
1616
export default meta;
1717
type Story = StoryObj<typeof meta>;
1818

19-
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
20-
2119
export const AllStates: Story = {
2220
args: {
21+
onRetry: () => {},
2322
steps: [
2423
{
2524
status: { type: "completed" },
2625
label: "Connect Wallet",
27-
execute: async () => {
28-
await sleep(1000);
29-
},
26+
id: "connect-wallet",
3027
},
3128
{
3229
status: { type: "pending" },
3330
label: "Sign Message",
34-
execute: async () => {
35-
await sleep(1000);
36-
},
31+
id: "sign-message",
3732
},
3833
{
3934
status: { type: "error", message: "This is an error message" },
4035
label: "Approve Transaction",
41-
execute: async () => {
42-
await sleep(1000);
43-
},
36+
id: "approve-transaction",
4437
},
4538
{
4639
status: { type: "idle" },
4740
label: "Confirm Transaction",
48-
execute: async () => {
49-
await sleep(1000);
50-
},
41+
id: "confirm-transaction",
5142
},
5243
{
5344
status: { type: "idle" },
5445
label: "Finalize",
55-
execute: async () => {
56-
await sleep(1000);
57-
},
46+
id: "finalize",
5847
},
5948
],
6049
},

apps/dashboard/src/@/components/blocks/multi-step-status/multi-step-status.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,23 @@ import {
1010
import { DynamicHeight } from "../../ui/DynamicHeight";
1111
import { Spinner } from "../../ui/Spinner/Spinner";
1212

13-
export type MultiStepState = {
13+
export type MultiStepState<T extends string> = {
14+
id: T;
1415
status:
1516
| {
1617
type: "idle" | "pending" | "completed";
1718
}
1819
| {
1920
type: "error";
20-
message: string | React.ReactNode;
21+
message: React.ReactNode;
2122
};
2223
label: string;
23-
execute: () => Promise<void>;
24+
description?: string;
2425
};
2526

26-
export function MultiStepStatus(props: {
27-
steps: MultiStepState[];
27+
export function MultiStepStatus<T extends string>(props: {
28+
steps: MultiStepState<T>[];
29+
onRetry: (step: MultiStepState<T>) => void;
2830
}) {
2931
return (
3032
<DynamicHeight>
@@ -55,6 +57,14 @@ export function MultiStepStatus(props: {
5557
{step.label}
5658
</p>
5759

60+
{(step.status.type === "pending" ||
61+
step.status.type === "error") &&
62+
step.description && (
63+
<p className="text-muted-foreground text-sm">
64+
{step.description}
65+
</p>
66+
)}
67+
5868
{step.status.type === "error" && (
5969
<div className="mt-1 space-y-2">
6070
<p className="mb-1 text-red-500 text-sm">
@@ -64,7 +74,7 @@ export function MultiStepStatus(props: {
6474
variant="destructive"
6575
size="sm"
6676
className="gap-2"
67-
onClick={() => step.execute()}
77+
onClick={() => props.onRetry(step)}
6878
>
6979
<RefreshCwIcon className="size-4" />
7080
Retry

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import {
5050
useWalletBalance,
5151
} from "thirdweb/react";
5252
import { z } from "zod";
53+
import { parseError } from "../../../../../../../../utils/errorParser";
5354

5455
function formatTime(seconds: number) {
5556
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
@@ -234,7 +235,12 @@ export function FaucetButton({
234235
const claimPromise = claimMutation.mutateAsync(values.turnstileToken);
235236
toast.promise(claimPromise, {
236237
success: `${amount} ${chain.nativeCurrency.symbol} sent successfully`,
237-
error: `Failed to claim ${amount} ${chain.nativeCurrency.symbol}`,
238+
error: (err) => {
239+
return {
240+
message: `Failed to claim ${amount} ${chain.nativeCurrency.symbol}`,
241+
description: parseError(err),
242+
};
243+
},
238244
});
239245
};
240246

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/claim-tab.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { getApprovalForTransaction } from "thirdweb/extensions/erc20";
1010
import { claimTo } from "thirdweb/extensions/erc1155";
1111
import { useActiveAccount, useSendAndConfirmTransaction } from "thirdweb/react";
1212
import { FormErrorMessage, FormHelperText, FormLabel } from "tw-components";
13+
import { parseError } from "utils/errorParser";
1314

1415
interface ClaimTabProps {
1516
contract: ThirdwebContract;
@@ -67,7 +68,12 @@ const ClaimTabERC1155: React.FC<ClaimTabProps> = ({
6768
toast.promise(promise, {
6869
loading: "Claiming NFT",
6970
success: "NFT claimed successfully",
70-
error: "Failed to claim NFT",
71+
error: (error) => {
72+
return {
73+
message: "Failed to claim NFT",
74+
description: parseError(error),
75+
};
76+
},
7177
});
7278
trackEvent({
7379
category: "nft",

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
139139
}
140140
if (isErc1155) {
141141
cols.push({
142-
Header: "Supply",
142+
Header: "Circulating Supply",
143143
accessor: (row) => row,
144144
Cell: (cell: CellProps<NFT, number>) => {
145145
if (cell.row.original.type === "ERC1155") {

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/_common/SocialUrls.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export function SocialUrlsFieldset<T extends WithSocialUrls>(props: {
8181
variant="outline"
8282
size="icon"
8383
onClick={() => remove(index)}
84+
className="rounded-full"
8485
>
8586
<Trash2Icon className="h-4 w-4" />
8687
<span className="sr-only">Remove</span>
@@ -95,9 +96,9 @@ export function SocialUrlsFieldset<T extends WithSocialUrls>(props: {
9596
size="sm"
9697
variant="outline"
9798
onClick={() => append({ platform: "", url: "" })}
98-
className="gap-2"
99+
className="h-auto gap-1.5 rounded-full px-3 py-1.5 text-xs"
99100
>
100-
<PlusIcon className="size-4" />
101+
<PlusIcon className="size-3.5" />
101102
Add Social URL
102103
</Button>
103104
</div>

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/_common/file-image.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ export function FilePreview(props: {
5353
props.className,
5454
)}
5555
>
56-
<p className="text-muted-foreground text-sm">
57-
<FileIcon className="size-5" />
58-
</p>
56+
{props.fallback || <FileIcon className="size-5" />}
5957
</div>
6058
);
6159
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/create-token-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function StepCard(props: {
77
title: string;
88
tracking: {
99
page: string;
10-
contractType: "DropERC20" | "NFTDrop";
10+
contractType: "DropERC20" | "NFTCollection";
1111
};
1212
prevButton:
1313
| undefined

0 commit comments

Comments
 (0)