Skip to content

Commit a1414e7

Browse files
[Dashboard] Add x402 payments section and disallow robots
1 parent e19f7a2 commit a1414e7

File tree

4 files changed

+135
-0
lines changed

4 files changed

+135
-0
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/ProjectSidebarLayout.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ export function ProjectSidebarLayout(props: {
8080
icon: PayIcon,
8181
label: "Payments",
8282
},
83+
{
84+
href: `${props.layoutPath}/x402`,
85+
icon: PayIcon,
86+
label: "x402",
87+
},
8388
{
8489
href: `${props.layoutPath}/bridge`,
8590
icon: BridgeIcon,
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { redirect } from "next/navigation";
2+
import { getAuthToken } from "@/api/auth-token";
3+
import { getProject } from "@/api/project/projects";
4+
import { loginRedirect } from "@/utils/redirects";
5+
6+
export default async function Page(props: {
7+
params: Promise<{ team_slug: string; project_slug: string }>;
8+
}) {
9+
const params = await props.params;
10+
11+
const authToken = await getAuthToken();
12+
if (!authToken) {
13+
loginRedirect(
14+
`/team/${params.team_slug}/${params.project_slug}/x402/configuration`,
15+
);
16+
}
17+
18+
const project = await getProject(params.team_slug, params.project_slug);
19+
if (!project) {
20+
redirect(`/team/${params.team_slug}`);
21+
}
22+
23+
return (
24+
<div className="flex flex-col gap-6">
25+
<div className="rounded-lg border border-border bg-card p-8 text-center">
26+
<h2 className="text-2xl font-semibold">Coming Soon</h2>
27+
<p className="mt-2 text-muted-foreground">
28+
x402 payments configuration will be available soon.
29+
</p>
30+
</div>
31+
</div>
32+
);
33+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { redirect } from "next/navigation";
2+
import { getAuthToken } from "@/api/auth-token";
3+
import { getProject } from "@/api/project/projects";
4+
import { ProjectPage } from "@/components/blocks/project-page/project-page";
5+
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
6+
import { PayIcon } from "@/icons/PayIcon";
7+
import { loginRedirect } from "@/utils/redirects";
8+
9+
export default async function Layout(props: {
10+
children: React.ReactNode;
11+
params: Promise<{ team_slug: string; project_slug: string }>;
12+
}) {
13+
const params = await props.params;
14+
const basePath = `/team/${params.team_slug}/${params.project_slug}/x402`;
15+
16+
const [authToken, project] = await Promise.all([
17+
getAuthToken(),
18+
getProject(params.team_slug, params.project_slug),
19+
]);
20+
21+
if (!authToken) {
22+
loginRedirect(basePath);
23+
}
24+
25+
if (!project) {
26+
redirect(`/team/${params.team_slug}`);
27+
}
28+
29+
const client = getClientThirdwebClient({
30+
jwt: authToken,
31+
teamId: project.teamId,
32+
});
33+
34+
return (
35+
<ProjectPage
36+
header={{
37+
icon: PayIcon,
38+
title: "x402 payments",
39+
description: "Instant payments for your APIs, apps and agents",
40+
actions: null,
41+
client,
42+
links: [
43+
{
44+
type: "docs",
45+
href: "https://portal.thirdweb.com/x402",
46+
},
47+
],
48+
}}
49+
tabs={[
50+
{
51+
name: "Overview",
52+
path: `${basePath}`,
53+
exactMatch: true,
54+
},
55+
{
56+
name: "Configuration",
57+
path: `${basePath}/configuration`,
58+
},
59+
]}
60+
>
61+
{props.children}
62+
</ProjectPage>
63+
);
64+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { redirect } from "next/navigation";
2+
import { getAuthToken } from "@/api/auth-token";
3+
import { getProject } from "@/api/project/projects";
4+
import { loginRedirect } from "@/utils/redirects";
5+
6+
export const dynamic = "force-dynamic";
7+
8+
export default async function Page(props: {
9+
params: Promise<{ team_slug: string; project_slug: string }>;
10+
}) {
11+
const params = await props.params;
12+
13+
const authToken = await getAuthToken();
14+
if (!authToken) {
15+
loginRedirect(`/team/${params.team_slug}/${params.project_slug}/x402`);
16+
}
17+
18+
const project = await getProject(params.team_slug, params.project_slug);
19+
if (!project) {
20+
redirect(`/team/${params.team_slug}`);
21+
}
22+
23+
return (
24+
<div className="flex flex-col gap-4 md:gap-6">
25+
<div className="rounded-lg border border-border bg-card p-8 text-center">
26+
<h2 className="text-2xl font-semibold">Coming Soon</h2>
27+
<p className="mt-2 text-muted-foreground">
28+
x402 payments analytics and overview will be available soon.
29+
</p>
30+
</div>
31+
</div>
32+
);
33+
}

0 commit comments

Comments
 (0)