import { useState, useCallback, useRef } from "react"; import { AnimatePresence, motion } from "framer-motion"; import { v4 as uuidv4 } from "uuid"; import Sidebar from "./components/Sidebar"; import ChatWindow from "./components/ChatWindow"; export default function App() { const [currentSessionId, setCurrentSessionId] = useState(null); const [sidebarOpen, setSidebarOpen] = useState(true); const handleNewChat = useCallback(() => { setCurrentSessionId(null); }, []); const handleSelectSession = useCallback((sessionId) => { setCurrentSessionId(sessionId); // Close sidebar on mobile after selection if (window.innerWidth < 768) { setSidebarOpen(false); } }, []); const handleNewSessionCreated = useCallback(() => { const newId = uuidv4(); console.log("App: creating new session:", newId); setCurrentSessionId(newId); return newId; }, []); return (