// ChatLayout.jsx import React, { useState, useEffect } from "react"; import ChatHeader from "./ChatHeader"; import ChatWindow from "./ChatWindow"; import ChatInput from "./ChatInput"; import SessionTable from "./SessionTable"; import NoSessionBox from "./NoSessionBox"; export default function ChatLayout({ theme, messages, loading, onSend, onStop, onToggleTheme, onReloadHistory, onFreshStart, onCreateSession, onEditSession, onSelectSession, userId, sessionId, sessionName }) { const [showSessionsPanel, setShowSessionsPanel] = useState(false); function getScrollbarWidth() { return window.innerWidth - document.documentElement.clientWidth; } useEffect(() => { document.body.classList.toggle("sessions-open", showSessionsPanel); }, [showSessionsPanel]); const openSessionManager = () => { const scrollBarWidth = getScrollbarWidth(); document.body.style.overflow = "hidden"; document.body.style.paddingRight = `${scrollBarWidth}px`; setShowSessionsPanel(true); }; const closeSessionManager = () => { document.body.style.overflow = ""; document.body.style.paddingRight = ""; setShowSessionsPanel(false); document.body.classList.remove("sessions-open"); }; return ( <>
{/* HEADER */} {/* AREA SCROLLABILE */}
{/* INPUT SEMPRE IN BASSO */} {sessionId ? ( ) : ( )}
{/* PANEL SESSIONI */}
Manage Sessions
); }