Implemented the new react version of the frontend
This commit is contained in:
1 parent
236e6e06fb
commit
ffe7e52527
65 files changed
+5228
-177
No files matched your search
@@ -0,0 +1,60 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area';
|
||||
import { getProfileUrl } from '@/lib/media-utils';
|
||||
import type { Credit } from '@/types';
|
||||
|
||||
interface CastListProps {
|
||||
credits: Credit[];
|
||||
}
|
||||
|
||||
export function CastList({ credits }: CastListProps) {
|
||||
const castCredits = credits.filter((c) => c.cast_type === 'cast');
|
||||
|
||||
if (castCredits.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<h3 className="text-lg font-semibold">Cast</h3>
|
||||
<ScrollArea className="w-full">
|
||||
<div className="flex gap-4 pb-4">
|
||||
{castCredits.map((credit) => (
|
||||
<CastCard key={credit.id} credit={credit} />
|
||||
))}
|
||||
</div>
|
||||
<ScrollBar orientation="horizontal" />
|
||||
</ScrollArea>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function CastCard({ credit }: { credit: Credit }) {
|
||||
const profileUrl = credit.people?.profile_path
|
||||
? getProfileUrl(credit.people.profile_path)
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<Link
|
||||
to={`/people/${credit.people_id}`}
|
||||
className="flex w-28 shrink-0 flex-col items-center gap-2 text-center"
|
||||
>
|
||||
<Avatar className="h-20 w-20">
|
||||
<AvatarImage src={profileUrl} alt={credit.people?.name} />
|
||||
<AvatarFallback className="text-xs">
|
||||
{credit.people?.name
|
||||
?.split(' ')
|
||||
.map((n) => n[0])
|
||||
.join('')}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<div>
|
||||
<p className="text-xs font-medium leading-tight line-clamp-2">
|
||||
{credit.people?.name}
|
||||
</p>
|
||||
<p className="text-[10px] text-muted-foreground leading-tight line-clamp-1">
|
||||
{credit.character}
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user