"use client"; import { useEffect, useState } from "react"; import { ArrowLeft, ArrowRight, X } from "lucide-react"; export type GroupShot = { id: string; title: string; url: string; type: "image" | "video"; }; export function GroupStoryboardPreview({ shots, onOrder, onClose, }: { shots: GroupShot[]; onOrder: (ids: string[]) => void; onClose: () => void; }) { const [index, setIndex] = useState(0), shot = shots[Math.min(index, shots.length - 1)]; useEffect(() => { const key = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); }; window.addEventListener("keydown", key); return () => window.removeEventListener("keydown", key); }, [onClose]); if (!shot) return null; const move = (delta: number) => { const next = index + delta; if (next < 0 || next >= shots.length) return; const ids = shots.map((s) => s.id); [ids[index], ids[next]] = [ids[next], ids[index]]; onOrder(ids); setIndex(next); }; return (