Skip to content

Commit bc5393c

Browse files
author
Amine Afia
committed
Add initial insight UI
1 parent 3488281 commit bc5393c

File tree

5 files changed

+154
-0
lines changed

5 files changed

+154
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
"use client";
2+
3+
import {} from "@/components/ui/dropdown-menu";
4+
import {} from "@/components/ui/select";
5+
import { BillingAlerts } from "components/settings/Account/Billing/alerts/Alert";
6+
import { Layers3 } from "lucide-react";
7+
import Link from "next/link";
8+
9+
export type Blueprint = {
10+
id: string;
11+
name: string;
12+
slug: string;
13+
description: string;
14+
};
15+
16+
export function BlueprintsExplorer(props: {
17+
blueprints: Blueprint[];
18+
}) {
19+
const { blueprints } = props;
20+
return (
21+
<div className="container">
22+
<BillingAlerts className="mb-10" />
23+
24+
{/* Blueprints */}
25+
{blueprints.length === 0 ? (
26+
<div className="flex h-[450px] items-center justify-center rounded-lg border border-border ">
27+
No blueprints found
28+
</div>
29+
) : (
30+
<div className="grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3">
31+
{blueprints.map((blueprint) => {
32+
return <BlueprintCard key={blueprint.id} blueprint={blueprint} />;
33+
})}
34+
</div>
35+
)}
36+
37+
<div className="h-10" />
38+
</div>
39+
);
40+
}
41+
42+
function BlueprintCard(props: {
43+
blueprint: Blueprint;
44+
}) {
45+
const { blueprint } = props;
46+
return (
47+
<div
48+
key={blueprint.id}
49+
className="relative flex items-center gap-4 rounded-lg border border-border bg-muted/50 p-4 transition-colors hover:bg-muted/70"
50+
>
51+
<Layers3 className="size-10" />
52+
53+
<div>
54+
<Link
55+
className="group static before:absolute before:top-0 before:right-0 before:bottom-0 before:left-0 before:z-0"
56+
href={`https://portal.thirdweb.com/insight/blueprints#${blueprint.slug}`}
57+
>
58+
<h2 className="font-medium text-base">{blueprint.name}</h2>
59+
</Link>
60+
61+
<p className="my-1 text-muted-foreground/70 text-xs">
62+
{blueprint.description}
63+
</p>
64+
</div>
65+
</div>
66+
);
67+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { BillingAlerts } from "components/settings/Account/Billing/alerts/Alert";
2+
import { type Blueprint, BlueprintsExplorer } from "./BlueprintsExplorer";
3+
import { BlueprintsPageHeader } from "./BlueprintsPageHeader";
4+
5+
export function BlueprintsPage() {
6+
return (
7+
<div>
8+
<BillingAlerts />
9+
<BlueprintsPageHeader />
10+
<div className="h-6" />
11+
<BlueprintsPageContent />
12+
</div>
13+
);
14+
}
15+
16+
function getProjectBlueprints() {
17+
return [
18+
{
19+
id: "1",
20+
name: "Transactions",
21+
slug: "transactions-blueprint",
22+
description: "Query transaction data",
23+
},
24+
{
25+
id: "2",
26+
name: "Events",
27+
slug: "events-blueprint",
28+
description: "Query event data",
29+
},
30+
{
31+
id: "3",
32+
name: "Tokens",
33+
slug: "tokens-blueprint",
34+
description: "Query ERC-20, ERC-721, and ERC-1155 tokens",
35+
},
36+
] as Blueprint[];
37+
}
38+
39+
function BlueprintsPageContent() {
40+
const blueprints = getProjectBlueprints();
41+
42+
return <BlueprintsExplorer blueprints={blueprints} />;
43+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"use client";
2+
3+
import { Button } from "@/components/ui/button";
4+
import { PlusIcon } from "lucide-react";
5+
6+
export function BlueprintsPageHeader() {
7+
return (
8+
<div className="flex grow flex-col">
9+
<div className="border-border border-b py-10">
10+
<div className="container flex items-center justify-between">
11+
<h1 className="font-semibold text-3xl tracking-tight">
12+
Project Settings
13+
</h1>
14+
<Button className="cursor-not-allowed gap-2 opacity-50" disabled>
15+
<PlusIcon className="size-4" />
16+
Create Blueprint (Coming Soon)
17+
</Button>
18+
</div>
19+
</div>
20+
</div>
21+
);
22+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { redirect } from "next/navigation";
2+
import { getAuthTokenWalletAddress } from "../../../../api/lib/getAuthToken";
3+
import { BlueprintsPage } from "./components/BlueprintsPage";
4+
5+
export default async function Page(props: {
6+
params: Promise<{ team_slug: string; project_slug: string }>;
7+
}) {
8+
const accountAddress = await getAuthTokenWalletAddress();
9+
10+
if (!accountAddress) {
11+
const { team_slug, project_slug } = await props.params;
12+
return redirect(
13+
`/login?next=${encodeURIComponent(`/team/${team_slug}/${project_slug}/insight`)}`,
14+
);
15+
}
16+
17+
return <BlueprintsPage />;
18+
}

apps/dashboard/src/app/team/[team_slug]/[project_slug]/layout.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export default async function TeamLayout(props: {
6262
path: `/team/${params.team_slug}/${params.project_slug}/nebula`,
6363
name: "Nebula",
6464
},
65+
{
66+
path: `/team/${params.team_slug}/${params.project_slug}/insight`,
67+
name: "Insight",
68+
},
6569
{
6670
path: `/team/${params.team_slug}/${params.project_slug}/settings`,
6771
name: "Settings",

0 commit comments

Comments
 (0)