From 67a10c472f01149120bf0cf27e901528427a0906 Mon Sep 17 00:00:00 2001 From: Jonathan Dobson Date: Tue, 15 Jul 2025 11:44:31 -0400 Subject: [PATCH] add maximized, and show[button] props (#2956) --- .../src/components/FloatingWindow.tsx | 61 ++++++++++++------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/skyvern-frontend/src/components/FloatingWindow.tsx b/skyvern-frontend/src/components/FloatingWindow.tsx index df9b95e4..6e67632c 100644 --- a/skyvern-frontend/src/components/FloatingWindow.tsx +++ b/skyvern-frontend/src/components/FloatingWindow.tsx @@ -100,6 +100,10 @@ function FloatingWindow({ children, initialWidth, initialHeight, + maximized, + showCloseButton, + showMaximizeButton, + showMinimizeButton, title, zIndex, // -- @@ -108,12 +112,15 @@ function FloatingWindow({ children: React.ReactNode; initialHeight?: number; initialWidth?: number; + maximized?: boolean; + showCloseButton?: boolean; + showMaximizeButton?: boolean; + showMinimizeButton?: boolean; title: string; zIndex?: string; // -- onInteract?: () => void; }) { - console.log(title, initialWidth, initialHeight); const [position, setPosition] = useState({ x: 0, y: 0 }); const [size, setSize] = useState({ left: 0, @@ -133,7 +140,7 @@ function FloatingWindow({ height: initialHeight ?? Constants.MinHeight, width: initialWidth ?? Constants.MinWidth, }); - const [isMaximized, setIsMaximized] = useState(false); + const [isMaximized, setIsMaximized] = useState(maximized ?? false); const [isMinimized, setIsMinimized] = useState(false); const parentRef = useRef(null); const resizableRef = useRef(null); @@ -464,23 +471,31 @@ function FloatingWindow({ {os === "macOS" ? ( <>
- {}} - /> - - + {showCloseButton && ( + {}} + /> + )} + {showMinimizeButton && ( + + )} + {showMaximizeButton && ( + + )}
{title}
@@ -488,9 +503,11 @@ function FloatingWindow({ <>
{title}
- -
{isMaximized ? "-" : "□"}
-
+ {showMaximizeButton && ( + +
{isMaximized ? "-" : "□"}
+
+ )}
)}