feat: series
This commit is contained in:
1 parent
b2eef6c494
commit
1e31520c92
25 files changed
+435
-223
No files matched your search
@@ -10,14 +10,15 @@ import ToggleTrailer from '../../components/Trailer';
|
||||
interface Props {
|
||||
movie: Movie;
|
||||
onClose?: () => void;
|
||||
type?: ShowType;
|
||||
}
|
||||
|
||||
export default function Actions({ onClose, movie }: Props) {
|
||||
export default function Actions({ onClose, movie, type }: Props) {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<>
|
||||
<ToggleTrailer movieId={movie?.id}>
|
||||
<ToggleTrailer type={type} movieId={movie?.id}>
|
||||
{({ onPlay, disabled }) => (
|
||||
<Button className='h-8 flex-grow w-[50%]' onClick={onPlay} disabled={disabled}>
|
||||
Trailer
|
||||
@@ -26,14 +27,21 @@ export default function Actions({ onClose, movie }: Props) {
|
||||
</ToggleTrailer>
|
||||
<Button
|
||||
className='h-8 flex-grow w-[50%]'
|
||||
onClick={() => showTorrentsModal({ title: movie.title, year: new Date(movie.release_date).getFullYear() })}
|
||||
onClick={() =>
|
||||
showTorrentsModal({
|
||||
title: movie?.name || movie.title,
|
||||
year: new Date(movie.first_air_date || movie.release_date).getFullYear()
|
||||
})
|
||||
}
|
||||
>
|
||||
Torrents
|
||||
</Button>
|
||||
<Button
|
||||
className='h-8 flex-grow w-[50%]'
|
||||
onClick={() => {
|
||||
router.push(`/similar?movieId=${movie.id}&title=${encodeURIComponent(movie.title)}`);
|
||||
router.push(
|
||||
`/similar?movieId=${movie.id}&title=${encodeURIComponent(movie?.name || movie.title)}&type=${type}`
|
||||
);
|
||||
onClose?.();
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -19,9 +19,10 @@ interface Props {
|
||||
onClose?: () => void;
|
||||
children?: ReactNode;
|
||||
card?: ReactNode;
|
||||
type?: ShowType;
|
||||
}
|
||||
|
||||
const Preview: FC<Props> = ({ movie, className, onClose, children, card, fit }) => {
|
||||
const Preview: FC<Props> = ({ movie, className, onClose, children, card, fit, type = 'movie' }) => {
|
||||
if (!movie) return null;
|
||||
|
||||
return (
|
||||
@@ -35,7 +36,7 @@ const Preview: FC<Props> = ({ movie, className, onClose, children, card, fit })
|
||||
<div className='flex flex-col grow'>
|
||||
{children && <div className='flex hover-none:hidden w-full max-sm:mb-0 mb-2 gap-2'>{children}</div>}
|
||||
<div className='flex w-full gap-2'>
|
||||
<Actions movie={movie} onClose={onClose} />
|
||||
<Actions type={type} movie={movie} onClose={onClose} />
|
||||
</div>
|
||||
<Separator className='my-2' />
|
||||
<p key={movie.id} className='leading-7'>
|
||||
@@ -43,15 +44,16 @@ const Preview: FC<Props> = ({ movie, className, onClose, children, card, fit })
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Credits movieId={movie.id} onPersonClick={onClose} />
|
||||
<Credits type={type} movieId={movie.id} onPersonClick={onClose} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const showPreviewModal = create(({ onResolve, onClose, movie }: Props & InstanceProps<void>) => (
|
||||
export const showPreviewModal = create(({ onResolve, onClose, movie, type = 'movie' }: Props & InstanceProps<void>) => (
|
||||
<Modal className='block p-0' onClose={onResolve}>
|
||||
<Preview
|
||||
fit
|
||||
type={type}
|
||||
movie={movie}
|
||||
className='border-none'
|
||||
onClose={() => {
|
||||
|
||||
Reference in new issue
Block a user