-
- {trailer && (
- setIsShowTrailer(true)}
- title='Play trailer'
- className='absolute w-full h-full left-0 top-0 bg-black cursor-pointer overflow-hidden rounded-lg transition-opacity opacity-0 hover:opacity-70 flex items-center justify-center'
- >
-
-
- )}
-
-
-
-
-
-
-
-
{movie.overview}
+
+
+
+
+
+
+ {trailer && (
+ showTrailerModal({ trailerKey: trailer?.key })}
+ title='Play trailer'
+ className='absolute w-full h-full left-0 top-0 bg-black cursor-pointer overflow-hidden rounded-lg transition-opacity opacity-0 hover:opacity-70 flex items-center justify-center'
+ >
+
+
+ )}
+
+
+
+
+
+
+
+
+
+
+ {movie.overview}
+
-
onClose?.()} />
- {isShowTrailer &&
setIsShowTrailer(false)} />}
- {isShowTorrents && setIsShowTorrents(false)} />}
- >
+ onClose?.()} />
+
);
};
diff --git a/components/Movie/components/Credits/index.tsx b/components/Movie/components/Credits/index.tsx
index d90d327..fe8de34 100644
--- a/components/Movie/components/Credits/index.tsx
+++ b/components/Movie/components/Credits/index.tsx
@@ -1,4 +1,5 @@
import { FC } from 'react';
+import { motion } from 'framer-motion';
import { User2 } from 'lucide-react';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
@@ -10,6 +11,23 @@ interface Props {
onPersonClick?: (id: string) => void;
}
+const container = {
+ hidden: {},
+ visible: {
+ transition: {
+ staggerChildren: 0.15
+ }
+ }
+};
+
+const item = {
+ hidden: { x: -20, opacity: 0 },
+ visible: {
+ x: 0,
+ opacity: 1
+ }
+};
+
const Credits: FC
= ({ movieId, onPersonClick }) => {
const router = useRouter();
const { data: credits } = useCredits({ movieId });
@@ -17,12 +35,13 @@ const Credits: FC = ({ movieId, onPersonClick }) => {
return (
Boolean(credits?.length) && (
-
+
{credits?.map((actor) => (
- - {
+ onTap={() => {
router.push(`/top?starring=${actor.id}&title=${encodeURIComponent(actor.name)}`);
onPersonClick?.(actor.id.toString());
}}
@@ -47,9 +66,9 @@ const Credits: FC = ({ movieId, onPersonClick }) => {
)}
{actor.name}
-
+
))}
-
+
)
);
diff --git a/components/Movie/components/Rating/index.tsx b/components/Movie/components/Rating/index.tsx
index e0477a1..8991c00 100644
--- a/components/Movie/components/Rating/index.tsx
+++ b/components/Movie/components/Rating/index.tsx
@@ -1,4 +1,5 @@
import { FC } from 'react';
+import { motion } from 'framer-motion';
import { Heart, Star } from 'lucide-react';
import useFavorites, { useFavoritesMutation } from '@/app/(site)/favorites/useFavorites';
@@ -16,8 +17,8 @@ const Rating: FC
= ({ movie, iconsFillColor = 'fill-accent-foreground' })
return (
- {
+ {
event.stopPropagation();
isFavorite ? remove(movie.id) : add(movie);
@@ -26,7 +27,7 @@ const Rating: FC = ({ movie, iconsFillColor = 'fill-accent-foreground' })
title={isFavorite ? 'Remove from favorites' : 'Add to favorite'}
>
-
+
{movie.vote_average?.toFixed(1)}
diff --git a/components/Movie/components/Torrents/index.tsx b/components/Movie/components/Torrents/index.tsx
index 16e50e7..0017765 100644
--- a/components/Movie/components/Torrents/index.tsx
+++ b/components/Movie/components/Torrents/index.tsx
@@ -1,18 +1,18 @@
import React, { Dispatch, FC, SetStateAction, useState } from 'react';
+import { create, InstanceProps } from 'react-modal-promise';
import { ArrowDownIcon, CaretSortIcon } from '@radix-ui/react-icons';
-import { useAtom } from 'jotai';
+import { useAtom, useAtomValue } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
import { Cast, Loader, Magnet } from 'lucide-react';
import useTorrents from '@/app/(site)/useTorrents';
import { ORDER } from '@/app/api/torrents/parsers/pirate-bay';
-import { Dialog, DialogContent } from '@/components/ui/dialog';
+import { Modal } from '@/components/ui/dialog';
import { Input } from '@/components/ui/input';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
-interface Props {
+interface Props extends InstanceProps {
title: string;
- onClose: () => void;
}
type Sorting = {
@@ -49,9 +49,23 @@ const TableHeadSortable = ({
const hostAtom = atomWithStorage('magnet-host', '');
-const Torrents: FC = ({ title, onClose }) => {
+const showHostManagerModal = create(({ onResolve, isOpen }) => {
const [host, setHost] = useAtom(hostAtom);
- const [isShowHostInput, setIsShowHostInput] = useState(false);
+ return (
+ onResolve()}>
+ setHost(value)}
+ onKeyDown={({ key }) => key === 'Enter' && onResolve()}
+ />
+
+ );
+});
+
+const Torrents: FC = ({ title, isOpen, onResolve }) => {
+ const host = useAtomValue(hostAtom);
const [sorting, setSorting] = useState({ by: ORDER.seeders });
const { data: torrents, isLoading, isFetched } = useTorrents({ query: title, order: sorting.by });
@@ -64,81 +78,68 @@ const Torrents: FC = ({ title, onClose }) => {
};
return (
-