Sidebar.tsx (709B)
1 import { useEffect } from "react"; 2 import { useTopicStore } from "../../store/topic"; 3 import { TopicList } from "./TopicList"; 4 import { SessionList } from "./SessionList"; 5 6 interface SidebarProps { 7 onSelectSession?: (sessionId: string) => void; 8 } 9 10 export function Sidebar({ onSelectSession }: SidebarProps) { 11 const { fetchTopics } = useTopicStore(); 12 13 useEffect(() => { 14 fetchTopics(); 15 }, [fetchTopics]); 16 17 return ( 18 <aside className="flex h-full w-64 flex-shrink-0 flex-col overflow-y-auto border-r border-gray-800 bg-gray-900 p-4"> 19 <h1 className="mb-6 text-lg font-bold">Theo Dashboard</h1> 20 <TopicList /> 21 <SessionList onSelectSession={onSelectSession} /> 22 </aside> 23 ); 24 }