// MARA — Cinema modal + VideoCard com hover preview Vimeo
// Carrega DEPOIS de shared.jsx
// ---- Cinema modal (Vimeo player full-screen com chrome de cinema) ----
function CinemaModal({ project, onClose }) {
React.useEffect(() => {
const onKey = (e) => { if (e.key === "Escape") onClose(); };
document.addEventListener("keydown", onKey);
document.body.style.overflow = "hidden";
return () => {
document.removeEventListener("keydown", onKey);
document.body.style.overflow = "";
};
}, [onClose]);
if (!project) return null;
const id = project.vimeoId;
return (
e.stopPropagation()}>
● NOW PLAYING
{project.client} · {project.year}
{id ? (
) : (
VIMEO ID NÃO CONFIGURADO
js/projects.js → "{project.slug}".vimeoId
)}
{project.title}
{project.services || project.category}
);
}
// ---- VideoCard: still + hover preview Vimeo (se houver) + click abre modal ----
function VideoCard({ project, tone = 0, aspect = "16/10", timecode, onPlay }) {
const [hover, setHover] = React.useState(false);
const previewId = project && project.vimeoPreview;
return (
setHover(true)}
onMouseLeave={() => setHover(false)}
onClick={(e) => { e.preventDefault(); onPlay && onPlay(project); }}
style={{ cursor: "pointer" }}
>
{previewId && hover && (
)}
);
}
// ---- Hook pra usar o modal globalmente ----
function useCinemaModal() {
const [active, setActive] = React.useState(null);
const open = React.useCallback((p) => setActive(p), []);
const close = React.useCallback(() => setActive(null), []);
return { active, open, close };
}
Object.assign(window, { CinemaModal, VideoCard, useCinemaModal });