From 8772989b2e08c93f3879f74344ba0ecc322b9e9a Mon Sep 17 00:00:00 2001 From: Naina Bhatnagar Date: Sun, 24 May 2026 17:48:45 +0000 Subject: [PATCH 1/2] fix: fix errors and repetitive variable declarations in page.tsx (#93) --- app/page.tsx | 56 ---------------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 0cffb45..8a6ae4f 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -225,62 +225,6 @@ export default function CodeEditor() { } }; -const containerRef = useRef(null) -const previewRef = useRef(null) -const [isMobile, setIsMobile] = useState(false) - -useEffect(() => { - const updateIsMobile = () => { - setIsMobile(window.innerWidth < 768) - } - - updateIsMobile() - window.addEventListener("resize", updateIsMobile) - - return () => { - window.removeEventListener("resize", updateIsMobile) - } -}, []) - -const handleDragStart = () => { - isDragging.current = true; - setIsResizing(true); - document.body.style.userSelect = "none"; -}; - -const handleDragMove = useCallback((clientX: number, clientY: number) => { - if (!isDragging.current || !containerRef.current) return; - - const rect = containerRef.current.getBoundingClientRect(); - - let newRatio; - if (isMobile) { - newRatio = ((clientY - rect.top) / rect.height) * 100; - } else { - newRatio = ((clientX - rect.left) / rect.width) * 100; - } - - const clampedRatio = Math.max(20, Math.min(80, newRatio)); - setSplitRatio(clampedRatio); -}, [isMobile]); - -const handleMouseMove = useCallback((e: globalThis.MouseEvent) => { - handleDragMove(e.clientX, e.clientY); -}, [handleDragMove]); - -const handleTouchMove = useCallback((e: globalThis.TouchEvent) => { - if (isDragging.current) { - handleDragMove(e.touches[0].clientX, e.touches[0].clientY); - } -}, [handleDragMove]); - -const handleDragEnd = useCallback(() => { - isDragging.current = false; - setIsResizing(false); - document.body.style.userSelect = "auto"; - document.body.style.cursor = "default"; -}, []); - // Tracks which template is currently active const [isMobile, setIsMobile] = useState(false) From 835ca99486e31561ab6e8ae4f4d085a5ae1a3be1 Mon Sep 17 00:00:00 2001 From: Naina Bhatnagar Date: Sun, 24 May 2026 18:07:06 +0000 Subject: [PATCH 2/2] fix: remove unused handleFullscreenToggle function to fix build error --- app/page.tsx | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 8a6ae4f..a751089 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -199,31 +199,31 @@ export default function CodeEditor() { }; }, []); - const handleFullscreenToggle = async () => { - try { - if (document.fullscreenElement) { - if (document.exitFullscreen) { - await document.exitFullscreen(); - } - return; - } - - if (isFullscreen) { - setIsFullscreen(false); - return; - } - - if (containerRef.current?.requestFullscreen) { - await containerRef.current.requestFullscreen(); - return; - } - - setIsFullscreen(true); - } catch (err) { - console.error("Error attempting to toggle fullscreen:", err); - setIsFullscreen((prev) => !prev); - } - }; + // const handleFullscreenToggle = async () => { + // try { + // if (document.fullscreenElement) { + // if (document.exitFullscreen) { + // await document.exitFullscreen(); + // } + // return; + // } + + // if (isFullscreen) { + // setIsFullscreen(false); + // return; + // } + + // if (containerRef.current?.requestFullscreen) { + // await containerRef.current.requestFullscreen(); + // return; + // } + + // setIsFullscreen(true); + // } catch (err) { + // console.error("Error attempting to toggle fullscreen:", err); + // setIsFullscreen((prev) => !prev); + // } + // }; // Tracks which template is currently active