mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 04:57:00 +01:00
* feat: connect project purpose, next actions and research in Memory * test: resolve superseding essays through the real dynamic route
46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
import * as React from "react";
|
|
import { createRoot } from "react-dom/client";
|
|
import { SessionProvider } from "next-auth/react";
|
|
import { AppShell } from "@/components/shell/AppShell";
|
|
import { PageLayout } from "@/components/ui/page-layout";
|
|
import { KnowledgeMap } from "@/components/memory/KnowledgeMap";
|
|
import { MAP_FIXTURE, BUSY_MAP } from "./knowledge-map.fixture";
|
|
// Public synthetic fixture, through the real shell. No account/network writes.
|
|
window.fetch = async (input) => {
|
|
const url = String(input);
|
|
const body = url.includes("/api/auth/pin")
|
|
? { configured: false, unlocked: true }
|
|
: url.includes("/api/alerts")
|
|
? { alerts: [] }
|
|
: url.includes("/api/user-projects")
|
|
? []
|
|
: url.includes("/api/sessions/snapshot")
|
|
? { sessions: [], projects: [], working: [] }
|
|
: null;
|
|
return new Response(JSON.stringify(body), { headers: { "content-type": "application/json" } });
|
|
};
|
|
const params = new URLSearchParams(window.location.search);
|
|
params.set("previewPath", "/memory");
|
|
history.replaceState(null, "", "?" + params);
|
|
const fixture = params.has("busy") ? BUSY_MAP : MAP_FIXTURE;
|
|
const session = {
|
|
user: {
|
|
id: "preview",
|
|
name: "Example builder",
|
|
email: "preview@example.test",
|
|
emailVerified: true,
|
|
},
|
|
expires: "2099-01-01",
|
|
};
|
|
createRoot(document.getElementById("root")!).render(
|
|
<SessionProvider session={session} refetchOnWindowFocus={false}>
|
|
<AppShell viewerId="preview" initialSidebarCollapsed={false}>
|
|
<PageLayout title="Memory" maxWidth="max-w-7xl">
|
|
<KnowledgeMap
|
|
map={params.has("empty") ? { ...MAP_FIXTURE, nodes: [], edges: [] } : fixture}
|
|
/>
|
|
</PageLayout>
|
|
</AppShell>
|
|
</SessionProvider>,
|
|
);
|