diff --git a/AppImage/components/terminal-panel.tsx b/AppImage/components/terminal-panel.tsx index e03b8d7..ac6ca9b 100644 --- a/AppImage/components/terminal-panel.tsx +++ b/AppImage/components/terminal-panel.tsx @@ -134,7 +134,7 @@ const proxmoxCommands = [ export const TerminalPanel: React.FC = ({ websocketUrl, onClose }) => { const [terminals, setTerminals] = useState([]) const [activeTerminalId, setActiveTerminalId] = useState("") - const [layout, setLayout] = useState<"single" | "vertical" | "horizontal" | "grid">("single") + const [layout, setLayout] = useState<"single" | "grid">("single") const [isMobile, setIsMobile] = useState(false) const [terminalHeight, setTerminalHeight] = useState(500) // altura por defecto en px const [isResizing, setIsResizing] = useState(false) @@ -175,11 +175,11 @@ export const TerminalPanel: React.FC = ({ websocketUrl, onCl [isMobile, terminalHeight], ) - const handleResizeMove = useCallback( + const handleMouseMove = useCallback( (e: MouseEvent) => { if (!isResizing) return - const deltaY = resizeStartY.current - e.clientY + const deltaY = e.clientY - resizeStartY.current const newHeight = Math.max(200, Math.min(1200, resizeStartHeight.current + deltaY)) setTerminalHeight(newHeight) }, @@ -194,14 +194,14 @@ export const TerminalPanel: React.FC = ({ websocketUrl, onCl useEffect(() => { if (isResizing) { - document.addEventListener("mousemove", handleResizeMove) + document.addEventListener("mousemove", handleMouseMove) document.addEventListener("mouseup", handleResizeEnd) return () => { - document.removeEventListener("mousemove", handleResizeMove) + document.removeEventListener("mousemove", handleMouseMove) document.removeEventListener("mouseup", handleResizeEnd) } } - }, [isResizing, handleResizeMove, handleResizeEnd]) + }, [isResizing, handleMouseMove, handleResizeEnd]) useEffect(() => { if (terminals.length === 0) { @@ -538,8 +538,7 @@ export const TerminalPanel: React.FC = ({ websocketUrl, onCl const getLayoutClass = () => { const count = terminals.length if (isMobile || count === 1) return "grid grid-cols-1" - if (layout === "vertical" || count === 2) return "grid grid-cols-2" - if (layout === "horizontal") return "grid grid-rows-2" + if (layout === "single") return "grid grid-cols-1" if (layout === "grid" || count >= 3) return "grid grid-cols-2 grid-rows-2" return "grid grid-cols-1" } @@ -562,26 +561,20 @@ export const TerminalPanel: React.FC = ({ websocketUrl, onCl {!isMobile && terminals.length > 1 && ( <> -