redo 6035 because of 6036, which undid 6035 (#3302)

This commit is contained in:
Jonathan Dobson
2025-08-26 11:54:45 -04:00
committed by GitHub
parent 4d701b3e05
commit 7002c33bb4
3 changed files with 33 additions and 8 deletions

View File

@@ -334,7 +334,7 @@ function BrowserStream({
ref={setCanvasContainerRef} ref={setCanvasContainerRef}
> >
{isVncConnected && ( {isVncConnected && (
<div className="overlay z-10 flex items-center justify-center"> <div className="overlay z-10 flex items-center justify-center overflow-hidden">
{showControlButtons && ( {showControlButtons && (
<div className="control-buttons pointer-events-none relative flex h-full w-full items-center justify-center"> <div className="control-buttons pointer-events-none relative flex h-full w-full items-center justify-center">
<Button <Button

View File

@@ -31,6 +31,7 @@ import { PowerIcon } from "./icons/PowerIcon";
type OS = "Windows" | "macOS" | "Linux" | "Unknown"; type OS = "Windows" | "macOS" | "Linux" | "Unknown";
const Constants = { const Constants = {
HandleSize: "40px",
MinHeight: 52, MinHeight: 52,
MinWidth: 256, MinWidth: 256,
} as const; } as const;
@@ -180,11 +181,14 @@ function FloatingWindow({
title, title,
zIndex, zIndex,
// -- // --
onBlur,
onBreakout, onBreakout,
onCycle, onCycle,
onFocus, onFocus,
onBlur,
onInteract, onInteract,
onMinimize,
onMaximize,
onRestore,
}: { }: {
bounded?: boolean; bounded?: boolean;
children: React.ReactNode; children: React.ReactNode;
@@ -201,11 +205,14 @@ function FloatingWindow({
title: string; title: string;
zIndex?: number; zIndex?: number;
// -- // --
onBlur?: () => void;
onBreakout?: () => void; onBreakout?: () => void;
onCycle?: () => void; onCycle?: () => void;
onFocus?: () => void; onFocus?: () => void;
onBlur?: () => void;
onInteract?: () => void; onInteract?: () => void;
onMinimize?: () => void;
onMaximize?: () => void;
onRestore?: () => void;
}) { }) {
const [reloadKey, setReloadKey] = useState(0); const [reloadKey, setReloadKey] = useState(0);
const [isReloading, setIsReloading] = useState(false); const [isReloading, setIsReloading] = useState(false);
@@ -424,6 +431,8 @@ function FloatingWindow({
}); });
setPosition({ x: 0, y: 0 }); setPosition({ x: 0, y: 0 });
onMaximize?.();
}; };
const minimize = () => { const minimize = () => {
@@ -459,6 +468,8 @@ function FloatingWindow({
}); });
setPosition({ x: left, y: top }); setPosition({ x: left, y: top });
onMinimize?.();
}; };
const restore = () => { const restore = () => {
@@ -480,6 +491,8 @@ function FloatingWindow({
setIsMaximized(false); setIsMaximized(false);
setIsMinimized(false); setIsMinimized(false);
onRestore?.();
}; };
const reload = () => { const reload = () => {
@@ -571,12 +584,14 @@ function FloatingWindow({
})} })}
handleStyles={{ handleStyles={{
bottomLeft: { bottomLeft: {
width: "40px", width: isMinimized || isMaximized ? "0px" : Constants.HandleSize,
height: "40px", height: isMinimized || isMaximized ? "0px" : Constants.HandleSize,
zIndex: 20,
}, },
bottomRight: { bottomRight: {
width: "40px", width: isMinimized || isMaximized ? "0px" : Constants.HandleSize,
height: "40px", height: isMinimized || isMaximized ? "0px" : Constants.HandleSize,
zIndex: 20,
}, },
}} }}
minHeight={Constants.MinHeight} minHeight={Constants.MinHeight}

View File

@@ -127,6 +127,7 @@ function Workspace({
"history", "history",
"infiniteCanvas", "infiniteCanvas",
]); ]);
const [hideControlButtons, setHideControlButtons] = useState(false);
// ---start fya: https://github.com/frontyardart // ---start fya: https://github.com/frontyardart
const hasForLoopNode = nodes.some((node) => node.type === "loop"); const hasForLoopNode = nodes.some((node) => node.type === "loop");
@@ -799,6 +800,15 @@ function Workspace({
onBreakout={handleOnBreakout} onBreakout={handleOnBreakout}
onCycle={handleOnCycle} onCycle={handleOnCycle}
onFocus={() => promote("browserWindow")} onFocus={() => promote("browserWindow")}
onMinimize={() => {
setHideControlButtons(true);
}}
onMaximize={() => {
setHideControlButtons(false);
}}
onRestore={() => {
setHideControlButtons(false);
}}
> >
{activeDebugSession && {activeDebugSession &&
activeDebugSession.browser_session_id && activeDebugSession.browser_session_id &&
@@ -806,7 +816,7 @@ function Workspace({
<BrowserStream <BrowserStream
interactive={false} interactive={false}
browserSessionId={activeDebugSession.browser_session_id} browserSessionId={activeDebugSession.browser_session_id}
showControlButtons={true} showControlButtons={!hideControlButtons}
/> />
) : ( ) : (
<div className="flex h-full w-full flex-col items-center justify-center gap-2 pb-2 pt-4 text-sm text-slate-400"> <div className="flex h-full w-full flex-col items-center justify-center gap-2 pb-2 pt-4 text-sm text-slate-400">