import React from "react"; import { Edit, Trash2, PanelLeftClose, PanelLeftOpen, SquarePen, } from "lucide-react"; import ModelSelector from "./ModelSelector"; import { type Model } from "../types/models"; import { type Message } from "../types"; interface Conversation { id?: number; title: string; messages: Message[]; } interface ChatSidebarProps { sidebarVisible: boolean; setSidebarVisible: React.Dispatch>; conversations: Conversation[]; conversationId: number | undefined; setConversationId: React.Dispatch>; deleteConversation: (id: number) => void; editConversationTitle: (id: number, newTitle: string) => void; startNewConversation: () => void; selectedModel: Model; onModelChange: (model: Model) => void; apiKeyUpdateTrigger: number; } const ChatSidebar: React.FC = ({ sidebarVisible, setSidebarVisible, conversations, conversationId, setConversationId, deleteConversation, editConversationTitle, startNewConversation, selectedModel, onModelChange, apiKeyUpdateTrigger, }) => { const handleConversationClick = (id: number | undefined) => { setConversationId(id); if (window.matchMedia("(max-width: 768px)").matches) { setSidebarVisible(false); } }; return ( <> {/* Mobile overlay */} {sidebarVisible && (
setSidebarVisible(false)} /> )}
    {conversations.map((conversation) => (
  • handleConversationClick(conversation.id)} >
    {conversation.title}
  • ))}
{/* Model Selector at bottom */}
); }; export default ChatSidebar;