"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { WaypointsIcon } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { SessionDrawer } from "@/components/session-drawer"; /** * Home — the knowledge graph is the main view (placeholder until the graph * pipeline lands), with the new-session input docked below it. Sessions live * in the hamburger drawer. */ 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 (
{/* Graph — the main view. Placeholder until the knowledge graph lands. */}
Knowledge graph

Every session you complete will map what you know — and where the edge of your understanding is — right here.

{/* New session input */}
{ e.preventDefault(); void start(); }} > setTopic(e.target.value)} placeholder="What do you want to learn?" autoFocus className="h-11" />
); }