'use client'; import { useState } from 'react'; import { RiCheckLine, RiSearchLine } from '@remixicon/react'; import { Button } from '@/components/ui/button'; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from '@/components/ui/command'; import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import type { StoredChat } from '@/services/indexed-db/chat-store'; interface ChatSearchProps { chats: StoredChat[]; activeChatId: string | null; onSelectChat: (chatId: string) => void; } export function ChatSearch({ chats, activeChatId, onSelectChat }: ChatSearchProps) { const [open, setOpen] = useState(false); return ( Search chats Search your saved chats by title and select one to continue the conversation. {chats.length === 0 ? 'No chats yet. Start a new chat to get started.' : 'No chats found.'} {chats.map((chat) => ( { setOpen(false); onSelectChat(chat.id); }} > {chat.title} {chat.id === activeChatId && ( <> ))} ); }