feat: animations

This commit is contained in:
ner committed 2023-12-29 17:18:06 +02:00
1 parent e4788ae384
commit 7b55619cf5
16 files changed
+643 -320

No files matched your search

+21 -3
View File
@@ -1,5 +1,6 @@
'use client'; 'use client';
import { useState } from 'react';
import { useAtom } from 'jotai'; import { useAtom } from 'jotai';
import { atomWithStorage } from 'jotai/utils'; import { atomWithStorage } from 'jotai/utils';
import { ArrowLeft, ArrowRight, SlidersHorizontal } from 'lucide-react'; import { ArrowLeft, ArrowRight, SlidersHorizontal } from 'lucide-react';
@@ -15,12 +16,21 @@ const isShowFilterAtom = atomWithStorage('is-show-filters', false);
export default function Container() { export default function Container() {
const [isShowFilter, setIsShowFilter] = useAtom(isShowFilterAtom); const [isShowFilter, setIsShowFilter] = useAtom(isShowFilterAtom);
const { movie, next, previous, hasPrevious } = useRandomMovie(); const { movie, next, previous, hasPrevious } = useRandomMovie();
const [direction, setDirection] = useState(0);
return ( return (
<> <>
{isShowFilter && <Filter />} {isShowFilter && <Filter />}
<div className='gap-2 flex bg-background mb-2 lg:static max-sm:z-10 max-sm:fixed max-sm:bottom-0 max-sm:left-0 max-sm:w-full max-sm:p-2 max-sm:px-[12px] max-sm:mb-0'> <div className='gap-2 flex bg-background mb-2 lg:static max-sm:z-10 max-sm:fixed max-sm:bottom-0 max-sm:left-0 max-sm:w-full max-sm:p-2 max-sm:px-[12px] max-sm:mb-0'>
<Button className='p-2' onClick={previous} disabled={!hasPrevious} title='Previous movie'> <Button
className='p-2'
onClick={() => {
previous();
setDirection(-1);
}}
disabled={!hasPrevious}
title='Previous movie'
>
<ArrowLeft size={24} strokeWidth={1} /> <ArrowLeft size={24} strokeWidth={1} />
</Button> </Button>
<Button <Button
@@ -31,11 +41,19 @@ export default function Container() {
> >
<SlidersHorizontal size={24} strokeWidth={1} /> <SlidersHorizontal size={24} strokeWidth={1} />
</Button> </Button>
<Button className='w-full p-2 grow' onClick={next} title='Next movie'> <Button
className='w-full p-2 grow'
variant='default'
onClick={() => {
next();
setDirection(1);
}}
title='Next movie'
>
<ArrowRight size={24} strokeWidth={1} /> <ArrowRight size={24} strokeWidth={1} />
</Button> </Button>
</div> </div>
<Movie key={movie?.id} movie={movie} /> <Movie movie={movie} direction={direction} />
<div className='w-full h-2 max-sm:h-20' /> <div className='w-full h-2 max-sm:h-20' />
</> </>
); );
+38 -47
View File
@@ -1,15 +1,15 @@
import { ChangeEvent, useRef, useState } from 'react'; import { ChangeEvent, FC, useRef, useState } from 'react';
import { Search as SearchIcon, XCircle } from 'lucide-react'; import { create, InstanceProps } from 'react-modal-promise';
import { XCircle } from 'lucide-react';
import List from '@/components/Movie/List'; import List from '@/components/Movie/List';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { Dialog, DialogContent } from '@/components/ui/dialog'; import { Modal } from '@/components/ui/dialog';
import { Input } from '@/components/ui/input'; import { Input } from '@/components/ui/input';
import useSearch from './useSearch'; import useSearch from './useSearch';
const Search = () => { const Search: FC<InstanceProps<void>> = ({ isOpen, onResolve }) => {
const [isShow, setIsShow] = useState(false);
const [title, setTitle] = useState(''); const [title, setTitle] = useState('');
const [query, setQuery] = useState(''); const [query, setQuery] = useState('');
const timeout = useRef<NodeJS.Timeout>(); const timeout = useRef<NodeJS.Timeout>();
@@ -31,54 +31,45 @@ const Search = () => {
}; };
const handleClose = () => { const handleClose = () => {
setIsShow(false);
handleReset(); handleReset();
}; };
return ( return (
<> <Modal className='block p-3 max-w-[950px]' isOpen={isOpen} onClose={() => onResolve()}>
<Button variant='outline' size='icon' onClick={() => setIsShow(true)}> <div className='relative'>
<SearchIcon /> <Input
</Button> ref={inputRef}
{isShow && ( autoFocus
<Dialog defaultOpen={true} onOpenChange={handleClose}> placeholder='Start entering title...'
<DialogContent className='block p-3 max-w-[950px]' onClose={() => setIsShow(false)}> value={title}
<div className='relative'> onChange={handleChangeTitle}
<Input className='pr-10'
ref={inputRef} />
autoFocus <Button
placeholder='Start entering title...' variant='outline'
value={title} size='icon'
onChange={handleChangeTitle} onClick={handleReset}
className='pr-10' disabled={!query.length}
/> className='absolute right-0 top-0'
<Button >
variant='outline' <XCircle />
size='icon' </Button>
onClick={handleReset} </div>
disabled={!query.length} {Boolean(results?.pages.length) && (
className='absolute right-0 top-0' <div className='mt-3'>
> <List
<XCircle /> pages={results!.pages}
</Button> fetchNextPage={fetchNextPage}
</div> hasNextPage={hasNextPage}
withBottomGap={false}
{Boolean(results?.pages.length) && ( onPreviewClose={handleClose}
<div className='mt-3'> />
<List </div>
pages={results!.pages}
fetchNextPage={fetchNextPage}
hasNextPage={hasNextPage}
withBottomGap={false}
onPreviewClose={handleClose}
/>
</div>
)}
</DialogContent>
</Dialog>
)} )}
</> </Modal>
); );
}; };
export const showSearchModal = create(Search);
export default Search; export default Search;
+6 -4
View File
@@ -1,7 +1,7 @@
'use client'; 'use client';
import { FC } from 'react'; import { FC } from 'react';
import { Moon, Sun } from 'lucide-react'; import { Moon, Search as SearchIcon, Sun } from 'lucide-react';
import Link from 'next/link'; import Link from 'next/link';
import { usePathname } from 'next/navigation'; import { usePathname } from 'next/navigation';
@@ -10,7 +10,7 @@ import { Button } from '@/components/ui/button';
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { useTheme } from '@/hooks/useTheme'; import { useTheme } from '@/hooks/useTheme';
import Search from './components/Search'; import { showSearchModal } from './components/Search';
const Header: FC = () => { const Header: FC = () => {
const path = usePathname(); const path = usePathname();
@@ -26,7 +26,9 @@ const Header: FC = () => {
<Button variant='outline' size='icon' onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}> <Button variant='outline' size='icon' onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}>
{theme === 'light' ? <Moon /> : <Sun />} {theme === 'light' ? <Moon /> : <Sun />}
</Button> </Button>
<Search /> <Button variant='outline' size='icon' onClick={() => showSearchModal()}>
<SearchIcon />
</Button>
</div> </div>
</div> </div>
<Tabs value={path} className='flex-grow mt-2'> <Tabs value={path} className='flex-grow mt-2'>
@@ -36,7 +38,7 @@ const Header: FC = () => {
['/top', 'Top'], ['/top', 'Top'],
['/favorites', 'Favorites'] ['/favorites', 'Favorites']
].map(([path, label]) => ( ].map(([path, label]) => (
<Link href={path} className='w-full' key={path} prefetch> <Link href={path} className='w-full' key={path}>
<TabsTrigger className='w-full' value={path}> <TabsTrigger className='w-full' value={path}>
{label} {label}
</TabsTrigger> </TabsTrigger>
+45 -22
View File
@@ -1,8 +1,9 @@
import { FC, Fragment, useLayoutEffect, useState } from 'react'; import { FC, Fragment, useLayoutEffect, useState } from 'react';
import { motion } from 'framer-motion';
import Card from '@/components/Movie/Card'; import Card from '@/components/Movie/Card';
import Preview from '@/components/Movie/Preview'; import Preview from '@/components/Movie/Preview';
import { Dialog, DialogContent } from '@/components/ui/dialog'; import { Modal } from '@/components/ui/dialog';
import filterUnknownMovies from '@/lib/filterUnknownMovies'; import filterUnknownMovies from '@/lib/filterUnknownMovies';
interface Props { interface Props {
@@ -13,6 +14,23 @@ interface Props {
onPreviewClose?: () => void; onPreviewClose?: () => void;
} }
const container = {
hidden: {},
visible: {
transition: {
staggerChildren: 0.15
}
}
};
const item = {
hidden: { y: -20, opacity: 0 },
visible: {
y: 0,
opacity: 1
}
};
const List: FC<Props> = ({ pages, hasNextPage, fetchNextPage, withBottomGap = true, onPreviewClose }) => { const List: FC<Props> = ({ pages, hasNextPage, fetchNextPage, withBottomGap = true, onPreviewClose }) => {
const [movie, setMovie] = useState<Movie | null>(null); const [movie, setMovie] = useState<Movie | null>(null);
const [loader, setLoader] = useState<HTMLLIElement>(); const [loader, setLoader] = useState<HTMLLIElement>();
@@ -38,39 +56,44 @@ const List: FC<Props> = ({ pages, hasNextPage, fetchNextPage, withBottomGap = tr
return ( return (
<> <>
<ul className='flex gap-3 flex-wrap justify-center grow'> <motion.ul
className='flex gap-3 flex-wrap justify-center grow'
variants={container}
initial='hidden'
animate='visible'
layout
>
{pages.map((page) => ( {pages.map((page) => (
<Fragment key={page.page}> <Fragment key={page.page}>
{filterUnknownMovies(page.results)?.map((movie, index, array) => ( {filterUnknownMovies(page.results)?.map((movie, index, array) => (
<li <motion.li
key={movie.id} key={movie.id}
variants={item}
className='flex basis-[300px] cursor-pointer' className='flex basis-[300px] cursor-pointer'
onClick={() => setMovie(movie)} onTap={() => setMovie(movie)}
ref={array.length / 2 !== index ? undefined : (element) => setLoader(element!)} ref={array.length / 2 !== index ? undefined : (element) => setLoader(element!)}
> >
<Card movie={movie} className='grow flex flex-col' /> <Card movie={movie} className='grow flex flex-col' />
</li> </motion.li>
))} ))}
</Fragment> </Fragment>
))} ))}
</ul> </motion.ul>
{withBottomGap && <div className='h-4 w-full' />} {withBottomGap && <div className='h-4 w-full' />}
{movie && ( <Modal isOpen={Boolean(movie)} onClose={() => setMovie(null)} className='block p-0'>
<Dialog defaultOpen={true} onOpenChange={(isOpen) => !isOpen && setMovie(null)}> {movie && (
<DialogContent className='block p-0' onClose={() => setMovie(null)}> <Preview
<Preview key={movie.id}
key={movie.id} movie={movie}
movie={movie} className='border-none'
className='border-none' onClose={() => {
onClose={() => { setMovie(null);
setMovie(null); window.scrollTo({ top: 0, behavior: 'smooth' });
window.scrollTo({ top: 0, behavior: 'smooth' }); onPreviewClose?.();
onPreviewClose?.(); }}
}} />
/> )}
</DialogContent> </Modal>
</Dialog>
)}
</> </>
); );
}; };
+70 -41
View File
@@ -1,70 +1,99 @@
import { FC, useState } from 'react'; import { FC } from 'react';
import { AnimatePresence, motion } from 'framer-motion';
import { Play } from 'lucide-react'; import { Play } from 'lucide-react';
import { useRouter } from 'next/navigation'; import { useRouter } from 'next/navigation';
import useTrailer from '@/app/(site)/useTrailer'; import useTrailer from '@/app/(site)/useTrailer';
import Credits from '@/components/Movie/components/Credits'; import Credits from '@/components/Movie/components/Credits';
import Trailer from '@/components/Movie/components/Trailer'; import { showTrailerModal } from '@/components/Movie/components/Trailer';
import { Separator } from '@/components/ui/separator'; import { Separator } from '@/components/ui/separator';
import { Button } from '../ui/button'; import { Button } from '../ui/button';
import Torrents from './components/Torrents'; import { showTorrentsModal } from './components/Torrents';
import Card from './Card'; import Card from './Card';
interface Props { interface Props {
movie?: Movie; movie?: Movie;
className?: string; className?: string;
direction?: number;
onClose?: () => void; onClose?: () => void;
} }
const Preview: FC<Props> = ({ movie, className, onClose }) => { const variants = {
const [isShowTrailer, setIsShowTrailer] = useState(false); enter: (direction: number) => ({
const [isShowTorrents, setIsShowTorrents] = useState(false); scale: 0.8,
opacity: 0,
[direction === 0 ? 'y' : 'x']: direction ? direction * -320 : -100
}),
center: { x: 0, opacity: 1, y: 0, scale: 1 },
exit: (direction: number) => ({ scale: 0.8, opacity: 1, [direction === 0 ? 'y' : 'x']: (direction || -1) * 320 })
};
const Preview: FC<Props> = ({ movie, className, onClose, direction }) => {
const { data: trailer } = useTrailer({ movieId: movie?.id }); const { data: trailer } = useTrailer({ movieId: movie?.id });
const router = useRouter(); const router = useRouter();
if (!movie) return null; if (!movie) return null;
return ( return (
<> <div className={`rounded-xl bg-card text-card-foreground ${className} ${onClose ? 'p-2' : ''}`}>
<div className={`p-3 rounded-xl border bg-card text-card-foreground shadow-sm ${className}`}> <div className='flex flex-col lg:flex-row max-w-[100%] gap-3'>
<div className='flex flex-col lg:flex-row max-w-[100%] gap-3'> <div className='max-w-[300px] min-w-[300px] h-[450px] mx-auto w-[100%] relative overflow-hidden rounded-lg'>
<Card movie={movie} className='max-w-[300px] min-w-[300px] mx-auto w-full'> <AnimatePresence custom={direction}>
{trailer && ( <motion.div
<div className='absolute'
onClick={() => setIsShowTrailer(true)} initial='enter'
title='Play trailer' animate='center'
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' exit='exit'
> key={movie?.id}
<Play size={100} className='fill-white' /> variants={variants}
</div> custom={direction}
)} transition={{ type: 'tween' }}
</Card> >
<div className='flex flex-col grow'> <Card movie={movie} className='max-w-[300px] min-w-[300px] mx-auto w-full'>
<div className='flex w-full gap-2'> {trailer && (
<Button className='h-8 grow' onClick={() => setIsShowTorrents(true)}> <motion.div
Torrents onTap={() => showTrailerModal({ trailerKey: trailer?.key })}
</Button> title='Play trailer'
<Button 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'
className='h-8 grow' >
onClick={() => { <Play size={100} className='fill-white' />
router.push(`/top?similar=${movie.id}&title=${encodeURIComponent(movie.title)}`); </motion.div>
onClose?.(); )}
}} </Card>
> </motion.div>
Similar </AnimatePresence>
</Button> </div>
</div> <div className='flex flex-col grow'>
<Separator className='my-2' /> <div className='flex w-full gap-2'>
<p className='leading-7'>{movie.overview}</p> <Button className='h-8 grow' onClick={() => showTorrentsModal({ title: movie.title })}>
Torrents
</Button>
<Button
className='h-8 grow'
onClick={() => {
router.push(`/top?similar=${movie.id}&title=${encodeURIComponent(movie.title)}`);
onClose?.();
}}
>
Similar
</Button>
</div> </div>
<Separator className='my-2' />
<motion.p
key={movie.id}
className='leading-7'
initial={{ opacity: 0, y: -100 }}
animate={{ y: 0, opacity: 1 }}
exit={{ y: 100, opacity: 0 }}
>
{movie.overview}
</motion.p>
</div> </div>
<Credits movieId={movie.id} onPersonClick={() => onClose?.()} />
</div> </div>
{isShowTrailer && <Trailer trailerKey={trailer?.key} onClose={() => setIsShowTrailer(false)} />} <Credits movieId={movie.id} onPersonClick={() => onClose?.()} />
{isShowTorrents && <Torrents title={movie.title} onClose={() => setIsShowTorrents(false)} />} </div>
</>
); );
}; };
+24 -5
View File
@@ -1,4 +1,5 @@
import { FC } from 'react'; import { FC } from 'react';
import { motion } from 'framer-motion';
import { User2 } from 'lucide-react'; import { User2 } from 'lucide-react';
import Image from 'next/image'; import Image from 'next/image';
import { useRouter } from 'next/navigation'; import { useRouter } from 'next/navigation';
@@ -10,6 +11,23 @@ interface Props {
onPersonClick?: (id: string) => void; 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<Props> = ({ movieId, onPersonClick }) => { const Credits: FC<Props> = ({ movieId, onPersonClick }) => {
const router = useRouter(); const router = useRouter();
const { data: credits } = useCredits({ movieId }); const { data: credits } = useCredits({ movieId });
@@ -17,12 +35,13 @@ const Credits: FC<Props> = ({ movieId, onPersonClick }) => {
return ( return (
Boolean(credits?.length) && ( Boolean(credits?.length) && (
<div className='overflow-auto max-w-[100%] py-3 mb-[-0.75rem]'> <div className='overflow-auto max-w-[100%] py-3 mb-[-0.75rem]'>
<ul className='flex gap-3'> <motion.ul className='flex gap-3' variants={container} initial='hidden' animate='visible' layout>
{credits?.map((actor) => ( {credits?.map((actor) => (
<li <motion.li
variants={item}
key={`${actor.id}_${actor.cast_id}`} key={`${actor.id}_${actor.cast_id}`}
title={actor.name} title={actor.name}
onClick={() => { onTap={() => {
router.push(`/top?starring=${actor.id}&title=${encodeURIComponent(actor.name)}`); router.push(`/top?starring=${actor.id}&title=${encodeURIComponent(actor.name)}`);
onPersonClick?.(actor.id.toString()); onPersonClick?.(actor.id.toString());
}} }}
@@ -47,9 +66,9 @@ const Credits: FC<Props> = ({ movieId, onPersonClick }) => {
)} )}
</div> </div>
<p className='pt-2 overflow-ellipsis whitespace-nowrap overflow-hidden'>{actor.name}</p> <p className='pt-2 overflow-ellipsis whitespace-nowrap overflow-hidden'>{actor.name}</p>
</li> </motion.li>
))} ))}
</ul> </motion.ul>
</div> </div>
) )
); );
+4 -3
View File
@@ -1,4 +1,5 @@
import { FC } from 'react'; import { FC } from 'react';
import { motion } from 'framer-motion';
import { Heart, Star } from 'lucide-react'; import { Heart, Star } from 'lucide-react';
import useFavorites, { useFavoritesMutation } from '@/app/(site)/favorites/useFavorites'; import useFavorites, { useFavoritesMutation } from '@/app/(site)/favorites/useFavorites';
@@ -16,8 +17,8 @@ const Rating: FC<Props> = ({ movie, iconsFillColor = 'fill-accent-foreground' })
return ( return (
<span className='select-none flex w-full items-center ml-auto gap-1 mt-[-8px] justify-between'> <span className='select-none flex w-full items-center ml-auto gap-1 mt-[-8px] justify-between'>
<span <motion.span
onClick={(event) => { onTap={(event) => {
event.stopPropagation(); event.stopPropagation();
isFavorite ? remove(movie.id) : add(movie); isFavorite ? remove(movie.id) : add(movie);
@@ -26,7 +27,7 @@ const Rating: FC<Props> = ({ movie, iconsFillColor = 'fill-accent-foreground' })
title={isFavorite ? 'Remove from favorites' : 'Add to favorite'} title={isFavorite ? 'Remove from favorites' : 'Add to favorite'}
> >
<Heart className={isFavorite ? iconsFillColor : ''} size={20} /> <Heart className={isFavorite ? iconsFillColor : ''} size={20} />
</span> </motion.span>
<span className='flex items-center'> <span className='flex items-center'>
<Star size={18} className={`mr-1 ${iconsFillColor}`} /> <Star size={18} className={`mr-1 ${iconsFillColor}`} />
<span className='font-semibold'>{movie.vote_average?.toFixed(1)}</span> <span className='font-semibold'>{movie.vote_average?.toFixed(1)}</span>
+80 -79
View File
@@ -1,18 +1,18 @@
import React, { Dispatch, FC, SetStateAction, useState } from 'react'; import React, { Dispatch, FC, SetStateAction, useState } from 'react';
import { create, InstanceProps } from 'react-modal-promise';
import { ArrowDownIcon, CaretSortIcon } from '@radix-ui/react-icons'; import { ArrowDownIcon, CaretSortIcon } from '@radix-ui/react-icons';
import { useAtom } from 'jotai'; import { useAtom, useAtomValue } from 'jotai';
import { atomWithStorage } from 'jotai/utils'; import { atomWithStorage } from 'jotai/utils';
import { Cast, Loader, Magnet } from 'lucide-react'; import { Cast, Loader, Magnet } from 'lucide-react';
import useTorrents from '@/app/(site)/useTorrents'; import useTorrents from '@/app/(site)/useTorrents';
import { ORDER } from '@/app/api/torrents/parsers/pirate-bay'; 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 { Input } from '@/components/ui/input';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
interface Props { interface Props extends InstanceProps<void> {
title: string; title: string;
onClose: () => void;
} }
type Sorting = { type Sorting = {
@@ -49,9 +49,23 @@ const TableHeadSortable = ({
const hostAtom = atomWithStorage<string>('magnet-host', ''); const hostAtom = atomWithStorage<string>('magnet-host', '');
const Torrents: FC<Props> = ({ title, onClose }) => { const showHostManagerModal = create(({ onResolve, isOpen }) => {
const [host, setHost] = useAtom(hostAtom); const [host, setHost] = useAtom(hostAtom);
const [isShowHostInput, setIsShowHostInput] = useState(false); return (
<Modal className='p-3 pt-0 max-w-[200px] m-auto' isOpen={isOpen} onClose={() => onResolve()}>
<Input
autoFocus
placeholder='Enter host of Elementum'
value={host}
onChange={({ target: { value } }) => setHost(value)}
onKeyDown={({ key }) => key === 'Enter' && onResolve()}
/>
</Modal>
);
});
const Torrents: FC<Props> = ({ title, isOpen, onResolve }) => {
const host = useAtomValue(hostAtom);
const [sorting, setSorting] = useState<Sorting>({ by: ORDER.seeders }); const [sorting, setSorting] = useState<Sorting>({ by: ORDER.seeders });
const { data: torrents, isLoading, isFetched } = useTorrents({ query: title, order: sorting.by }); const { data: torrents, isLoading, isFetched } = useTorrents({ query: title, order: sorting.by });
@@ -64,81 +78,68 @@ const Torrents: FC<Props> = ({ title, onClose }) => {
}; };
return ( return (
<Dialog defaultOpen={true} onOpenChange={(isOpen) => !isOpen && onClose()}> <Modal className='p-0' isOpen={isOpen} onClose={() => onResolve()}>
<DialogContent className='p-0' onClose={onClose}> <Table className='rounded-xl overflow-hidden'>
<Table className='rounded-xl overflow-hidden'> <TableHeader>
<TableHeader> <TableRow>
<TableRow> <TableHead className='px-2'>Title</TableHead>
<TableHead className='px-2'>Title</TableHead> <TableHeadSortable title='Size' by={ORDER.size} value={sorting} onChange={setSorting} />
<TableHeadSortable title='Size' by={ORDER.size} value={sorting} onChange={setSorting} /> <TableHeadSortable title='Seeders' by={ORDER.seeders} value={sorting} onChange={setSorting} />
<TableHeadSortable title='Seeders' by={ORDER.seeders} value={sorting} onChange={setSorting} /> <TableHead className='px-2 text-center cursor-pointer select-none' onClick={() => showHostManagerModal()}>
<TableHead className='px-2 text-center' onClick={() => setIsShowHostInput(true)}> Magnet
Magnet </TableHead>
</TableHead> </TableRow>
</TableHeader>
<TableBody>
{torrents?.map((torrent) => (
<TableRow key={torrent.magnet + torrent.id}>
<TableCell className='break-all p-2'>{torrent.title}</TableCell>
<TableCell className='p-2'>
<div className='flex items-center gap-1 shrink-0 justify-center'>{torrent.size}</div>
</TableCell>
<TableCell className='text-center p-2'>{torrent.seeders}</TableCell>
<TableCell className='text-center p-1'>
<div className='flex gap-2 m-auto justify-center'>
{host ? (
<a
onClick={handleCast(torrent.magnet)}
className='flex items-center justify-center h-8 w-8 border rounded-lg'
>
<Cast size={20} />
</a>
) : (
<a href={torrent.magnet} className='flex items-center justify-center h-8 w-8 border rounded-lg'>
<Magnet size={20} />
</a>
)}
</div>
</TableCell>
</TableRow> </TableRow>
</TableHeader> ))}
<TableBody> {isLoading && (
{torrents?.map((torrent) => ( <TableRow>
<TableRow key={torrent.magnet + torrent.id}> <TableCell colSpan={4}>
<TableCell className='break-all p-2'>{torrent.title}</TableCell> <div className='h-40 w-full flex items-center justify-center'>
<TableCell className='p-2'> <Loader className='animate-spin' />
<div className='flex items-center gap-1 shrink-0 justify-center'>{torrent.size}</div> </div>
</TableCell> </TableCell>
<TableCell className='text-center p-2'>{torrent.seeders}</TableCell> </TableRow>
<TableCell className='text-center p-1'> )}
<div className='flex gap-2 m-auto justify-center'> {isFetched && !torrents?.length && (
{host ? ( <TableRow>
<a <TableCell colSpan={4}>
onClick={handleCast(torrent.magnet)} <div className='h-40 w-full flex items-center justify-center text-xl text-muted-foreground'>
className='flex items-center justify-center h-8 w-8 border rounded-lg' Nothing was found
> </div>
<Cast size={20} /> </TableCell>
</a> </TableRow>
) : ( )}
<a href={torrent.magnet} className='flex items-center justify-center h-8 w-8 border rounded-lg'> </TableBody>
<Magnet size={20} /> </Table>
</a> </Modal>
)}
</div>
</TableCell>
</TableRow>
))}
{isLoading && (
<TableRow>
<TableCell colSpan={4}>
<div className='h-40 w-full flex items-center justify-center'>
<Loader className='animate-spin' />
</div>
</TableCell>
</TableRow>
)}
{isFetched && !torrents?.length && (
<TableRow>
<TableCell colSpan={4}>
<div className='h-40 w-full flex items-center justify-center text-xl text-muted-foreground'>
Nothing was found
</div>
</TableCell>
</TableRow>
)}
</TableBody>
</Table>
{isShowHostInput && (
<Dialog defaultOpen={true} onOpenChange={() => setIsShowHostInput(false)}>
<DialogContent className='flex p-3 max-w-[300px] gap-2' onClose={() => setIsShowHostInput(false)}>
<Input
autoFocus
placeholder='Enter host of Elementum'
value={host}
onChange={({ target: { value } }) => setHost(value)}
onKeyDown={({ key }) => key === 'Enter' && setIsShowHostInput(false)}
/>
</DialogContent>
</Dialog>
)}
</DialogContent>
</Dialog>
); );
}; };
export const showTorrentsModal = create(Torrents);
export default Torrents; export default Torrents;
+22 -18
View File
@@ -1,29 +1,33 @@
import { FC } from 'react'; import { FC } from 'react';
import { create, InstanceProps } from 'react-modal-promise';
import { Dialog, DialogContent } from '@/components/ui/dialog'; import { Modal } from '@/components/ui/dialog';
interface Props { interface Props extends InstanceProps<void> {
trailerKey?: string; trailerKey?: string;
onClose: () => void;
} }
const Trailer: FC<Props> = ({ trailerKey, onClose }) => { const Trailer: FC<Props> = ({ trailerKey, onResolve, isOpen }) => {
if (!trailerKey) return;
return ( return (
trailerKey && ( <Modal
<Dialog defaultOpen={true} onOpenChange={(isOpen) => !isOpen && onClose()}> className='block p-0 min-h-[400px] border-none aspect-w-16 aspect-h-9'
<DialogContent className='block p-0 min-h-[400px] border-none aspect-w-16 aspect-h-9' onClose={onClose}> onClose={() => onResolve()}
<iframe isOpen={isOpen}
allow='autoplay' >
className='border-none rounded-lg' <iframe
width='100%' allow='autoplay'
height='100%' className='border-none rounded-lg'
src={`//www.youtube.com/embed/${trailerKey}?autoplay=1`} width='100%'
allowFullScreen height='100%'
/> src={`//www.youtube.com/embed/${trailerKey}?autoplay=1`}
</DialogContent> allowFullScreen
</Dialog> />
) </Modal>
); );
}; };
export const showTrailerModal = create(Trailer);
export default Trailer; export default Trailer;
+25 -26
View File
@@ -1,56 +1,55 @@
import * as React from 'react' import * as React from 'react';
import { Slot } from '@radix-ui/react-slot' import { useRef, useState } from 'react';
import { cva, type VariantProps } from 'class-variance-authority' import { cva, type VariantProps } from 'class-variance-authority';
import { HTMLMotionProps, motion } from 'framer-motion';
import { cn } from '@/lib/utils' import { cn } from '@/lib/utils';
const buttonVariants = cva( const buttonVariants = cva(
'inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', 'inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
{ {
variants: { variants: {
variant: { variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/90', default: 'bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm active:shadow',
destructive: destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
'bg-destructive text-destructive-foreground hover:bg-destructive/90', outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
outline: secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
secondary:
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
ghost: 'hover:bg-accent hover:text-accent-foreground', ghost: 'hover:bg-accent hover:text-accent-foreground',
link: 'text-primary underline-offset-4 hover:underline', link: 'text-primary underline-offset-4 hover:underline'
}, },
size: { size: {
default: 'h-10 px-4 py-2', default: 'h-10 px-4 py-2',
sm: 'h-9 rounded-md px-3', sm: 'h-9 rounded-md px-3',
lg: 'h-11 rounded-md px-8', lg: 'h-11 rounded-md px-8',
icon: 'h-10 w-10', icon: 'h-10 w-10'
}, }
}, },
defaultVariants: { defaultVariants: {
variant: 'default', variant: 'default',
size: 'default', size: 'default'
}, }
} }
) );
export interface ButtonProps export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>, extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> { VariantProps<typeof buttonVariants> {
asChild?: boolean asChild?: boolean;
} }
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( const Button = React.forwardRef<HTMLButtonElement, HTMLMotionProps<'button'> & Pick<ButtonProps, 'size' | 'variant'>>(
({ className, variant, size, asChild = false, ...props }, ref) => { ({ className, variant, size, ...props }, ref) => {
const Comp = asChild ? Slot : 'button'
return ( return (
<Comp <motion.button
className={cn(buttonVariants({ variant, size, className }))} className={cn(buttonVariants({ variant, size, className }))}
ref={ref} ref={ref}
{...props} {...props}
onClick={undefined}
onTap={(e) => props.onClick?.(e as unknown as React.MouseEvent<HTMLButtonElement, MouseEvent>)}
/> />
) );
} }
) );
Button.displayName = 'Button' Button.displayName = 'Button';
export { Button, buttonVariants } export { Button, buttonVariants };
+65 -55
View File
@@ -1,32 +1,35 @@
'use client'; 'use client';
import * as React from 'react'; import * as React from 'react';
import { useState } from 'react';
import * as DialogPrimitive from '@radix-ui/react-dialog'; import * as DialogPrimitive from '@radix-ui/react-dialog';
import { AnimatePresence, motion, useDragControls } from 'framer-motion';
import { GripHorizontal } from 'lucide-react';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
const Dialog = DialogPrimitive.Root; const Dialog = DialogPrimitive.Root;
const DialogTrigger = DialogPrimitive.Trigger; const DialogPortal = ({ ...props }: DialogPrimitive.DialogPortalProps) => <DialogPrimitive.Portal {...props} />;
const DialogPortal = ({ className, ...props }: DialogPrimitive.DialogPortalProps) => (
<DialogPrimitive.Portal className={cn(className)} {...props} />
);
DialogPortal.displayName = DialogPrimitive.Portal.displayName; DialogPortal.displayName = DialogPrimitive.Portal.displayName;
const transition = { duration: 0.35, type: 'spring', bounce: 0 };
const DialogOverlay = React.forwardRef< const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>, React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => ( >(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay <DialogPrimitive.Overlay ref={ref} {...props}>
ref={ref} <motion.div
className={cn( onScroll={props.onScroll}
'fixed inset-0 z-50 bg-black/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0', className={cn('fixed inset-0 z-50 transform-gpu backdrop-brightness-50 select-none', className)}
className transition={transition}
)} initial={{ opacity: 0 }}
{...props} animate={{ opacity: 1 }}
/> exit={{ opacity: 0 }}
>
{props?.children}
</motion.div>
</DialogPrimitive.Overlay>
)); ));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
@@ -34,54 +37,61 @@ const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>, React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & { onClose?: () => void } React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & { onClose?: () => void }
>(({ className, children, ...props }, ref) => { >(({ className, children, ...props }, ref) => {
const controls = useDragControls();
return ( return (
<DialogPortal> <DialogPortal>
<DialogOverlay className='overflow-auto flex justify-center'> <DialogOverlay className='overflow-auto flex justify-center select-none'>
<DialogPrimitive.Content <motion.div
ref={ref} className='absolute top-[20vh] max-w-[1000px] w-[calc(100%-24px)] select-none'
className={cn( transition={transition}
'absolute top-[20vh] max-w-[1000px] w-[calc(100%-24px)] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 rounded-xl', initial={{ top: '100vh' }}
className animate={{ top: '20vh' }}
)} exit={{ top: '100vh' }}
{...props} drag='y'
dragConstraints={{ top: 0, bottom: 300 }}
onDragEnd={(_, info) => info.offset.y > 100 && props.onClose?.()}
dragListener={false}
dragControls={controls}
dragElastic={0.5}
> >
{children} <DialogPrimitive.Content
<div className='absolute w-full block h-[20vh] pointer-events-none' /> ref={ref}
</DialogPrimitive.Content> className={cn('gap-4 border bg-background p-6 shadow-lg rounded-xl relative', className)}
{...props}
>
<motion.div
className='w-full h-10 flex p-2 justify-center cursor-grab absolute top-[-36px] z-10'
onPointerDown={(e) => controls.start(e)}
>
<GripHorizontal color='white' />
</motion.div>
{children}
<div className='absolute w-full block h-[20vh] pointer-events-none' />
</DialogPrimitive.Content>
</motion.div>
</DialogOverlay> </DialogOverlay>
</DialogPortal> </DialogPortal>
); );
}); });
DialogContent.displayName = DialogPrimitive.Content.displayName; DialogContent.displayName = DialogPrimitive.Content.displayName;
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => ( const Modal: React.FC<{
<div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} /> children: React.ReactNode;
); className?: string;
DialogHeader.displayName = 'DialogHeader'; isOpen: boolean;
onClose: () => void;
}> = ({ children, onClose, isOpen, className }) => {
return (
<AnimatePresence>
{isOpen && (
<Dialog defaultOpen={true} onOpenChange={onClose}>
<DialogContent forceMount className={className} onClose={onClose}>
{children}
</DialogContent>
</Dialog>
)}
</AnimatePresence>
);
};
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => ( export { Dialog, DialogContent, Modal };
<div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props} />
);
DialogFooter.displayName = 'DialogFooter';
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn('text-lg font-semibold leading-none tracking-tight', className)}
{...props}
/>
));
DialogTitle.displayName = DialogPrimitive.Title.displayName;
const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
));
DialogDescription.displayName = DialogPrimitive.Description.displayName;
export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger };
+1 -1
View File
@@ -29,7 +29,7 @@ const TabsTrigger = React.forwardRef<
<TabsPrimitive.Trigger <TabsPrimitive.Trigger
ref={ref} ref={ref}
className={cn( className={cn(
'inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm', 'inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm',
className className
)} )}
{...props} {...props}
+224 -14
View File
@@ -8,7 +8,7 @@
"name": "movie-advisor", "name": "movie-advisor",
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"@radix-ui/react-dialog": "^1.0.4", "@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.5", "@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2", "@radix-ui/react-label": "^2.0.2",
@@ -31,6 +31,7 @@
"cmdk": "^0.2.0", "cmdk": "^0.2.0",
"eslint": "8.45.0", "eslint": "8.45.0",
"eslint-config-next": "13.4.12", "eslint-config-next": "13.4.12",
"framer-motion": "^10.16.16",
"jotai": "^2.2.2", "jotai": "^2.2.2",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"lucide-react": "^0.263.0", "lucide-react": "^0.263.0",
@@ -40,9 +41,11 @@
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-fast-marquee": "^1.6.0", "react-fast-marquee": "^1.6.0",
"react-modal-promise": "^1.0.2",
"tailwind-merge": "^1.14.0", "tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.6", "tailwindcss-animate": "^1.0.6",
"typescript": "5.1.6" "typescript": "5.1.6",
"vaul": "^0.8.0"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/aspect-ratio": "^0.4.2",
@@ -87,6 +90,21 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@emotion/is-prop-valid": {
"version": "0.8.8",
"resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz",
"integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==",
"optional": true,
"dependencies": {
"@emotion/memoize": "0.7.4"
}
},
"node_modules/@emotion/memoize": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz",
"integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==",
"optional": true
},
"node_modules/@eslint-community/eslint-utils": { "node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@@ -541,19 +559,19 @@
} }
}, },
"node_modules/@radix-ui/react-dialog": { "node_modules/@radix-ui/react-dialog": {
"version": "1.0.4", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.0.4.tgz", "resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.0.5.tgz",
"integrity": "sha512-hJtRy/jPULGQZceSAP2Re6/4NpKo8im6V8P2hUqZsdFiSL8l35kYsw3qbRI6Ay5mQd2+wlLqje770eq+RJ3yZg==", "integrity": "sha512-GjWJX/AUpB703eEBanuBnIWdIXg6NvJFCXcNlSZk4xdszCdhrJgBoUd1cGk67vFO+WdA2pfI/plOpqz/5GUP6Q==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.13.10", "@babel/runtime": "^7.13.10",
"@radix-ui/primitive": "1.0.1", "@radix-ui/primitive": "1.0.1",
"@radix-ui/react-compose-refs": "1.0.1", "@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-context": "1.0.1", "@radix-ui/react-context": "1.0.1",
"@radix-ui/react-dismissable-layer": "1.0.4", "@radix-ui/react-dismissable-layer": "1.0.5",
"@radix-ui/react-focus-guards": "1.0.1", "@radix-ui/react-focus-guards": "1.0.1",
"@radix-ui/react-focus-scope": "1.0.3", "@radix-ui/react-focus-scope": "1.0.4",
"@radix-ui/react-id": "1.0.1", "@radix-ui/react-id": "1.0.1",
"@radix-ui/react-portal": "1.0.3", "@radix-ui/react-portal": "1.0.4",
"@radix-ui/react-presence": "1.0.1", "@radix-ui/react-presence": "1.0.1",
"@radix-ui/react-primitive": "1.0.3", "@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-slot": "1.0.2", "@radix-ui/react-slot": "1.0.2",
@@ -576,6 +594,81 @@
} }
} }
}, },
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.5.tgz",
"integrity": "sha512-aJeDjQhywg9LBu2t/At58hCvr7pEm0o2Ke1x33B+MhjNmmZ17sy4KImo0KPLgsnc/zN7GPdce8Cnn0SWvwZO7g==",
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/primitive": "1.0.1",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-use-callback-ref": "1.0.1",
"@radix-ui/react-use-escape-keydown": "1.0.3"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-scope": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.0.4.tgz",
"integrity": "sha512-sL04Mgvf+FmyvZeYfNu1EPAaaxD+aw7cYeIB9L9Fvq8+urhltTRaEo5ysKOpHuKPclsZcSUMKlN05x4u+CINpA==",
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-use-callback-ref": "1.0.1"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.0.4.tgz",
"integrity": "sha512-Qki+C/EuGUVCQTOTD5vzJzJuMUlewbzuKyUy+/iHM2uwGiru9gZeBJtHAPKAEkB5KWGi9mP/CHKcY0wt1aW45Q==",
"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/react-primitive": "1.0.3"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-direction": { "node_modules/@radix-ui/react-direction": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.0.1.tgz", "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.0.1.tgz",
@@ -3388,6 +3481,29 @@
"url": "https://www.patreon.com/infusion" "url": "https://www.patreon.com/infusion"
} }
}, },
"node_modules/framer-motion": {
"version": "10.16.16",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-10.16.16.tgz",
"integrity": "sha512-je6j91rd7NmUX7L1XHouwJ4v3R+SO4umso2LUcgOct3rHZ0PajZ80ETYZTajzEXEl9DlKyzjyt4AvGQ+lrebOw==",
"dependencies": {
"tslib": "^2.4.0"
},
"optionalDependencies": {
"@emotion/is-prop-valid": "^0.8.2"
},
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"peerDependenciesMeta": {
"react": {
"optional": true
},
"react-dom": {
"optional": true
}
}
},
"node_modules/fs.realpath": { "node_modules/fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -4972,6 +5088,15 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
}, },
"node_modules/react-modal-promise": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/react-modal-promise/-/react-modal-promise-1.0.2.tgz",
"integrity": "sha512-dqT618ROhG8qh1+O6EZkia5ELw3zaZWGpMX2YfEH4bgwYENPuFonqKw1W70LFx3K/SCZvVBcD6UYEI12yzYXzg==",
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
}
},
"node_modules/react-remove-scroll": { "node_modules/react-remove-scroll": {
"version": "2.5.5", "version": "2.5.5",
"resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz", "resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz",
@@ -5931,6 +6056,18 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
}, },
"node_modules/vaul": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/vaul/-/vaul-0.8.0.tgz",
"integrity": "sha512-9nUU2jIObJvJZxeQU1oVr/syKo5XqbRoOMoTEt0hHlWify4QZFlqTh6QSN/yxoKzNrMeEQzxbc3XC/vkPLOIqw==",
"dependencies": {
"@radix-ui/react-dialog": "^1.0.4"
},
"peerDependencies": {
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
}
},
"node_modules/watchpack": { "node_modules/watchpack": {
"version": "2.4.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
@@ -6047,6 +6184,21 @@
"regenerator-runtime": "^0.13.11" "regenerator-runtime": "^0.13.11"
} }
}, },
"@emotion/is-prop-valid": {
"version": "0.8.8",
"resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz",
"integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==",
"optional": true,
"requires": {
"@emotion/memoize": "0.7.4"
}
},
"@emotion/memoize": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz",
"integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==",
"optional": true
},
"@eslint-community/eslint-utils": { "@eslint-community/eslint-utils": {
"version": "4.4.0", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@@ -6320,25 +6472,60 @@
} }
}, },
"@radix-ui/react-dialog": { "@radix-ui/react-dialog": {
"version": "1.0.4", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.0.4.tgz", "resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.0.5.tgz",
"integrity": "sha512-hJtRy/jPULGQZceSAP2Re6/4NpKo8im6V8P2hUqZsdFiSL8l35kYsw3qbRI6Ay5mQd2+wlLqje770eq+RJ3yZg==", "integrity": "sha512-GjWJX/AUpB703eEBanuBnIWdIXg6NvJFCXcNlSZk4xdszCdhrJgBoUd1cGk67vFO+WdA2pfI/plOpqz/5GUP6Q==",
"requires": { "requires": {
"@babel/runtime": "^7.13.10", "@babel/runtime": "^7.13.10",
"@radix-ui/primitive": "1.0.1", "@radix-ui/primitive": "1.0.1",
"@radix-ui/react-compose-refs": "1.0.1", "@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-context": "1.0.1", "@radix-ui/react-context": "1.0.1",
"@radix-ui/react-dismissable-layer": "1.0.4", "@radix-ui/react-dismissable-layer": "1.0.5",
"@radix-ui/react-focus-guards": "1.0.1", "@radix-ui/react-focus-guards": "1.0.1",
"@radix-ui/react-focus-scope": "1.0.3", "@radix-ui/react-focus-scope": "1.0.4",
"@radix-ui/react-id": "1.0.1", "@radix-ui/react-id": "1.0.1",
"@radix-ui/react-portal": "1.0.3", "@radix-ui/react-portal": "1.0.4",
"@radix-ui/react-presence": "1.0.1", "@radix-ui/react-presence": "1.0.1",
"@radix-ui/react-primitive": "1.0.3", "@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-slot": "1.0.2", "@radix-ui/react-slot": "1.0.2",
"@radix-ui/react-use-controllable-state": "1.0.1", "@radix-ui/react-use-controllable-state": "1.0.1",
"aria-hidden": "^1.1.1", "aria-hidden": "^1.1.1",
"react-remove-scroll": "2.5.5" "react-remove-scroll": "2.5.5"
},
"dependencies": {
"@radix-ui/react-dismissable-layer": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.5.tgz",
"integrity": "sha512-aJeDjQhywg9LBu2t/At58hCvr7pEm0o2Ke1x33B+MhjNmmZ17sy4KImo0KPLgsnc/zN7GPdce8Cnn0SWvwZO7g==",
"requires": {
"@babel/runtime": "^7.13.10",
"@radix-ui/primitive": "1.0.1",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-use-callback-ref": "1.0.1",
"@radix-ui/react-use-escape-keydown": "1.0.3"
}
},
"@radix-ui/react-focus-scope": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.0.4.tgz",
"integrity": "sha512-sL04Mgvf+FmyvZeYfNu1EPAaaxD+aw7cYeIB9L9Fvq8+urhltTRaEo5ysKOpHuKPclsZcSUMKlN05x4u+CINpA==",
"requires": {
"@babel/runtime": "^7.13.10",
"@radix-ui/react-compose-refs": "1.0.1",
"@radix-ui/react-primitive": "1.0.3",
"@radix-ui/react-use-callback-ref": "1.0.1"
}
},
"@radix-ui/react-portal": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.0.4.tgz",
"integrity": "sha512-Qki+C/EuGUVCQTOTD5vzJzJuMUlewbzuKyUy+/iHM2uwGiru9gZeBJtHAPKAEkB5KWGi9mP/CHKcY0wt1aW45Q==",
"requires": {
"@babel/runtime": "^7.13.10",
"@radix-ui/react-primitive": "1.0.3"
}
}
} }
}, },
"@radix-ui/react-direction": { "@radix-ui/react-direction": {
@@ -8171,6 +8358,15 @@
"integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==",
"dev": true "dev": true
}, },
"framer-motion": {
"version": "10.16.16",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-10.16.16.tgz",
"integrity": "sha512-je6j91rd7NmUX7L1XHouwJ4v3R+SO4umso2LUcgOct3rHZ0PajZ80ETYZTajzEXEl9DlKyzjyt4AvGQ+lrebOw==",
"requires": {
"@emotion/is-prop-valid": "^0.8.2",
"tslib": "^2.4.0"
}
},
"fs.realpath": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -9201,6 +9397,12 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
}, },
"react-modal-promise": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/react-modal-promise/-/react-modal-promise-1.0.2.tgz",
"integrity": "sha512-dqT618ROhG8qh1+O6EZkia5ELw3zaZWGpMX2YfEH4bgwYENPuFonqKw1W70LFx3K/SCZvVBcD6UYEI12yzYXzg==",
"requires": {}
},
"react-remove-scroll": { "react-remove-scroll": {
"version": "2.5.5", "version": "2.5.5",
"resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz", "resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz",
@@ -9815,6 +10017,14 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
}, },
"vaul": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/vaul/-/vaul-0.8.0.tgz",
"integrity": "sha512-9nUU2jIObJvJZxeQU1oVr/syKo5XqbRoOMoTEt0hHlWify4QZFlqTh6QSN/yxoKzNrMeEQzxbc3XC/vkPLOIqw==",
"requires": {
"@radix-ui/react-dialog": "^1.0.4"
}
},
"watchpack": { "watchpack": {
"version": "2.4.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
+5 -2
View File
@@ -9,7 +9,7 @@
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {
"@radix-ui/react-dialog": "^1.0.4", "@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.5", "@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2", "@radix-ui/react-label": "^2.0.2",
@@ -32,6 +32,7 @@
"cmdk": "^0.2.0", "cmdk": "^0.2.0",
"eslint": "8.45.0", "eslint": "8.45.0",
"eslint-config-next": "13.4.12", "eslint-config-next": "13.4.12",
"framer-motion": "^10.16.16",
"jotai": "^2.2.2", "jotai": "^2.2.2",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"lucide-react": "^0.263.0", "lucide-react": "^0.263.0",
@@ -41,9 +42,11 @@
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-fast-marquee": "^1.6.0", "react-fast-marquee": "^1.6.0",
"react-modal-promise": "^1.0.2",
"tailwind-merge": "^1.14.0", "tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.6", "tailwindcss-animate": "^1.0.6",
"typescript": "5.1.6" "typescript": "5.1.6",
"vaul": "^0.8.0"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/aspect-ratio": "^0.4.2",
+2
View File
@@ -1,6 +1,7 @@
'use client'; 'use client';
import { ReactNode, useState } from 'react'; import { ReactNode, useState } from 'react';
import ModalContainer from 'react-modal-promise';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryStreamedHydration } from '@tanstack/react-query-next-experimental'; import { ReactQueryStreamedHydration } from '@tanstack/react-query-next-experimental';
@@ -22,6 +23,7 @@ const Providers = ({ children, theme }: { children: ReactNode; theme?: Theme })
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<ReactQueryStreamedHydration> <ReactQueryStreamedHydration>
<ThemeProvider theme={theme}>{children}</ThemeProvider> <ThemeProvider theme={theme}>{children}</ThemeProvider>
<ModalContainer />
</ReactQueryStreamedHydration> </ReactQueryStreamedHydration>
</QueryClientProvider> </QueryClientProvider>
); );
+11
View File
@@ -79,6 +79,17 @@
} }
} }
* {
user-select: none;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
main, main,
header { header {
max-width: 1260px; max-width: 1260px;