Skip to content

Commit

Permalink
next15
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsdls committed Oct 24, 2024
1 parent 9fadbcc commit 81224d4
Show file tree
Hide file tree
Showing 154 changed files with 2,129 additions and 1,950 deletions.
17 changes: 9 additions & 8 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@tanstack/react-query": "5.59.16",
"@tanstack/react-table": "^8.17.3",
"@thirdweb-dev/service-utils": "workspace:*",
"@vercel/functions": "^1.4.2",
"@vercel/og": "^0.6.2",
"abitype": "1.0.6",
"chakra-react-select": "^4.7.6",
Expand All @@ -69,7 +70,7 @@
"ipaddr.js": "^2.2.0",
"lottie-react": "^2.4.0",
"lucide-react": "0.453.0",
"next": "14.2.15",
"next": "15.0.1",
"next-plausible": "^3.12.0",
"next-seo": "^6.5.0",
"next-themes": "^0.3.0",
Expand All @@ -80,10 +81,10 @@
"prism-react-renderer": "^2.3.1",
"prismjs": "^1.29.0",
"qrcode": "^1.5.3",
"react": "18.3.1",
"react": "19.0.0-rc-69d4b800-20241021",
"react-children-utilities": "^2.10.0",
"react-day-picker": "^8.10.1",
"react-dom": "18.3.1",
"react-dom": "19.0.0-rc-69d4b800-20241021",
"react-dropzone": "^14.2.9",
"react-error-boundary": "^4.1.2",
"react-hook-form": "7.52.0",
Expand All @@ -106,8 +107,8 @@
"devDependencies": {
"@chakra-ui/cli": "^2.4.1",
"@chromatic-com/storybook": "2.0.2",
"@next/bundle-analyzer": "14.2.15",
"@next/eslint-plugin-next": "14.2.15",
"@next/bundle-analyzer": "15.0.1",
"@next/eslint-plugin-next": "15.0.1",
"@playwright/test": "1.47.2",
"@storybook/addon-essentials": "8.3.6",
"@storybook/addon-interactions": "8.3.6",
Expand All @@ -123,8 +124,8 @@
"@types/papaparse": "^5.3.15",
"@types/pluralize": "^0.0.33",
"@types/qrcode": "^1.5.5",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected].1",
"@types/react-table": "^7.7.20",
"@types/spdx-correct": "^3.1.3",
"@types/swagger-ui-react": "^4.18.3",
Expand All @@ -134,7 +135,7 @@
"checkly": "^4.8.1",
"eslint": "8.57.0",
"eslint-config-biome": "1.9.3",
"eslint-plugin-react-compiler": "0.0.0-experimental-fa06e2c-20241014",
"eslint-plugin-react-compiler": "19.0.0-beta-8a03594-20241020",
"eslint-plugin-storybook": "^0.9.0",
"knip": "^5.33.3",
"next-sitemap": "^4.2.3",
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type Project = {
};

