componentize window; add buttons (#2943)

This commit is contained in:
Jonathan Dobson
2025-07-14 17:01:02 -04:00
committed by GitHub
parent c12e2618d4
commit 758fb14663

View File

@@ -1,5 +1,9 @@
/** /**
* A draggable, resizable, floating window. * A draggable, resizable, floating window.
*
* NOTE: there is copious use of flushSync; see TODOs. We will need to remove
* this. (We can build our own windowing from scratch, sans `react-draggable`
* and `re-resizable`; but I don't want to do that until it's worth the effort.)
*/ */
import { Resizable } from "re-resizable"; import { Resizable } from "re-resizable";
@@ -13,7 +17,6 @@ import {
import { flushSync } from "react-dom"; import { flushSync } from "react-dom";
import Draggable from "react-draggable"; import Draggable from "react-draggable";
import { useDebugStore } from "@/store/useDebugStore";
import { cn } from "@/util/utils"; import { cn } from "@/util/utils";
type OS = "Windows" | "macOS" | "Linux" | "Unknown"; type OS = "Windows" | "macOS" | "Linux" | "Unknown";
@@ -95,8 +98,6 @@ function FloatingWindow({
children: React.ReactNode; children: React.ReactNode;
title: string; title: string;
}) { }) {
const debugStore = useDebugStore();
const isDebugMode = debugStore.isDebugMode;
const [position, setPosition] = useState({ x: 0, y: 0 }); const [position, setPosition] = useState({ x: 0, y: 0 });
const [size, setSize] = useState({ const [size, setSize] = useState({
left: 0, left: 0,
@@ -333,7 +334,7 @@ function FloatingWindow({
}; };
}, [isMaximized]); }, [isMaximized]);
return !isDebugMode ? null : ( return (
<div <div
ref={parentRef} ref={parentRef}
style={{ style={{