"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { CornerDownLeftIcon } from "lucide-react"; import { GraphView } from "@/components/graph-view"; import { SidebarToggle } from "@/components/sidebar"; /** * Home — the knowledge graph is the main view (placeholder until the graph * pipeline lands), with the new-session blob docked below it. Sessions live * in the toggleable sidebar. */ export function Home() { const router = useRouter(); const [topic, setTopic] = useState(""); const [busy, setBusy] = useState(false); const start = async () => { const t = topic.trim(); if (!t || busy) return; setBusy(true); try { const res = await fetch("/api/chats", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ title: t }), }); const { id } = (await res.json()) as { id: string }; router.push(`/chat/${id}?prompt=${encodeURIComponent(t)}`); } catch { setBusy(false); } }; return (