import { useState } from "react"; import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog"; import type { TmdbVideo } from "@/types"; /** Plays an entry's stored TMDB YouTube videos; trailers come first. */ export function TrailerDialog({ open, onOpenChange, title, videos, }: { open: boolean; onOpenChange: (open: boolean) => void; title: string; videos: TmdbVideo[]; }) { const [activeKey, setActiveKey] = useState(videos[0]?.key); const active = videos.find((v) => v.key === activeKey) ?? videos[0]; return ( {title} ยท {active?.name} {active && (