feat(web): universe dashboard — meshes + incoming invitations
Some checks failed
CI / Lint (push) Has been cancelled
CI / Typecheck (push) Has been cancelled
CI / Broker tests (Postgres) (push) Has been cancelled
CI / Docker build (linux/amd64) (push) Has been cancelled

New /dashboard landing that surfaces meshes and invitations-to-you
in one view. Replaces the simple mesh grid at /dashboard (preserved
at /dashboard/legacy).

Backend additions:
- GET /api/my/invites/incoming — pending_invite rows addressed to
  the authed user's email, joined with invite for role + expiry and
  user/mesh for display. Unaccepted + unrevoked + unexpired only.
- DELETE /api/my/invites/incoming/:id — dismiss a pending invite
  (revokes the pending_invite row only; underlying invite code stays
  valid so the inviter can re-send).

Web additions (all under apps/web/src/modules/dashboard/universe/):
- welcome.tsx — editorial serif header with mesh + invite counts
- invitations.tsx — client card with Accept (→ /i/:code claim flow)
  and optimistic Decline
- meshes-grid.tsx — hero card + compact grid, linked to mesh detail
- reveal.tsx — fade-up motion matching marketing _reveal.tsx

Styling uses the existing claudemesh design tokens (--cm-clay,
--cm-bg-elevated, Anthropic Sans/Serif/Mono) — nothing redefined.

Onboarding redirect (0 meshes → /meshes/new?onboarding=1) preserved,
now gated on 0 invitations too so users with pending invites still
land on the dashboard.

Sidebar icon switched to Atom for the "universe" concept.

Standalone prototype saved at prototypes/live-dashboard.html for
reference.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-04-19 21:31:15 +01:00
parent 2abf86d540
commit 0664180a54
13 changed files with 1734 additions and 66 deletions

View File

