diff --git a/frontend/src/app/components/Sidebar.tsx b/frontend/src/app/components/Sidebar.tsx index 7dda7e7..2b8533b 100644 --- a/frontend/src/app/components/Sidebar.tsx +++ b/frontend/src/app/components/Sidebar.tsx @@ -1,7 +1,8 @@ -import React, { useRef, useCallback } from 'react'; +import React, { useRef } from 'react'; import Link from 'next/link'; import { motion, AnimatePresence } from 'framer-motion'; import { Button } from "@/components/ui/button" +import { useRouter } from 'next/navigation'; type Conversation = { id: number; @@ -19,78 +20,9 @@ type SidebarProps = { onCloseSidebar: () => void; }; -type ConversationItemProps = { - conversation: Conversation; - isActive: boolean; - onConversationChange: (id: number) => void; - onDeleteConversation: (id: number) => void; -}; - -const ConversationItem = React.memo(({ conversation, isActive, onConversationChange, onDeleteConversation }: ConversationItemProps) => { - return ( - - { - e.preventDefault(); - onConversationChange(conversation.id); - }} - > - - - - ); -}); - export default function Sidebar({ conversations, currentConversationId, onConversationChange, onAddConversation, onDeleteConversation, isSidebarOpen, onCloseSidebar }: SidebarProps) { const menuRef = useRef(null); - - const handleConversationChange = useCallback((id: number) => { - onConversationChange(id); - }, [onConversationChange]); - - const handleDeleteConversation = useCallback((id: number) => { - onDeleteConversation(id); - }, [onDeleteConversation]); + const router = useRouter(); return (