feat: reduced countries list
This commit is contained in:
1 parent
29f6de300b
commit
375ebf93d9
13 files changed
+83
-150
No files matched your search
@@ -31,8 +31,8 @@ const Card: FC<Props> = ({ movie, onClick, className }) => {
|
||||
</div>
|
||||
<div className='text-white absolute w-full h-full top-0 left-0 rounded-md flex flex-col justify-between p-2 card-gradient'>
|
||||
<Handlers movie={movie} onClick={onClick} />
|
||||
<div className='flex items-start justify-between text-lg opacity-75'>
|
||||
<span>{movie.name || movie.title}</span>
|
||||
<div className='grid grid-cols-[1fr_auto] text-lg opacity-75 gap-2'>
|
||||
<span className='overflow-ellipsis overflow-hidden whitespace-nowrap'>{movie.name || movie.title}</span>
|
||||
{Boolean(movie.release_date) && <span>{new Date(movie.release_date).getFullYear()}</span>}
|
||||
</div>
|
||||
<div className='opacity-75 mb-[-5px]'>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { FC, forwardRef, useMemo } from 'react';
|
||||
import { FC, useMemo } from 'react';
|
||||
import { VirtuosoGrid, VirtuosoGridProps } from 'react-virtuoso';
|
||||
import { motion } from 'framer-motion';
|
||||
|
||||
import Card from '@/components/Movie/Card';
|
||||
import { showPreviewModal } from '@/components/Movie/Preview';
|
||||
@@ -15,27 +14,7 @@ interface Props {
|
||||
onPreviewClose?: () => void;
|
||||
}
|
||||
|
||||
const container = {
|
||||
hidden: { y: -20, opacity: 0 },
|
||||
visible: {
|
||||
y: 0,
|
||||
opacity: 1
|
||||
}
|
||||
};
|
||||
|
||||
const components: VirtuosoGridProps<Movie, { shows: Movie[]; onClick: (movie: Movie) => void }>['components'] = {
|
||||
List: forwardRef(function List({ context, ...props }, ref) {
|
||||
return (
|
||||
<motion.div
|
||||
{...props}
|
||||
variants={container}
|
||||
initial='hidden'
|
||||
animate='visible'
|
||||
className='flex gap-2 flex-wrap justify-center grow empty:hidden'
|
||||
ref={ref}
|
||||
/>
|
||||
);
|
||||
}),
|
||||
Item: ({ context, 'data-index': index }) => {
|
||||
const { shows, onClick } = context || {};
|
||||
const movie = shows?.[index];
|
||||
@@ -70,6 +49,7 @@ const List: FC<Props> = ({ pages, hasNextPage, fetchNextPage, onPreviewClose, ty
|
||||
<>
|
||||
<VirtuosoGrid
|
||||
useWindowScroll
|
||||
listClassName='flex gap-2 flex-wrap justify-center grow empty:hidden opacity-0 animate-fade-in-slide-in'
|
||||
customScrollParent={customScrollParent}
|
||||
totalCount={shows.length}
|
||||
overscan={4}
|
||||
|
||||
@@ -1,84 +1,59 @@
|
||||
'use client';
|
||||
|
||||
import { FC } from 'react';
|
||||
import { motion } from 'framer-motion';
|
||||
import { User2 } from 'lucide-react';
|
||||
import Image from 'next/image';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import Link from 'next/link';
|
||||
|
||||
import useCredits from '@/app/(site)/useCredits';
|
||||
|
||||
interface Props {
|
||||
type?: ShowType;
|
||||
movieId: number;
|
||||
onPersonClick?: (id: string) => void;
|
||||
type?: ShowType;
|
||||
}
|
||||
|
||||
const container = {
|
||||
hidden: {},
|
||||
visible: {
|
||||
transition: {
|
||||
staggerChildren: 0.03
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const item = {
|
||||
hidden: { x: -20, opacity: 0 },
|
||||
visible: {
|
||||
x: 0,
|
||||
opacity: 1
|
||||
}
|
||||
};
|
||||
|
||||
const Credits: FC<Props> = ({ movieId, onPersonClick, type = 'movie' }) => {
|
||||
const router = useRouter();
|
||||
const { data: credits } = useCredits({ movieId, type });
|
||||
|
||||
return (
|
||||
Boolean(credits?.length) && (
|
||||
<motion.ul
|
||||
className='flex gap-2 no-scrollbar overflow-auto rounded-lg snap-mandatory snap-x'
|
||||
variants={container}
|
||||
initial='hidden'
|
||||
animate='visible'
|
||||
whileInView='visible'
|
||||
>
|
||||
<ul className='flex gap-2 no-scrollbar overflow-auto rounded-lg snap-mandatory snap-x opacity-0 animate-fade-aside-slide-in'>
|
||||
{credits?.map((actor) => (
|
||||
<motion.li
|
||||
variants={item}
|
||||
<li
|
||||
key={`${actor.id}_${actor.cast_id}`}
|
||||
title={actor.name}
|
||||
onTap={() => {
|
||||
router.push(`/starring?actorId=${actor.id}&title=${encodeURIComponent(actor.name)}`);
|
||||
onPersonClick?.(actor.id.toString());
|
||||
}}
|
||||
className='bg-card text-card-foreground self-end max-w-[120px] w-full shrink-0 cursor-pointer transition-shadow hover:shadow-lg relative snap-start'
|
||||
>
|
||||
<div className='rounded-lg overflow-hidden'>
|
||||
{actor.profile_path ? (
|
||||
<Image
|
||||
unoptimized
|
||||
height={180}
|
||||
width={120}
|
||||
src={`https://image.tmdb.org/t/p/w500/${actor.profile_path}`}
|
||||
alt={actor.name}
|
||||
/>
|
||||
) : (
|
||||
<div className='h-[180px] w-[120px] flex items-center justify-center rounded-lg'>
|
||||
<User2 size={120} strokeWidth={1} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className='text-white text-sm absolute w-full h-full top-0 left-0 rounded-md flex flex-col justify-between p-2 py-1 card-gradient'>
|
||||
<p className=' overflow-ellipsis whitespace-nowrap overflow-hidden'>{actor.name}</p>
|
||||
{Boolean(actor.character) && (
|
||||
<p className='overflow-ellipsis whitespace-nowrap overflow-hidden'>{actor.character}</p>
|
||||
)}
|
||||
</div>
|
||||
</motion.li>
|
||||
<Link
|
||||
href={`/starring?actorId=${actor.id}&title=${encodeURIComponent(actor.name)}`}
|
||||
onClick={() => onPersonClick?.(actor.id.toString())}
|
||||
>
|
||||
<div className='rounded-lg overflow-hidden'>
|
||||
{actor.profile_path ? (
|
||||
<Image
|
||||
unoptimized
|
||||
height={180}
|
||||
width={120}
|
||||
src={`https://image.tmdb.org/t/p/w500/${actor.profile_path}`}
|
||||
alt={actor.name}
|
||||
/>
|
||||
) : (
|
||||
<div className='h-[180px] w-[120px] flex items-center justify-center rounded-lg'>
|
||||
<User2 size={120} strokeWidth={1} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className='text-white text-sm absolute w-full h-full top-0 left-0 rounded-md flex flex-col justify-between p-2 py-1 card-gradient'>
|
||||
<p className=' overflow-ellipsis whitespace-nowrap overflow-hidden'>{actor.name}</p>
|
||||
{Boolean(actor.character) && (
|
||||
<p className='overflow-ellipsis whitespace-nowrap overflow-hidden'>{actor.character}</p>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</motion.ul>
|
||||
</ul>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { create, InstanceProps } from 'react-modal-promise';
|
||||
import { motion } from 'framer-motion';
|
||||
import { Play } from 'lucide-react';
|
||||
|
||||
import useTrailer from '@/app/(site)/useTrailer';
|
||||
@@ -39,12 +38,12 @@ export default function ToggleTrailer({ movieId, type = 'movie', children }: Pro
|
||||
return children
|
||||
? children({ onPlay: () => showTrailerModal({ trailerKey: trailer?.key }), disabled: isFetched && !trailer })
|
||||
: trailer && (
|
||||
<motion.div
|
||||
onTap={() => showTrailerModal({ trailerKey: trailer?.key })}
|
||||
<div
|
||||
onClick={() => 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'
|
||||
>
|
||||
<Play size={100} className='fill-white' />
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user