refactor: clean code and remove unnecessary dependencies
This commit is contained in:
1 parent
eceae6fec7
commit
ebf599eed6
92 files changed
+1152
-2842
No files matched your search
@@ -0,0 +1,46 @@
|
||||
'use client';
|
||||
|
||||
import Link from 'next/link';
|
||||
|
||||
import showTorrentsModal from '@/components/Show/components/Torrents';
|
||||
import ToggleTrailer from '@/components/Show/components/Trailer';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
interface Props {
|
||||
show: Show;
|
||||
onClose?: () => void;
|
||||
}
|
||||
|
||||
const Actions = ({ onClose, show }: Props) => (
|
||||
<>
|
||||
<ToggleTrailer showType={show.type} showId={show.id}>
|
||||
{({ onPlay, disabled }) => (
|
||||
<Button className='h-8 flex-grow w-[50%]' onClick={onPlay} disabled={disabled}>
|
||||
Trailer
|
||||
</Button>
|
||||
)}
|
||||
</ToggleTrailer>
|
||||
<Button
|
||||
className='h-8 flex-grow w-[50%]'
|
||||
onClick={() =>
|
||||
showTorrentsModal({
|
||||
showId: show.id,
|
||||
showType: show.type,
|
||||
title: show.title,
|
||||
year: new Date(show.release).getFullYear()
|
||||
})
|
||||
}
|
||||
>
|
||||
Torrents
|
||||
</Button>
|
||||
<Link
|
||||
className='flex w-[50%]'
|
||||
href={`/similar?id=${show.id}&title=${encodeURIComponent(show.title)}&type=${show.type}`}
|
||||
onClick={onClose}
|
||||
>
|
||||
<Button className='h-8 flex-grow'>Similar</Button>
|
||||
</Link>
|
||||
</>
|
||||
);
|
||||
|
||||
export default Actions;
|
||||
Reference in new issue
Block a user