Skip to content

Commit

Permalink
next15
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsdls authored and MananTank committed Oct 30, 2024
1 parent df8b2f6 commit a8d0cbe
Show file tree
Hide file tree
Showing 205 changed files with 2,505 additions and 2,402 deletions.
1 change: 0 additions & 1 deletion apps/dashboard/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ const moduleExports = {
serverSourceMaps: false,
},
cacheMaxMemorySize: 0,
swcMinify: true,
compiler: {
emotion: true,
},
Expand Down
27 changes: 14 additions & 13 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"dev": "next dev --turbo",
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"format": "biome format ./src --write",
Expand All @@ -27,7 +27,7 @@
"@chakra-ui/theme-tools": "^2.1.2",
"@emotion/react": "11.13.3",
"@emotion/styled": "11.13.0",
"@hookform/resolvers": "^3.9.0",
"@hookform/resolvers": "^3.9.1",
"@marsidev/react-turnstile": "^1.0.2",
"@n8tb1t/use-scroll-position": "^2.0.3",
"@radix-ui/react-alert-dialog": "^1.1.2",
Expand All @@ -52,6 +52,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 @@ -63,12 +64,12 @@
"flat": "^6.0.1",
"framer-motion": "11.11.10",
"fuse.js": "7.0.0",
"input-otp": "^1.2.4",
"input-otp": "^1.2.5",
"ioredis": "^5.4.1",
"ipaddr.js": "^2.2.0",
"lottie-react": "^2.4.0",
"lucide-react": "0.454.0",
"next": "14.2.15",
"next": "15.0.2",
"next-plausible": "^3.12.0",
"next-seo": "^6.5.0",
"next-themes": "^0.3.0",
Expand All @@ -79,17 +80,17 @@
"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",
"react-markdown": "^9.0.1",
"react-responsive-carousel": "^3.2.23",
"react-table": "^7.8.0",
"recharts": "^2.13.0",
"recharts": "^2.13.1",
"remark-gfm": "^4.0.0",
"server-only": "^0.0.1",
"sonner": "^1.5.0",
Expand All @@ -105,8 +106,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.2",
"@next/eslint-plugin-next": "15.0.2",
"@playwright/test": "1.48.2",
"@storybook/addon-essentials": "8.3.6",
"@storybook/addon-interactions": "8.3.6",
Expand All @@ -122,8 +123,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 @@ -133,9 +134,9 @@
"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.34.2",
"knip": "5.34.3",
"next-sitemap": "^4.2.3",
"postcss": "8.4.47",
"storybook": "8.3.6",
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
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/api/team-members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type TeamMember = {
};

export async function getMembers(teamSlug: string) {
const token = getAuthToken();
const token = await getAuthToken();

if (!token) {
return undefined;
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
8 changes: 4 additions & 4 deletions apps/dashboard/src/@/constants/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { 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;
export async function getActiveAccountCookie() {
return (await cookies()).get(COOKIE_ACTIVE_ACCOUNT)?.value;
}

export function getJWTCookie(address: string) {
return cookies().get(COOKIE_PREFIX_TOKEN + address)?.value;
export async function getJWTCookie(address: string) {
return (await cookies()).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,12 @@ 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,10 @@ 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 params = await props.params;
const chain = await getChain(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 @@ -3,18 +3,17 @@ import { CircleAlertIcon } from "lucide-react";
import { TrendingContractSection } from "../../../../trending/components/trending-table";
import { getChain } from "../../../utils";

// we're using searchParams here - use dynamic rendering
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 searchParams = await props.searchParams;
const params = await props.params;
const chain = await getChain(params.chain_id);
const topContracts = await fetchTopContracts({
chainId: chain.chainId,
page: props.searchParams.page,
sortBy: props.searchParams.sortBy,
page: searchParams.page,
sortBy: searchParams.sortBy,
perPage: 15,
timeRange: "month",
});
Expand All @@ -24,22 +23,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={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 @@ -6,12 +6,13 @@ import { ContractDirectListingsPage } from "./ContractDirectListingsPage";
import { ContractDirectListingsPageClient } from "./ContractDirectListingsPage.client";

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

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

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

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

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

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

if (!isEnglishAuctionSupported) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
redirect(`/${params.chain_id}/${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 @@ -13,14 +13,9 @@ export async function getContractPageParamsInfo(params: {
}) {
const contractAddress = getCheckSummedAddress(params.contractAddress);
const chainSlugOrId = params.chain_id;
let chainMetadata: ChainMetadata | null = null;
try {
chainMetadata = await fetchChain(chainSlugOrId);
} catch {
// move on
}
let chainMetadata = await fetchChain(chainSlugOrId).catch(() => null);

const cookieStore = cookies();
const cookieStore = await cookies();
const localChainStoreValue = cookieStore.get(TW_LOCAL_CHAIN_STORE)?.value;

if (localChainStoreValue) {
Expand All @@ -47,7 +42,7 @@ export async function getContractPageParamsInfo(params: {
}

// attempt to get the auth token
const token = getAuthToken();
const token = await getAuthToken();

const contract = getContract({
address: contractAddress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import { AccountSignersClient } from "./AccountSigners.client";
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 params = await props.params;
const info = await getContractPageParamsInfo(params);

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

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

return <AccountSigners contract={contract} />;
Expand Down
Loading

0 comments on commit a8d0cbe

Please sign in to comment.