@@ -18,7 +18,7 @@ const menu = [
{
title: "dashboard",
href: pathsConfig.dashboard.user.index,
icon: Icons.Home,
icon: Icons.Atom,
},
{
title: "meshes",

View File

@@ -0,0 +1,79 @@
import Link from "next/link";
import { getMyMeshesResponseSchema } from "@turbostarter/api/schema";
import { handle } from "@turbostarter/api/utils";
import { Badge } from "@turbostarter/ui-web/badge";
import { buttonVariants } from "@turbostarter/ui-web/button";
import { pathsConfig } from "~/config/paths";
import { api } from "~/lib/api/server";
import { getMetadata } from "~/lib/metadata";
export const generateMetadata = getMetadata({
title: "Legacy dashboard",
description: "Simple legacy view of your meshes.",
});
export default async function LegacyDashboardHomePage() {
const { data } = await handle(api.my.meshes.$get, {
schema: getMyMeshesResponseSchema,
})({
query: { page: "1", perPage: "6", sort: JSON.stringify([]) },
});
return (
<div className="space-y-8">
<div>
<h1 className="text-2xl font-medium tracking-tight">Your meshes</h1>
<p className="text-muted-foreground text-sm">
Open one to see its members, generate invites, or share it.
</p>
</div>
<div className="grid gap-3 md:grid-cols-2 lg:grid-cols-3">
{data.map((m) => (
<Link
key={m.id}
href={pathsConfig.dashboard.user.meshes.mesh(m.id)}
className="group rounded-lg border p-5 transition-colors hover:border-primary hover:bg-muted/30"
>
<div className="mb-3 flex items-start justify-between gap-2">
<div className="min-w-0 flex-1">
<h3 className="group-hover:text-primary truncate font-medium">
{m.name}
</h3>
<p className="text-muted-foreground truncate font-mono text-xs">
{m.slug}
</p>
</div>
<Badge variant="outline" className="text-xs">
{m.isOwner ? "owner" : m.myRole}
</Badge>
</div>
<div className="flex items-center gap-3 text-xs">
<Badge variant="secondary" className="text-xs">
{m.tier}
</Badge>
<span className="text-muted-foreground">
{m.memberCount} {m.memberCount === 1 ? "member" : "members"}
</span>
</div>
</Link>
))}
</div>
<div className="flex gap-3">
<Link
href={pathsConfig.dashboard.user.meshes.index}
className={buttonVariants({ variant: "outline" })}
>
All meshes
</Link>
<Link
href={pathsConfig.dashboard.user.meshes.new}
className={buttonVariants({ variant: "default" })}
>
New mesh
</Link>
</div>
</div>
);
}

View File

@@ -1,84 +1,71 @@
import Link from "next/link";
import { redirect } from "next/navigation";
import { getMyMeshesResponseSchema } from "@turbostarter/api/schema";
import {
getMyInvitesIncomingResponseSchema,
getMyMeshesResponseSchema,
} from "@turbostarter/api/schema";
import { handle } from "@turbostarter/api/utils";
import { Badge } from "@turbostarter/ui-web/badge";
import { buttonVariants } from "@turbostarter/ui-web/button";
import { appConfig } from "~/config/app";
import { pathsConfig } from "~/config/paths";
import { api } from "~/lib/api/server";
import { getSession } from "~/lib/auth/server";
import { getMetadata } from "~/lib/metadata";
import { InvitationsSection } from "~/modules/dashboard/universe/invitations";
import { MeshesGrid } from "~/modules/dashboard/universe/meshes-grid";
import { UniverseWelcome } from "~/modules/dashboard/universe/welcome";
export const generateMetadata = getMetadata({
title: "Dashboard",
description: "Your meshes.",
title: "Your universe",
description: "Meshes, peers, and invitations — all in one place.",
});
export default async function DashboardHomePage() {
const { data } = await handle(api.my.meshes.$get, {
schema: getMyMeshesResponseSchema,
})({
query: { page: "1", perPage: "6", sort: JSON.stringify([]) },
});
export default async function UniversePage() {
const { user } = await getSession();
const name = user?.name ?? "there";
// First-time onboarding: 0-mesh user → bounce to create
if (data.length === 0) {
const [{ data: meshes }, { incoming }] = await Promise.all([
handle(api.my.meshes.$get, {
schema: getMyMeshesResponseSchema,
})({
query: { page: "1", perPage: "50", sort: JSON.stringify([]) },
}),
handle(api.my.invites.incoming.$get, {
schema: getMyInvitesIncomingResponseSchema,
})(),
]);
const activeMeshes = meshes.filter((m) => !m.archivedAt);
// First-time onboarding: brand-new user with nothing waiting → create flow.
if (activeMeshes.length === 0 && incoming.length === 0) {
redirect(`${pathsConfig.dashboard.user.meshes.new}?onboarding=1`);
}
return (
<div className="space-y-8">
<div>
<h1 className="text-2xl font-medium tracking-tight">Your meshes</h1>
<p className="text-muted-foreground text-sm">
Open one to see its members, generate invites, or share it.
</p>
</div>
<div className="grid gap-3 md:grid-cols-2 lg:grid-cols-3">
{data.map((m) => (
<Link
key={m.id}
href={pathsConfig.dashboard.user.meshes.mesh(m.id)}
className="group rounded-lg border p-5 transition-colors hover:border-primary hover:bg-muted/30"
>
<div className="mb-3 flex items-start justify-between gap-2">
<div className="min-w-0 flex-1">
<h3 className="group-hover:text-primary truncate font-medium">
{m.name}
</h3>
<p className="text-muted-foreground truncate font-mono text-xs">
{m.slug}
</p>
</div>
<Badge variant="outline" className="text-xs">
{m.isOwner ? "owner" : m.myRole}
</Badge>
</div>
<div className="flex items-center gap-3 text-xs">
<Badge variant="secondary" className="text-xs">
{m.tier}
</Badge>
<span className="text-muted-foreground">
{m.memberCount} {m.memberCount === 1 ? "member" : "members"}
</span>
</div>
</Link>
))}
</div>
<div className="flex gap-3">
<Link
href={pathsConfig.dashboard.user.meshes.index}
className={buttonVariants({ variant: "outline" })}
>
All meshes
</Link>
<Link
href={pathsConfig.dashboard.user.meshes.new}
className={buttonVariants({ variant: "default" })}
>
New mesh
</Link>
<div className="@container relative h-full p-6 md:p-10">
{/* Subtle radial backdrop, matching marketing hero */}
<div
aria-hidden
className="pointer-events-none absolute inset-0 z-0"
style={{
background:
"radial-gradient(ellipse 70% 50% at 15% -5%, rgba(217,119,87,0.08), transparent 70%)",
}}
/>
<div className="relative z-10 mx-auto max-w-[1400px]">
<UniverseWelcome
name={name}
meshCount={activeMeshes.length}
inviteCount={incoming.length}
/>
<InvitationsSection
incoming={incoming}
appBaseUrl={appConfig.url ?? "https://claudemesh.com"}
/>
<MeshesGrid meshes={activeMeshes} />
</div>
</div>
);