import { createSignal, Show, For } from "solid-js"; import type { Session } from "../types"; interface SessionSwitcherProps { sessions: Session[]; currentSessionId: string | null; currentSessionTitle: string; onSessionSelect: (sessionId: string) => void; } export function SessionSwitcher(props: SessionSwitcherProps) { const [isOpen, setIsOpen] = createSignal(false); const toggleDropdown = () => setIsOpen(!isOpen()); const handleSessionClick = (sessionId: string) => { props.onSessionSelect(sessionId); setIsOpen(false); }; const formatRelativeTime = (timestamp: number): string => { const now = Date.now(); const diff = now - timestamp; const seconds = Math.floor(diff / 1000); const minutes = Math.floor(seconds / 60); const hours = Math.floor(minutes / 60); const days = Math.floor(hours / 24); if (days > 0) return `${days}d ago`; if (hours > 0) return `${hours}h ago`; if (minutes > 0) return `${minutes}m ago`; return "just now"; }; return (