'use client'; import { FC, ReactNode } from 'react'; import Poster from '@/components/Poster'; import Credits from '@/components/Preview/components/Credits'; import useDetails from '@/components/Preview/useDetails'; import { cn } from '@/lib/utils'; import Actions from './components/Actions'; import Airing from './components/Airing'; import YearHint from './components/YearHint'; interface Props { show?: Show & Partial
; showType?: Show['type']; showId?: Show['id']; className?: string; posterClassName?: string; modal?: boolean; poster?: ReactNode; externalLink?: boolean; } const Preview: FC = ({ show: baseShow, showType, showId, className, posterClassName, modal, poster, externalLink = true }) => { const { data: detailedShow } = useDetails({ showId: showId || baseShow?.id, showType: showType || baseShow?.type }); if (!baseShow && !detailedShow) return null; const show: Show & Partial
= (detailedShow || baseShow)!; const isModal = Boolean(modal); return (
{poster || }
{show.title}
{Boolean(show.availability) ? : {new Date(show.release).getFullYear()}} {Boolean(show.airing) && } {Boolean(show.runtime) && ( {show.runtime} minutes )} {Boolean(show.genres) && ( {show.genres ?.slice(0, 3) .map(({ name }) => name) .join(' | ')} )}

{show.overview}

); }; export default Preview;