mirror of
https://github.com/0xWheatyz/handler.git
synced 2026-08-30 08:36:23 +00:00
5d8c62450c
The dashboard was a single route that swapped section components via a `section` state field. Convert it to the App Router's multi-page model so each left-nav selection is its own route (/, /repositories, /agents, /schedules, /approvals, /servers, /activity, /shared, /login), making the pages modular and independently updatable. - Move the token gate + store provider + sidebar into a persistent frame (AppFrame + Shell) rendered by the root layout, so auth, the polling loop, and shared state survive client-side navigation. - Sidebar items are now <Link> routes; the active item and the store's polled section are derived from the URL (lib/nav). - Each section gets an app/<section>/page.tsx; Runs stays at root and keeps its full-height split layout, the rest render in the shared scroll frame. - Emit per-route index.html (trailingSlash) so the FastAPI StaticFiles mount serves clean slash-terminated URLs with no SPA rewrite. - Regenerate the bundled static export. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PsAeGVadULRzPhV2PRDttM
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
/* The left-nav map: one entry per section, each its own route/page. This is the single
|
|
* source of truth shared by the sidebar (which renders the links) and the auth frame
|
|
* (which seeds the store's active section from the URL on first load). Runs is the root. */
|
|
import type { Section } from "@/components/store";
|
|
|
|
export interface NavRoute {
|
|
key: Section;
|
|
href: string;
|
|
label: string;
|
|
}
|
|
|
|
export const NAV_ROUTES: NavRoute[] = [
|
|
{ key: "runs", href: "/", label: "Runs" },
|
|
{ key: "repositories", href: "/repositories", label: "Repositories" },
|
|
{ key: "agents", href: "/agents", label: "Agents" },
|
|
{ key: "schedules", href: "/schedules", label: "Schedules" },
|
|
{ key: "approvals", href: "/approvals", label: "Approvals" },
|
|
{ key: "servers", href: "/servers", label: "Git Servers" },
|
|
{ key: "activity", href: "/activity", label: "Activity" },
|
|
{ key: "shared", href: "/shared", label: "Shared" },
|
|
{ key: "login", href: "/login", label: "Claude Login" },
|
|
];
|
|
|
|
/* Map a browser path back to its section key. Trailing slashes (Next emits them under
|
|
* `trailingSlash: true`) are normalized away; anything unrecognized falls back to Runs. */
|
|
export function sectionFromPath(pathname: string): Section {
|
|
const clean = pathname.replace(/\/+$/, "") || "/";
|
|
return NAV_ROUTES.find((r) => r.href === clean)?.key ?? "runs";
|
|
}
|