diff --git a/packages/studio/src/App.tsx b/packages/studio/src/App.tsx index 63fd5db1f..cb790ece7 100644 --- a/packages/studio/src/App.tsx +++ b/packages/studio/src/App.tsx @@ -16,12 +16,6 @@ interface EditingFile { content: string | null; } -interface ProjectEntry { - id: string; - title?: string; - sessionId?: string; -} - interface LintFinding { severity: "error" | "warning"; message: string; @@ -29,8 +23,6 @@ interface LintFinding { fixHint?: string; } -import { ExpandOnHover } from "./components/ui/ExpandOnHover"; - // ── Media file detection and preview ── const IMAGE_EXT = /\.(jpg|jpeg|png|gif|webp|svg|ico)$/i; @@ -122,246 +114,6 @@ function MediaPreview({ projectId, filePath }: { projectId: string; filePath: st ); } -// ── Project Card with hover-to-preview ── - -function ExpandedPreviewIframe({ src }: { src: string }) { - const containerRef = useRef(null); - const iframeRef = useRef(null); - const [dims, setDims] = useState({ w: 1920, h: 1080 }); - const [scale, setScale] = useState(1); - - // Recalculate scale when container resizes or dims change. - // Note: useEffect with [dims] dep — syncs with ResizeObserver (external system). - // eslint-disable-next-line no-restricted-syntax - useEffect(() => { - const el = containerRef.current; - if (!el) return; - const update = () => { - const cw = el.clientWidth; - const ch = el.clientHeight; - // Fit the composition inside the container (contain, not cover) - const s = Math.min(cw / dims.w, ch / dims.h); - setScale(s); - }; - update(); - const ro = new ResizeObserver(update); - ro.observe(el); - return () => ro.disconnect(); - }, [dims]); - - // After iframe loads: detect composition dimensions, seek, and play - const handleLoad = useCallback(() => { - const iframe = iframeRef.current; - if (!iframe) return; - let attempts = 0; - const interval = setInterval(() => { - try { - const doc = iframe.contentDocument; - if (doc) { - const comp = doc.querySelector("[data-composition-id]") as HTMLElement | null; - if (comp) { - const w = parseInt(comp.getAttribute("data-width") ?? "0", 10); - const h = parseInt(comp.getAttribute("data-height") ?? "0", 10); - if (w > 0 && h > 0) setDims({ w, h }); - } - } - const win = iframe.contentWindow as Window & { - __player?: { seek: (t: number) => void; play: () => void }; - }; - if (win?.__player) { - win.__player.seek(2); - win.__player.play(); - clearInterval(interval); - } - } catch { - /* cross-origin */ - } - if (++attempts > 25) clearInterval(interval); - }, 200); - }, []); - - // Center the scaled iframe - const offsetX = containerRef.current - ? (containerRef.current.clientWidth - dims.w * scale) / 2 - : 0; - const offsetY = containerRef.current - ? (containerRef.current.clientHeight - dims.h * scale) / 2 - : 0; - - return ( -
-