Skip to content

Commit 05785ef

Browse files
committed
Insight Dashboard
1 parent 026f712 commit 05785ef

File tree

6 files changed

+145
-130
lines changed

6 files changed

+145
-130
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { redirect } from "next/navigation";
2+
import { isValidBlueprintSlug } from "./validBlueprintSlugs";
3+
4+
export default async function Page(props: {
5+
params: Promise<{
6+
team_slug: string;
7+
project_slug: string;
8+
blueprint_slug: string;
9+
}>;
10+
}) {
11+
// currently only supported blueprint_slug's are "transactions", "events", and "erc20-tokens"
12+
const params = await props.params;
13+
14+
if (!isValidBlueprintSlug(params.blueprint_slug)) {
15+
return redirect(`/team/${params.team_slug}/${params.project_slug}/insight`);
16+
}
17+
18+
return (
19+
<div className="container flex grow flex-col py-8">
20+
page content for {params.blueprint_slug}
21+
</div>
22+
);
23+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export type OfficialBlueprintSlug = "transactions" | "events" | "erc20-tokens";
2+
3+
export function isValidBlueprintSlug(
4+
blueprint_slug: string,
5+
): blueprint_slug is OfficialBlueprintSlug {
6+
return (
7+
blueprint_slug === "transactions" ||
8+
blueprint_slug === "events" ||
9+
blueprint_slug === "erc20-tokens"
10+
);
11+
}

apps/dashboard/src/app/team/[team_slug]/[project_slug]/insight/components/BlueprintsExplorer.tsx

Lines changed: 0 additions & 62 deletions
This file was deleted.

apps/dashboard/src/app/team/[team_slug]/[project_slug]/insight/components/BlueprintsPage.tsx

Lines changed: 0 additions & 41 deletions
This file was deleted.

apps/dashboard/src/app/team/[team_slug]/[project_slug]/insight/components/BlueprintsPageHeader.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 111 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
import { Button } from "@/components/ui/button";
2+
import { ToolTipLabel } from "@/components/ui/tooltip";
3+
import {
4+
ArrowUpDownIcon,
5+
CircleDotDashedIcon,
6+
PlusIcon,
7+
ZapIcon,
8+
} from "lucide-react";
9+
import Link from "next/link";
110
import { redirect } from "next/navigation";
211
import { getAuthTokenWalletAddress } from "../../../../api/lib/getAuthToken";
3-
import { BlueprintsPage } from "./components/BlueprintsPage";
12+
import type { OfficialBlueprintSlug } from "./[blueprint_slug]/validBlueprintSlugs";
413

514
export default async function Page(props: {
615
params: Promise<{ team_slug: string; project_slug: string }>;
716
}) {
17+
const params = await props.params;
818
const accountAddress = await getAuthTokenWalletAddress();
919

1020
if (!accountAddress) {
@@ -14,5 +24,104 @@ export default async function Page(props: {
1424
);
1525
}
1626

17-
return <BlueprintsPage />;
27+
return (
28+
<div className="flex grow flex-col">
29+
<div className="border-border border-b py-10">
30+
<div className="container flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
31+
<h1 className="font-semibold text-2xl tracking-tight sm:text-3xl">
32+
Insight
33+
</h1>
34+
<ToolTipLabel label="Coming Soon">
35+
<Button className="gap-2" disabled>
36+
<PlusIcon className="size-4" />
37+
Add Blueprint <span className="lg:hidden"> (Coming Soon) </span>
38+
</Button>
39+
</ToolTipLabel>
40+
</div>
41+
</div>
42+
<div className="container py-8">
43+
<div className="grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3">
44+
{blueprints.map((blueprint) => {
45+
return (
46+
<BlueprintCard
47+
key={blueprint.id}
48+
blueprint={blueprint}
49+
teamSlug={params.team_slug}
50+
projectSlug={params.project_slug}
51+
icon={blueprint.icon}
52+
/>
53+
);
54+
})}
55+
</div>
56+
</div>
57+
</div>
58+
);
59+
}
60+
61+
type Blueprint = {
62+
id: string;
63+
name: string;
64+
slug: OfficialBlueprintSlug;
65+
description: string;
66+
icon: React.FC<{ className?: string }>;
67+
};
68+
69+
const blueprints: Blueprint[] = [
70+
{
71+
id: "1",
72+
name: "Transactions",
73+
slug: "transactions",
74+
description: "Query transaction data",
75+
icon: ArrowUpDownIcon,
76+
},
77+
{
78+
id: "2",
79+
name: "Events",
80+
slug: "events",
81+
description: "Query event data",
82+
icon: ZapIcon,
83+
},
84+
{
85+
id: "3",
86+
name: "Tokens",
87+
slug: "erc20-tokens",
88+
description: "Query ERC-20, ERC-721, and ERC-1155 tokens",
89+
icon: CircleDotDashedIcon,
90+
},
91+
];
92+
93+
function BlueprintCard(props: {
94+
blueprint: Blueprint;
95+
teamSlug: string;
96+
projectSlug: string;
97+
icon: React.FC<{ className?: string }>;
98+
}) {
99+
const { blueprint } = props;
100+
return (
101+
<div
102+
key={blueprint.id}
103+
className="relative rounded-lg border border-border bg-muted/50 p-4 hover:bg-muted/70"
104+
>
105+
<div className="flex items-center gap-4">
106+
<div className="rounded-xl border p-1">
107+
<div className="rounded-lg border bg-muted p-1.5">
108+
<props.icon className="size-5 text-muted-foreground" />
109+
</div>
110+
</div>
111+
112+
<div>
113+
<Link
114+
className="group static before:absolute before:top-0 before:right-0 before:bottom-0 before:left-0 before:z-0"
115+
href={`/team/${props.teamSlug}/${props.projectSlug}/insight/${blueprint.slug}`}
116+
>
117+
<h2 className="font-semibold text-lg">{blueprint.name}</h2>
118+
</Link>
119+
120+
<p className="text-muted-foreground text-sm">
121+
{blueprint.description}
122+
</p>
123+
</div>
124+
</div>
125+
</div>
126+
);
18127
}

0 commit comments

Comments
 (0)