// frontend/src/shell/NavSessions.tsx import { useQuery, useQueryClient } from "@tanstack/react-query"; import { listSessions } from "../api/sessions"; import { resumeSession } from "../api/sessions"; import type { SessionSummary } from "../api/types"; interface Props { activeSessionId: string | null; onSessionSelect: (id: string) => void; } export function NavSessions({ activeSessionId, onSessionSelect }: Props) { const queryClient = useQueryClient(); const { data: sessions = [] } = useQuery({ queryKey: ["sessions"], queryFn: listSessions, refetchInterval: 10_000, }); async function handleClick(id: string) { await resumeSession(id); queryClient.invalidateQueries({ queryKey: ["sessions"] }); onSessionSelect(id); } if (sessions.length === 0) { return (

No sessions yet. Start with New question.

); } return ( ); }