Skip to content

Commit c6310e6

Browse files
committed
Move deploy multiple and publish multiple pages to app router + migrate to shadcn/tailwind (#5381)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on the removal of several components and hooks related to contract deployment and publishing, while introducing new pages and components for handling these processes more effectively, including improved loading states and contract metadata handling. ### Detailed summary - Deleted several files related to contract hooks and components. - Introduced `DeployMultipleContractsPage` and `PublishMultipleContractsPage` for contract deployment and publishing. - Added `SanctionedAddressesChecker` to handle blocked wallet addresses. - Updated `DeployableContractTable` to fetch and display contract metadata. - Refactored `ContractIdImage` to utilize fetched metadata directly. - Changed table structure in `DeployableContractTable` to use new UI components. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent dc0ea8a commit c6310e6

File tree

18 files changed

+212
-595
lines changed

18 files changed

+212
-595
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { GenericLoadingPage } from "@/components/blocks/skeletons/GenericLoadingPage";
2+
import { DeployableContractTable } from "components/contract-components/contract-table";
3+
import Link from "next/link";
4+
import { notFound } from "next/navigation";
5+
import { Suspense } from "react";
6+
7+
export default async function DeployMultipleContractsPage(props: {
8+
searchParams?: Promise<{
9+
ipfs?: string[] | string;
10+
}>;
11+
}) {
12+
const searchParams = await props.searchParams;
13+
const ipfsHashes = searchParams?.ipfs;
14+
15+
if (!ipfsHashes || !Array.isArray(ipfsHashes) || ipfsHashes.length === 0) {
16+
notFound();
17+
}
18+
19+
return (
20+
<div className="container flex grow flex-col py-10">
21+
<h1 className="mb-1 font-semibold text-2xl tracking-tight">
22+
Deploy Contracts
23+
</h1>
24+
<p className="text-muted-foreground">
25+
Welcome to the thirdweb contract deployment flow.{" "}
26+
<Link
27+
className="text-link-foreground hover:text-foreground"
28+
target="_blank"
29+
href="https://portal.thirdweb.com/contracts/deploy/overview"
30+
>
31+
Learn more about deploying your contracts.
32+
</Link>
33+
</p>
34+
35+
<div className="h-6" />
36+
37+
<Suspense fallback={<GenericLoadingPage />}>
38+
<DeployableContractTable contractIds={ipfsHashes} context="deploy" />
39+
</Suspense>
40+
</div>
41+
);
42+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { GenericLoadingPage } from "@/components/blocks/skeletons/GenericLoadingPage";
2+
import { DeployableContractTable } from "components/contract-components/contract-table";
3+
import Link from "next/link";
4+
import { notFound } from "next/navigation";
5+
import { Suspense } from "react";
6+
7+
export default async function PublishMultipleContractsPage(props: {
8+
searchParams?: Promise<{
9+
ipfs?: string[] | string;
10+
}>;
11+
}) {
12+
const searchParams = await props.searchParams;
13+
const ipfsHashes = searchParams?.ipfs;
14+
15+
if (!ipfsHashes || !Array.isArray(ipfsHashes) || ipfsHashes.length === 0) {
16+
notFound();
17+
}
18+
19+
return (
20+
<div className="container flex grow flex-col py-10">
21+
<h1 className="mb-1 font-semibold text-2xl tracking-tight">
22+
Publish Contracts
23+
</h1>
24+
<p className="text-muted-foreground">
25+
Welcome to the thirdweb contract publish flow.{" "}
26+
<Link
27+
className="text-link-foreground hover:text-foreground"
28+
target="_blank"
29+
href="https://portal.thirdweb.com/contracts/publish/overview"
30+
>
31+
Learn more about publishing your contracts.
32+
</Link>
33+
</p>
34+
35+
<div className="h-6" />
36+
37+
<Suspense fallback={<GenericLoadingPage />}>
38+
<DeployableContractTable contractIds={ipfsHashes} context="publish" />
39+
</Suspense>
40+
</div>
41+
);
42+
}

apps/dashboard/src/app/account/components/account-header.client.tsx

Lines changed: 0 additions & 57 deletions
This file was deleted.

apps/dashboard/src/app/providers.tsx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
44
import { ThemeProvider } from "next-themes";
5-
import { ThirdwebProvider } from "thirdweb/react";
5+
import { useMemo } from "react";
6+
import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
7+
import { CustomConnectWallet } from "../@3rdweb-sdk/react/components/connect-wallet";
68
import { Onboarding } from "../components/onboarding";
79
import { OpCreditsGrantedModalWrapper } from "../components/onboarding/OpCreditsGrantedModalWrapper";
810
import { PosthogIdentifier } from "../components/wallets/PosthogIdentifier";
11+
import { isSanctionedAddress } from "../data/eth-sanctioned-addresses";
912
import { SyncChainStores } from "../stores/chainStores";
13+
import type { ComponentWithChildren } from "../types/component-with-children";
1014
import { TWAutoConnect } from "./components/autoconnect";
1115

1216
const queryClient = new QueryClient();
@@ -26,9 +30,30 @@ export function AppRouterProviders(props: { children: React.ReactNode }) {
2630
enableSystem={false}
2731
defaultTheme="dark"
2832
>
29-
{props.children}
33+
<SanctionedAddressesChecker>
34+
{props.children}
35+
</SanctionedAddressesChecker>
3036
</ThemeProvider>
3137
</ThirdwebProvider>
3238
</QueryClientProvider>
3339
);
3440
}
41+
42+
const SanctionedAddressesChecker: ComponentWithChildren = ({ children }) => {
43+
const address = useActiveAccount()?.address;
44+
const isBlocked = useMemo(() => {
45+
return address && isSanctionedAddress(address);
46+
}, [address]);
47+
48+
if (isBlocked) {
49+
return (
50+
<div className="fixed inset-0 flex items-center justify-center bg-background">
51+
<div className="flex flex-col items-center gap-4">
52+
<p> Your wallet address is blocked </p>
53+
<CustomConnectWallet />
54+
</div>
55+
</div>
56+
);
57+
}
58+
return <>{children}</>;
59+
};

apps/dashboard/src/components/app-layouts/app.tsx

Lines changed: 0 additions & 91 deletions
This file was deleted.

apps/dashboard/src/components/app-layouts/providers.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

apps/dashboard/src/components/contract-components/contract-table/cells/description.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

apps/dashboard/src/components/contract-components/contract-table/cells/image.tsx

Lines changed: 0 additions & 8 deletions
This file was deleted.

apps/dashboard/src/components/contract-components/contract-table/cells/name.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)