'use client'; import { FC, ReactNode } from 'react'; import { create, InstanceProps } from 'react-modal-promise'; import useDetails from '@/components/Preview/useDetails'; import Card from '@/components/Show'; import Credits from '@/components/Show/components/Credits'; import { Modal } from '@/components/ui/dialog'; import { Separator } from '@/components/ui/separator'; import { cn } from '@/lib/utils'; import Actions from './components/Actions'; interface Props { show?: Show; className?: string; onClose?: () => void; children?: ReactNode; card?: ReactNode; } const Preview: FC = ({ show: baseShow, className, onClose, children, card }) => { const { data: detailedShow } = useDetails({ showId: baseShow?.id, showType: baseShow?.type }); if (!baseShow) return null; const show: Show & Partial
| undefined = detailedShow || baseShow; return (
{card || }
{children &&
{children}
}

{show.overview}

); }; export const showPreviewModal = create(({ onResolve, onClose, show }: Props & InstanceProps) => ( { window.scrollTo({ top: 0, behavior: 'smooth' }); onClose?.(); onResolve(); }} /> )); export default Preview;