feat(frontend): constellation lib scaffold — graph/layout/camera pure modules (tested)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Scene config: maps pathname → constellation scene definition.
|
||||
* Pure data; the stage reads it to build graphs and place overlays.
|
||||
*/
|
||||
|
||||
import type { ConstellationGraph } from "@/lib/constellation/graph";
|
||||
import { channelsToGraph, statsToGraph } from "@/lib/constellation/graph";
|
||||
|
||||
export interface SceneDef {
|
||||
route: string;
|
||||
label: string;
|
||||
/** Build the graph from typed SSR seed data. */
|
||||
build: (seed: SceneSeed) => ConstellationGraph;
|
||||
}
|
||||
|
||||
/** Everything a scene may need — all optional, scenes pick what they use. */
|
||||
export interface SceneSeed {
|
||||
stats?: import("@/lib/types").DashboardStats;
|
||||
channels?: import("@/lib/types").DashboardChannel[];
|
||||
guildLabel?: string;
|
||||
}
|
||||
|
||||
export const SCENES: SceneDef[] = [
|
||||
{
|
||||
route: "/dashboard/",
|
||||
label: "Deck",
|
||||
build: (s) => (s.stats ? statsToGraph(s.stats) : { nodes: [], edges: [] }),
|
||||
},
|
||||
{
|
||||
route: "/channels/",
|
||||
label: "Channels",
|
||||
build: (s) =>
|
||||
s.channels ? channelsToGraph(s.channels) : { nodes: [], edges: [] },
|
||||
},
|
||||
];
|
||||
|
||||
export function resolveScene(pathname: string): SceneDef | undefined {
|
||||
return SCENES.find((sc) => sc.route === pathname);
|
||||
}
|
||||
Reference in New Issue
Block a user