diff --git a/apps/desktop/src/components/claude-chat/claude-chat-drawer.tsx b/apps/desktop/src/components/claude-chat/claude-chat-drawer.tsx index 9e82748..ecc1d14 100644 --- a/apps/desktop/src/components/claude-chat/claude-chat-drawer.tsx +++ b/apps/desktop/src/components/claude-chat/claude-chat-drawer.tsx @@ -1,7 +1,9 @@ import { useRef, useState, useCallback, useEffect } from "react"; import { ChevronDownIcon, + Maximize2Icon, MessageCircleIcon, + Minimize2Icon, } from "lucide-react"; import { cn } from "@/lib/utils"; @@ -22,6 +24,7 @@ export function ClaudeChatDrawer() { const error = useClaudeChatStore((s) => s.error); const [isOpen, setIsOpen] = useState(false); + const [isExpanded, setIsExpanded] = useState(false); const [height, setHeight] = useState(DEFAULT_HEIGHT); const [isDragging, setIsDragging] = useState(false); const containerRef = useRef(null); @@ -48,6 +51,8 @@ export function ClaudeChatDrawer() { }, [isStreaming, isOpen, pendingAttachments]); const handleMouseDown = useCallback((e: React.MouseEvent) => { + if (isExpanded) return; + e.preventDefault(); setIsDragging(true); hasDraggedRef.current = false; @@ -79,12 +84,35 @@ export function ClaudeChatDrawer() { document.addEventListener("mousemove", handleMouseMove); document.addEventListener("mouseup", handleMouseUp); + }, [isExpanded]); + + // Compute expanded dimensions from parent + const getExpandedDimensions = useCallback(() => { + const parent = containerRef.current?.parentElement; + return { + height: parent?.clientHeight ?? 600, + width: parent?.clientWidth ?? 800, + }; }, []); + const panelStyle = (): React.CSSProperties => { + if (!isOpen && !isExpanded) { + return { height: 0, maxWidth: 672, borderRadius: 24 }; + } + if (isExpanded) { + const dims = getExpandedDimensions(); + return { height: dims.height, maxWidth: dims.width, borderRadius: 0 }; + } + return { height, maxWidth: 672, borderRadius: 24 }; + }; + return (
{/* Floating toggle button */}
- + ) : ( +
+
{ + if (!hasDraggedRef.current) { + setIsOpen(false); + } + }} + > +
+ +
+
+ + +
+
+ )} {/* Error banner */} {error && (