import { useRef } from "react"; import { AnimatePresence, motion, useReducedMotion } from "framer-motion"; import { ChatInterface } from "../../chat/chat-interface"; import { ConversationOverviewPanel } from "../conversation-overview-panel"; import { useConversationStore } from "#/stores/conversation-store"; import { useBreakpoint } from "#/hooks/use-breakpoint"; import { useConversationOverviewColumnSpace } from "#/hooks/use-conversation-overview-column-space"; import { CONVERSATION_OVERVIEW_COLUMN_WIDTH_PX, CONVERSATION_OVERVIEW_PANEL_TRANSITION, } from "../conversation-overview-panel.constants"; interface ChatInterfaceWrapperProps { isRightPanelShown: boolean; } const THREAD_CLASSNAME = "w-full min-w-0 max-w-[800px] h-full flex flex-col min-h-0"; export function ChatInterfaceWrapper({ isRightPanelShown: _isRightPanelShown, }: ChatInterfaceWrapperProps) { const isMobile = useBreakpoint(); const reduceMotion = useReducedMotion(); const enableOverviewMotion = !reduceMotion && import.meta.env.MODE !== "test"; const isOverviewPanelShown = useConversationStore( (state) => state.isOverviewPanelShown, ); const containerRef = useRef(null); const wantsOverviewPanel = !isMobile && isOverviewPanelShown; const hasOverviewColumnSpace = useConversationOverviewColumnSpace( containerRef, wantsOverviewPanel, ); const showOverviewPanel = wantsOverviewPanel && hasOverviewColumnSpace; return (
{showOverviewPanel ? (
) : null}
); }