mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-12-13 23:56:47 +00:00
Update script-terminal-modal.tsx
This commit is contained in:
@@ -68,9 +68,6 @@ export function ScriptTerminalModal({
|
||||
const [isResizing, setIsResizing] = useState(false)
|
||||
const resizeBarRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
// Debug visual para tablets
|
||||
const [debugInfo, setDebugInfo] = useState<string[]>([])
|
||||
|
||||
const terminalContainerRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
const sendKey = useCallback((key: string) => {
|
||||
@@ -391,10 +388,6 @@ export function ScriptTerminalModal({
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
const debugMsg = `[${new Date().toLocaleTimeString()}] Resize start - Type: ${e.type}, isMobile: ${isMobile}, isTablet: ${isTablet}`
|
||||
console.log(debugMsg)
|
||||
setDebugInfo(prev => [...prev.slice(-4), debugMsg])
|
||||
|
||||
setIsResizing(true)
|
||||
|
||||
// Detectar si es touch o mouse
|
||||
@@ -402,27 +395,11 @@ export function ScriptTerminalModal({
|
||||
const startY = clientY
|
||||
const startHeight = modalHeight
|
||||
|
||||
const debugMsg2 = `Start Y: ${startY}, Start height: ${startHeight}`
|
||||
console.log(debugMsg2)
|
||||
setDebugInfo(prev => [...prev.slice(-4), debugMsg2])
|
||||
|
||||
let lastY = startY
|
||||
let moveCount = 0
|
||||
|
||||
const handleMove = (moveEvent: MouseEvent | TouchEvent) => {
|
||||
moveEvent.preventDefault()
|
||||
moveEvent.stopPropagation()
|
||||
|
||||
const currentY = "touches" in moveEvent ? moveEvent.touches[0].clientY : moveEvent.clientY
|
||||
const deltaY = currentY - startY
|
||||
const newHeight = Math.max(300, Math.min(window.innerHeight - 100, startHeight + deltaY))
|
||||
|
||||
moveCount++
|
||||
if (moveCount % 5 === 0) {
|
||||
console.log(`Move #${moveCount} - currentY: ${currentY}, deltaY: ${deltaY}, newHeight: ${newHeight}`)
|
||||
}
|
||||
|
||||
lastY = currentY
|
||||
setModalHeight(newHeight)
|
||||
|
||||
if (fitAddonRef.current && termRef.current && wsRef.current?.readyState === WebSocket.OPEN) {
|
||||
@@ -442,26 +419,20 @@ export function ScriptTerminalModal({
|
||||
}
|
||||
|
||||
const handleEnd = () => {
|
||||
const debugMsg3 = `Resize end - Final height: ${modalHeight}, Total moves: ${moveCount}, Last Y: ${lastY}`
|
||||
console.log(debugMsg3)
|
||||
setDebugInfo(prev => [...prev.slice(-4), debugMsg3])
|
||||
|
||||
setIsResizing(false)
|
||||
|
||||
document.removeEventListener("mousemove", handleMove as any, false)
|
||||
document.removeEventListener("mouseup", handleEnd, false)
|
||||
document.removeEventListener("touchmove", handleMove as any, false)
|
||||
document.removeEventListener("touchend", handleEnd, false)
|
||||
document.removeEventListener("touchcancel", handleEnd, false)
|
||||
document.removeEventListener("mousemove", handleMove as any)
|
||||
document.removeEventListener("mouseup", handleEnd)
|
||||
document.removeEventListener("touchmove", handleMove as any)
|
||||
document.removeEventListener("touchend", handleEnd)
|
||||
|
||||
localStorage.setItem("scriptModalHeight", modalHeight.toString())
|
||||
}
|
||||
|
||||
document.addEventListener("mousemove", handleMove as any, false)
|
||||
document.addEventListener("mouseup", handleEnd, false)
|
||||
document.addEventListener("touchmove", handleMove as any, { passive: false, capture: false })
|
||||
document.addEventListener("touchend", handleEnd, false)
|
||||
document.addEventListener("touchcancel", handleEnd, false)
|
||||
document.addEventListener("mousemove", handleMove as any)
|
||||
document.addEventListener("mouseup", handleEnd)
|
||||
document.addEventListener("touchmove", handleMove as any, { passive: false })
|
||||
document.addEventListener("touchend", handleEnd)
|
||||
}
|
||||
|
||||
const sendCommand = (command: string) => {
|
||||
@@ -492,15 +463,6 @@ export function ScriptTerminalModal({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Debug panel - solo visible en tablets */}
|
||||
{isTablet && debugInfo.length > 0 && (
|
||||
<div className="bg-yellow-900/50 border-b border-yellow-700 p-2 text-xs font-mono text-yellow-200 max-h-20 overflow-y-auto">
|
||||
{debugInfo.map((info, i) => (
|
||||
<div key={i}>{info}</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="overflow-hidden relative flex-1">
|
||||
<div ref={terminalContainerRef} className="w-full h-full" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user