// ─── SENES MEDIA · Project Detail Overlay ────────────────────────── // Fullscreen modal that opens when a project card is clicked. // Renders the project header + a vertical gallery of all images. function ProjectDetail({ project, onClose }) { const scrollRef = React.useRef(null); const [allProjects] = React.useState(window.SENES_DATA.projects); const [lightbox, setLightbox] = React.useState(-1); // -1 closed, else image index React.useEffect(() => { if (!project) return; document.body.style.overflow = "hidden"; const onKey = (e) => { if (e.key === "Escape") { if (lightbox >= 0) setLightbox(-1); else onClose(); } if (lightbox >= 0 && project) { if (e.key === "ArrowLeft") setLightbox((i) => (i - 1 + project.images.length) % project.images.length); if (e.key === "ArrowRight") setLightbox((i) => (i + 1) % project.images.length); } }; window.addEventListener("keydown", onKey); return () => { document.body.style.overflow = ""; window.removeEventListener("keydown", onKey); }; }, [project, onClose, lightbox]); // Reset scroll + lightbox on project change React.useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = 0; setLightbox(-1); }, [project?.id]); if (!project) return null; const idx = allProjects.findIndex((p) => p.id === project.id); const prev = idx > 0 ? allProjects[idx - 1] : null; const next = idx < allProjects.length - 1 ? allProjects[idx + 1] : null; return (
{project.description}
{project.brief}