'use client'; import { RiAddLine, RiMoreLine, RiDeleteBinLine } from '@remixicon/react'; import { Sidebar, SidebarContent, SidebarHeader, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarMenuAction, useSidebar, } from '@/components/ui/sidebar'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { Button } from '@/components/ui/button'; import { ChatSearch } from './ChatSearch'; import type { StoredChat } from '@/services/indexed-db/chat-store'; export type Chat = StoredChat; interface ChatSidebarProps { chats: Chat[]; activeChatId: string | null; onSelectChat: (chatId: string) => void; onNewChat: () => void; onDeleteChat: (chatId: string) => void; } export function ChatSidebar({ chats, activeChatId, onSelectChat, onNewChat, onDeleteChat, }: ChatSidebarProps) { const { setOpenMobile } = useSidebar(); const selectChat = (chatId: string) => { onSelectChat(chatId); setOpenMobile(false); }; return (
ChatGPT
Recent Chats {chats.map((chat) => ( selectChat(chat.id)} tooltip={chat.title} > {chat.title} onDeleteChat(chat.id)} > Delete ))}
); }