From 14a8e81b992e9a05f7bb9f93d68d3f6802b7937c Mon Sep 17 00:00:00 2001 From: "[Valentino Heman Budiarto]" <[hemanvalentino@gmail.com]> Date: Tue, 13 Oct 2026 14:33:20 +0700 Subject: [PATCH] . --- app/page.tsx | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index a21506e..d651878 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -2,23 +2,16 @@ import { useState, useEffect, useRef } from 'react'; -// ============================================================ -// HELPER -// ============================================================ const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); -// ============================================================ // KONFIGURASI -// ============================================================ const RECORD_INTERVAL_MS = 50; const DIRECTION_BRAKE_MS = 600; const MAX_STEP_TIMEOUT_MS = 15000; const LATENCY_COMPENSATION_TICKS = 3; -// ============================================================ // TYPE -// ============================================================ type Steering = { x: number; y: number; @@ -50,7 +43,7 @@ export default function RobotDashboard() { const [ticks, setTicks] = useState({ l: 0, r: 0 }); const [isRecordingUI, setIsRecordingUI] = useState(false); const [isPlayingUI, setIsPlayingUI] = useState(false); - const [isFullscreen, setIsFullscreen] = useState(false); // State Fullscreen + const [isFullscreen, setIsFullscreen] = useState(false); const currentTicksRef = useRef({ l: 0, r: 0 }); const lastRecordedTicksRef = useRef({ l: 0, r: 0 }); @@ -253,7 +246,7 @@ export default function RobotDashboard() { } }; - // Fungsi Full-Screen + // Full-Screen const enterFullscreen = () => { const elem = document.documentElement; if (elem.requestFullscreen) { @@ -268,7 +261,6 @@ export default function RobotDashboard() { }; useEffect(() => { - // Sinkronisasi status fullscreen dari sistem const handleFullscreenChange = () => { setIsFullscreen(!!document.fullscreenElement); }; @@ -329,7 +321,6 @@ export default function RobotDashboard() { currentY = (keysRef.current.down ? 1 : 0) - (keysRef.current.up ? 1 : 0); currentX = (keysRef.current.right ? 1 : 0) - (keysRef.current.left ? 1 : 0); } else if (controlMode === 'touch' || isFullscreen) { - // Kontrol layar sentuh aktif baik di mode touch biasa maupun fullscreen currentX = touchStateRef.current.turn; currentY = touchStateRef.current.throttle; } @@ -442,7 +433,7 @@ export default function RobotDashboard() {
- {/* KOLOM KIRI (KAMERA & TOUCH CONTROLLER) */} + {/* (KAMERA & TOUCH CONTROLLER) */}
@@ -450,7 +441,7 @@ export default function RobotDashboard() {

Live Feed

- {/* TOMBOL PEMICU FULL-SCREEN */} + {/* TOMBOL FULL-SCREEN */}
- {/* eslint-disable-next-line @next/next/no-img-element */} + Robot view { e.currentTarget.style.display = 'none'; }} />
- {/* DUAL-PAD SPLIT CONTROLLER UI BAWAAN */} + {/* DUAL-PAD */} {controlMode === 'touch' && (
@@ -603,8 +594,6 @@ export default function RobotDashboard() { {isFullscreen && (
- {/* Live Feed Video Background */} - {/* eslint-disable-next-line @next/next/no-img-element */} Robot Fullscreen { e.currentTarget.style.display = 'none'; }} /> - {/* Tombol Keluar (Pojok Kanan Atas) */} - {/* Tombol Bawah (Simpan) */} + {/*(Simpan) */} - {/* Tombol Kiri (Play Rev) */} + {/*(Play Rev) */} - {/* Tombol Kanan (Play Fwd) */} + {/*(Play Fwd) */}
- {/* KANAN: Tombol Atas & Bawah (Throttle) */} + {/* KANAN: Tombol Atas & Bawah */}