fix: improved random filter
This commit is contained in:
1 parent
89e76f5df6
commit
5d7a3464ed
9 files changed
+2921
-73
No files matched your search
@@ -0,0 +1,58 @@
|
||||
import { FC } from 'react';
|
||||
import { User2 } from 'lucide-react';
|
||||
import Image from 'next/image';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
import useCredits from '@/app/(site)/useCredits';
|
||||
|
||||
interface Props {
|
||||
movieId: number;
|
||||
onPersonClick?: (id: string) => void;
|
||||
}
|
||||
|
||||
const Credits: FC<Props> = ({ movieId, onPersonClick }) => {
|
||||
const router = useRouter();
|
||||
const { data: credits } = useCredits({ movieId });
|
||||
|
||||
return (
|
||||
Boolean(credits?.length) && (
|
||||
<div className='overflow-auto max-w-[100%] py-3 mb-[-0.75rem]'>
|
||||
<ul className='flex gap-3'>
|
||||
{credits?.map((actor) => (
|
||||
<li
|
||||
key={`${actor.id}_${actor.cast_id}`}
|
||||
title={actor.name}
|
||||
onClick={() => {
|
||||
router.push(`/top?starring=${actor.id}`);
|
||||
onPersonClick?.(actor.id.toString());
|
||||
}}
|
||||
className='p-2 rounded-lg border bg-card text-card-foreground self-end max-w-[150px] w-full shrink-0 cursor-pointer transition-shadow hover:shadow-lg'
|
||||
>
|
||||
{Boolean(actor.character) && (
|
||||
<p className='pb-2 overflow-ellipsis whitespace-nowrap overflow-hidden'>{actor.character}</p>
|
||||
)}
|
||||
<div className='rounded-md overflow-hidden'>
|
||||
{actor.profile_path ? (
|
||||
<Image
|
||||
unoptimized
|
||||
height={225}
|
||||
width={150}
|
||||
src={`https://image.tmdb.org/t/p/w500/${actor.profile_path}`}
|
||||
alt={actor.name}
|
||||
/>
|
||||
) : (
|
||||
<div className='w-[132px] h-[198px] flex items-center justify-center rounded-lg border'>
|
||||
<User2 size={120} strokeWidth={1} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<p className='pt-2 overflow-ellipsis whitespace-nowrap overflow-hidden'>{actor.name}</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
export default Credits;
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FC } from 'react';
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { ImageOff } from 'lucide-react';
|
||||
import Image from 'next/image';
|
||||
|
||||
@@ -9,9 +9,10 @@ interface Props {
|
||||
height: number;
|
||||
size: number;
|
||||
className?: string;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
const Poster: FC<Props> = ({ title, poster, width, height, size = 250, className }) => {
|
||||
const Poster: FC<Props> = ({ title, poster, width, height, size = 250, className, children }) => {
|
||||
return (
|
||||
<div className={`w-full flex flex-col rounded-lg overflow-hidden shrink-0 lg:m-0 mx-auto relative ${className}`}>
|
||||
{poster ? (
|
||||
@@ -28,6 +29,7 @@ const Poster: FC<Props> = ({ title, poster, width, height, size = 250, className
|
||||
<ImageOff size={size} strokeWidth={1} />
|
||||
</div>
|
||||
)}
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { FC } from 'react';
|
||||
|
||||
import { Dialog, DialogContent } from '@/components/ui/dialog';
|
||||
|
||||
interface Props {
|
||||
trailerKey?: string;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
const Trailer: FC<Props> = ({ trailerKey, onClose }) => {
|
||||
return (
|
||||
trailerKey && (
|
||||
<Dialog defaultOpen={true} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className='block p-0 min-h-[400px] aspect-w-16 aspect-h-9'>
|
||||
<iframe
|
||||
allow='autoplay'
|
||||
className='border-none rounded-lg'
|
||||
width='100%'
|
||||
height='100%'
|
||||
src={`//www.youtube.com/embed/${trailerKey}?autoplay=1`}
|
||||
allowFullScreen
|
||||
/>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
export default Trailer;
|
||||
Reference in new issue
Block a user