Skip to content

Commit 44a78b1

Browse files
committed
Move /explore page to RSCs
1 parent 45fcfb1 commit 44a78b1

File tree

14 files changed

+193
-200
lines changed

14 files changed

+193
-200
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/ContractOverviewPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use client";
2-
31
import { PublishedBy } from "components/contract-components/shared/published-by";
42
import type { ThirdwebContract } from "thirdweb";
53
import { AnalyticsOverview } from "./components/Analytics";
@@ -21,6 +19,7 @@ interface ContractOverviewPageProps {
2119
isPermissionsEnumerable: boolean;
2220
chainSlug: string;
2321
isAnalyticsSupported: boolean;
22+
functionSelectors: string[];
2423
}
2524

2625
const TRACKING_CATEGORY = "contract_overview";
@@ -35,6 +34,7 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
3534
isPermissionsEnumerable,
3635
chainSlug,
3736
isAnalyticsSupported,
37+
functionSelectors,
3838
}) => {
3939
return (
4040
<div className="flex flex-col gap-8 lg:flex-row">
@@ -45,6 +45,7 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
4545
isErc20={isErc20}
4646
contract={contract}
4747
chainSlug={chainSlug}
48+
functionSelectors={functionSelectors}
4849
/>
4950

5051
{isAnalyticsSupported && (

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { ThirdwebAreaChart } from "@/components/blocks/charts/area-chart";
24
import { Button } from "@/components/ui/button";
35
import {

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/BuildYourApp.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import {
24
Flex,
35
GridItem,
@@ -7,7 +9,9 @@ import {
79
} from "@chakra-ui/react";
810
import { ChakraNextImage as Image } from "components/Image";
911
import { PRODUCTS } from "components/product-pages/common/nav/data";
10-
import { Card, Text, TrackedLink, type TrackedLinkProps } from "tw-components";
12+
import { Card } from "tw-components/card";
13+
import { TrackedLink, type TrackedLinkProps } from "tw-components/link";
14+
import { Text } from "tw-components/text";
1115

1216
const RENDERED_PRODUCTS = ["sdk", "storage", "ui-components", "auth"];
1317

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/ContractChecklist.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
"use client";
2+
13
import { AdminOnly } from "@3rdweb-sdk/react/components/roles/admin-only";
24
import { useIsMinter } from "@3rdweb-sdk/react/hooks/useContractRoles";
35
import { StepsCard } from "components/dashboard/StepsCard";
4-
import { useContractFunctionSelectors } from "contract-ui/hooks/useContractFunctionSelectors";
56
import Link from "next/link";
67
import { useMemo } from "react";
78
import type { ThirdwebContract } from "thirdweb";
@@ -18,6 +19,7 @@ interface ContractChecklistProps {
1819
isErc1155: boolean;
1920
isErc20: boolean;
2021
chainSlug: string;
22+
functionSelectors: string[];
2123
}
2224

2325
type Step = {
@@ -27,13 +29,10 @@ type Step = {
2729
};
2830

2931
export const ContractChecklist: React.FC<ContractChecklistProps> = (props) => {
30-
const functionSelectorQuery = useContractFunctionSelectors(props.contract);
3132
return (
3233
// if no permissions, simply return null (do not fail open)
3334
<AdminOnly contract={props.contract} failOpen={false}>
34-
{!!functionSelectorQuery.data?.length && (
35-
<Inner functionSelectors={functionSelectorQuery.data} {...props} />
36-
)}
35+
<Inner {...props} />
3736
</AdminOnly>
3837
);
3938
};

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/LatestEvents.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import {
24
type InternalTransaction,
35
useActivity,

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/MarketplaceDetails.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { WalletAddress } from "@/components/blocks/wallet-address";
24
import { Badge } from "@/components/ui/badge";
35
import { SkeletonContainer } from "@/components/ui/skeleton";

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/NFTDetails.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
"use client";
2+
13
import { Flex, useBreakpointValue } from "@chakra-ui/react";
24
import type { ThirdwebContract } from "thirdweb";
35
import * as ERC721 from "thirdweb/extensions/erc721";
46
import * as ERC1155 from "thirdweb/extensions/erc1155";
57
import { useReadContract } from "thirdweb/react";
6-
import { TrackedLink, type TrackedLinkProps } from "tw-components";
8+
import { TrackedLink, type TrackedLinkProps } from "tw-components/link";
79
import { NFTCards } from "../../_components/NFTCards";
810

911
interface NFTDetailsProps {

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/PermissionsTable.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { ToolTipLabel } from "@/components/ui/tooltip";
24
import { Box, Flex, List, SimpleGrid, Tag } from "@chakra-ui/react";
35
import { getAllRoleMembers } from "contract-ui/hooks/permissions";
@@ -8,14 +10,11 @@ import { useMemo } from "react";
810
import { toast } from "sonner";
911
import { type ThirdwebContract, ZERO_ADDRESS } from "thirdweb";
1012
import { useReadContract } from "thirdweb/react";
11-
import {
12-
Button,
13-
Card,
14-
Heading,
15-
Text,
16-
TrackedLink,
17-
type TrackedLinkProps,
18-
} from "tw-components";
13+
import { Button } from "tw-components/button";
14+
import { Card } from "tw-components/card";
15+
import { Heading } from "tw-components/heading";
16+
import { TrackedLink, type TrackedLinkProps } from "tw-components/link";
17+
import { Text } from "tw-components/text";
1918
import { shortenIfAddress } from "utils/usedapp-external";
2019

2120
interface PermissionsTableProps {

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default async function Page(props: {
3131
}
3232
chainSlug={chainMetadata.slug}
3333
isAnalyticsSupported={contractPageMetadata.isAnalyticsSupported}
34+
functionSelectors={contractPageMetadata.functionSelectors}
3435
/>
3536
);
3637
}

apps/dashboard/src/components/contract-components/fetchDeployMetadata.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getThirdwebClient } from "@/constants/thirdweb.server";
22
import { fetchDeployMetadata as sdkFetchDeployMetadata } from "thirdweb/contract";
33
import { removeUndefinedFromObjectDeep } from "../../utils/object";
4-
import { toContractIdIpfsHash } from "./hooks";
4+
import type { ContractId } from "./types";
55

66
// metadata PRE publish, only has the compiler output info (from CLI)
77

@@ -15,3 +15,10 @@ export async function fetchDeployMetadata(contractId: string) {
1515
}),
1616
);
1717
}
18+
19+
function toContractIdIpfsHash(contractId: ContractId) {
20+
if (contractId?.startsWith("ipfs://")) {
21+
return contractId;
22+
}
23+
return `ipfs://${contractId}`;
24+
}

0 commit comments

Comments
 (0)