"use client"; import { useEffect, useRef, useState } from "react"; /** * SVGNest panel – same-origin iframe wrapper. * Renders /public/svgnest/index.html in an isolated doc so the legacy app can * own the DOM/CSS/JS without conflicting with Next.js styles or scripts. */ export default function SVGNestPanel() { const iframeRef = useRef(null); const [ready, setReady] = useState(false); const [err, setErr] = useState(null); // Basic load/error status for UX useEffect(() => { const el = iframeRef.current; if (!el) return; const onLoad = () => setReady(true); const onError = () => setErr("Failed to load /svgnest/index.html"); el.addEventListener("load", onLoad); el.addEventListener("error", onError); return () => { el.removeEventListener("load", onLoad); el.removeEventListener("error", onError); }; }, []); return (
{!ready && !err && (
Loading SVGnest…
)} {err && (
Couldn’t load SVGnest: {err}
)} {/* Same-origin iframe, no sandbox to allow drag/drop, file dialogs, workers, etc. */}