export async function getProjects(teamSlug: string) {
const cookiesManager = cookies();
const cookiesManager = await cookies();
const activeAccount = cookiesManager.get(COOKIE_ACTIVE_ACCOUNT)?.value;
const token = activeAccount
? cookiesManager.get(COOKIE_PREFIX_TOKEN + activeAccount)?.value
Expand All @@ -46,7 +46,7 @@ export async function getProjects(teamSlug: string) {
}

export async function getProject(teamSlug: string, projectSlug: string) {
const cookiesManager = cookies();
const cookiesManager = await cookies();
const activeAccount = cookiesManager.get(COOKIE_ACTIVE_ACCOUNT)?.value;
const token = activeAccount
? cookiesManager.get(COOKIE_PREFIX_TOKEN + activeAccount)?.value
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type Team = {
};

export async function getTeamBySlug(slug: string) {
const cookiesManager = cookies();
const cookiesManager = await cookies();
const activeAccount = cookiesManager.get(COOKIE_ACTIVE_ACCOUNT)?.value;
const token = activeAccount
? cookiesManager.get(COOKIE_PREFIX_TOKEN + activeAccount)?.value
Expand All @@ -45,7 +45,7 @@ export async function getTeamBySlug(slug: string) {
}

export async function getTeams() {
const cookiesManager = cookies();
const cookiesManager = await cookies();
const activeAccount = cookiesManager.get(COOKIE_ACTIVE_ACCOUNT)?.value;
const token = activeAccount
? cookiesManager.get(COOKIE_PREFIX_TOKEN + activeAccount)?.value
Expand Down
10 changes: 7 additions & 3 deletions apps/dashboard/src/@/constants/cookie.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { cookies } from "next/headers";
import { type UnsafeUnwrappedCookies, cookies } from "next/headers";

export const COOKIE_ACTIVE_ACCOUNT = "tw_active_account";
export const COOKIE_PREFIX_TOKEN = "tw_token_";

export function getActiveAccountCookie() {
return cookies().get(COOKIE_ACTIVE_ACCOUNT)?.value;
return (cookies() as unknown as UnsafeUnwrappedCookies).get(
COOKIE_ACTIVE_ACCOUNT,
)?.value;
}

export function getJWTCookie(address: string) {
return cookies().get(COOKIE_PREFIX_TOKEN + address)?.value;
return (cookies() as unknown as UnsafeUnwrappedCookies).get(
COOKIE_PREFIX_TOKEN + address,
)?.value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
import type { ThirdwebContract } from "thirdweb";
import type { ComponentWithChildren } from "types/component-with-children";

import type { JSX } from "react";

interface AdminOnlyProps {
contract: ThirdwebContract;
failOpen?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ import { ChainHeader } from "./components/server/chain-header";

// TODO: improve the behavior when clicking "Get started with thirdweb", currently just redirects to the dashboard

export async function generateMetadata({
params,
}: { params: { chain_id: string } }): Promise<Metadata> {
export async function generateMetadata(props: {
params: Promise<{ chain_id: string }>;
}): Promise<Metadata> {
const params = await props.params;
const chain = await getChain(params.chain_id);
const sanitizedChainName = chain.name.replace("Mainnet", "").trim();
const title = `${sanitizedChainName}: RPC and Chain Settings`;
Expand All @@ -54,13 +55,14 @@ export async function generateMetadata({
}

// this is the dashboard layout file
export default async function ChainPageLayout({
children,
params,
}: {
export default async function ChainPageLayout(props: {
children: React.ReactNode;
params: { chain_id: string };
params: Promise<{ chain_id: string }>;
}) {
const params = await props.params;

const { children } = props;

const chain = await getChain(params.chain_id);

if (params.chain_id !== chain.slug) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { ChainCTA } from "./components/server/cta-card";
import { ExplorersSection } from "./components/server/explorer-section";

export default async function Page(props: {
params: { chain_id: string };
params: Promise<{ chain_id: string }>;
}) {
const chain = await getChain(props.params.chain_id);
const chain = await getChain((await props.params).chain_id);
const chainMetadata = await getChainMetadata(chain.chainId);
const isDeprecated = chain.status === "deprecated";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { getChain } from "../../../utils";
export const dynamic = "force-dynamic";

export default async function Page(props: {
params: { chain_id: string };
searchParams: { page?: number; sortBy?: SortBy };
params: Promise<{ chain_id: string }>;
searchParams: Promise<{ page?: number; sortBy?: SortBy }>;
}) {
const chain = await getChain(props.params.chain_id);
const chain = await getChain((await props.params).chain_id);
const topContracts = await fetchTopContracts({
chainId: chain.chainId,
page: props.searchParams.page,
sortBy: props.searchParams.sortBy,
page: (await props.searchParams).page,
sortBy: (await props.searchParams).sortBy,
perPage: 15,
timeRange: "month",
});
Expand All @@ -24,22 +24,18 @@ export default async function Page(props: {
<h2 className="mb-2 font-semibold text-2xl tracking-tighter">
Popular Contracts
</h2>

<p className="text-muted-foreground text-sm">
Explore contracts on Ethereum and sort them by your preferred metrics
</p>

<div className="h-8" />

{topContracts.length > 0 && (
<TrendingContractSection
topContracts={topContracts}
chainId={chain.chainId}
searchParams={props.searchParams}
searchParams={await props.searchParams}
showPagination={true}
/>
)}

{topContracts.length === 0 && (
<div className="flex h-[200px] items-center justify-center rounded-lg border border-border text-lg text-muted-foreground">
<div className="flex items-center gap-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { getContractPageMetadata } from "../../_utils/getContractPageMetadata";
import { ContractDirectListingsPage } from "./ContractDirectListingsPage";

export default async function Page(props: {
params: {
params: Promise<{
contractAddress: string;
chain_id: string;
};
}>;
}) {
const info = await getContractPageParamsInfo(props.params);
const info = await getContractPageParamsInfo(await props.params);

if (!info) {
notFound();
Expand All @@ -20,7 +20,9 @@ export default async function Page(props: {
);

if (!isDirectListingSupported) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
redirect(
`/${(await props.params).chain_id}/${(await props.params).contractAddress}`,
);
}

return <ContractDirectListingsPage contract={info.contract} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { getContractPageMetadata } from "../../_utils/getContractPageMetadata";
import { ContractEnglishAuctionsPage } from "./ContractEnglishAuctionsPage";

export default async function Page(props: {
params: {
params: Promise<{
contractAddress: string;
chain_id: string;
};
}>;
}) {
const info = await getContractPageParamsInfo(props.params);
const info = await getContractPageParamsInfo(await props.params);

if (!info) {
notFound();
Expand All @@ -20,7 +20,9 @@ export default async function Page(props: {
);

if (!isEnglishAuctionSupported) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
redirect(
`/${(await props.params).chain_id}/${(await props.params).contractAddress}`,
);
}

return <ContractEnglishAuctionsPage contract={info.contract} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export const SnapshotUpload: React.FC<SnapshotUploadProps> = ({

interface SnapshotTableProps {
data: SnapshotAddressInput[];
portalRef: React.RefObject<HTMLDivElement>;
portalRef: React.RefObject<HTMLDivElement | null>;
}

const SnapshotTableColumns = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function getContractPageParamsInfo(params: {
}

if (!chainMetadata) {
const cookieStore = cookies();
const cookieStore = await cookies();
const localChainStoreValue = cookieStore.get(TW_LOCAL_CHAIN_STORE)?.value;

if (localChainStoreValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { AccountSigners } from "./components/account-signers";

export default async function Page(props: {
params: {
params: Promise<{
contractAddress: string;
chain_id: string;
};
}>;
}) {
const info = await getContractPageParamsInfo(props.params);
const info = await getContractPageParamsInfo(await props.params);

if (!info) {
notFound();
Expand All @@ -20,7 +20,9 @@ export default async function Page(props: {
await getContractPageMetadata(contract);

if (!isAccountPermissionsSupported) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
redirect(
`/${(await props.params).chain_id}/${(await props.params).contractAddress}`,
);
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { AccountPage } from "./AccountPage";

export default async function Page(props: {
params: {
params: Promise<{
contractAddress: string;
chain_id: string;
};
}>;
}) {
const info = await getContractPageParamsInfo(props.params);
const info = await getContractPageParamsInfo(await props.params);

if (!info) {
notFound();
Expand All @@ -19,7 +19,9 @@ export default async function Page(props: {
const { isAccount } = await getContractPageMetadata(contract);

if (!isAccount) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
redirect(
`/${(await props.params).chain_id}/${(await props.params).contractAddress}`,
);
}

return <AccountPage contract={contract} chainMetadata={chainMetadata} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { AccountsPage } from "./AccountsPage";

export default async function Page(props: {
params: {
params: Promise<{
contractAddress: string;
chain_id: string;
};
}>;
}) {
const info = await getContractPageParamsInfo(props.params);
const info = await getContractPageParamsInfo(await props.params);

if (!info) {
notFound();
Expand All @@ -19,7 +19,9 @@ export default async function Page(props: {
const { isAccountFactory } = await getContractPageMetadata(contract);

if (!isAccountFactory) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
redirect(
`/${(await props.params).chain_id}/${(await props.params).contractAddress}`,
);
}

return <AccountsPage contract={contract} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { ContractAnalyticsPage } from "./ContractAnalyticsPage";

export default async function Page(props: {
params: {
params: Promise<{
contractAddress: string;
chain_id: string;
};
}>;
}) {
const info = await getContractPageParamsInfo(props.params);
const info = await getContractPageParamsInfo(await props.params);

if (!info) {
notFound();
Expand All @@ -18,7 +18,9 @@ export default async function Page(props: {
const { isAnalyticsSupported } = await getContractPageMetadata(info.contract);

if (!isAnalyticsSupported) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
redirect(
`/${(await props.params).chain_id}/${(await props.params).contractAddress}`,
);
}

return <ContractAnalyticsPage contract={info.contract} />;
Expand Down
Loading

0 comments on commit 81224d4

Please sign in to comment.