import { Plus, Pin, Trash2, MessageSquare } from 'lucide-react' import { cn } from '@/lib/utils' import type { ChatListItem } from '@/types/assistant-chat' interface ChatSidebarProps { chats: ChatListItem[] activeChatId: string | null onSelectChat: (id: string) => void onNewChat: () => void onDeleteChat: (id: string) => void onTogglePin: (id: string, pinned: boolean) => void } export function ChatSidebar({ chats, activeChatId, onSelectChat, onNewChat, onDeleteChat, onTogglePin, }: ChatSidebarProps) { const pinnedChats = chats.filter(c => c.pinned) const unpinnedChats = chats.filter(c => !c.pinned) return (
{/* Header */}
{/* Chat list */}
{pinnedChats.length > 0 && (
Pinned
)} {pinnedChats.map(chat => ( onSelectChat(chat.id)} onDelete={() => onDeleteChat(chat.id)} onTogglePin={() => onTogglePin(chat.id, !chat.pinned)} /> ))} {pinnedChats.length > 0 && unpinnedChats.length > 0 && (
)} {unpinnedChats.map(chat => ( onSelectChat(chat.id)} onDelete={() => onDeleteChat(chat.id)} onTogglePin={() => onTogglePin(chat.id, !chat.pinned)} /> ))} {chats.length === 0 && (
No conversations yet
)}
) } function ChatItem({ chat, isActive, onSelect, onDelete, onTogglePin, }: { chat: ChatListItem isActive: boolean onSelect: () => void onDelete: () => void onTogglePin: () => void }) { return (
{chat.title}
{chat.message_count} messages
) }