feat(frontend): unify person routing, cast page, and centralize ratings
- Add EntryCastsPage at /entry/:id/cast with sort/filter and breadcrumb nav - Show episode count under character names for TV series in CastList - Add "All Cast & Crew →" link to CastList section header - Extract reusable StarRating component with half-star support and 3 sizes - Replace all rating UIs (EntrySettingsDialog, CollectionEditDialog, RatingDialog) - Document StarRating component as the single rating standard in Components.md Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
1 parent
b3002a329d
commit
e460290b9b
11 files changed
+392
-146
No files matched your search
@@ -2,24 +2,38 @@ 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 { ChevronRight } from 'lucide-react';
|
||||
import type { Credit } from '@/types';
|
||||
|
||||
interface CastListProps {
|
||||
credits: Credit[];
|
||||
entryId?: number;
|
||||
isTvSeries?: boolean;
|
||||
}
|
||||
|
||||
export function CastList({ credits }: CastListProps) {
|
||||
export function CastList({ credits, entryId, isTvSeries }: 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>
|
||||
<div className="flex items-center justify-between">
|
||||
<h3 className="text-lg font-semibold">Cast</h3>
|
||||
{entryId != null && (
|
||||
<Link
|
||||
to={`/entry/${entryId}/cast`}
|
||||
className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
All Cast & Crew
|
||||
<ChevronRight className="h-4 w-4" />
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
<ScrollArea className="w-full">
|
||||
<div className="flex gap-4 pb-4">
|
||||
{castCredits.map((credit) => (
|
||||
<CastCard key={credit.id} credit={credit} />
|
||||
<CastCard key={credit.id} credit={credit} isTvSeries={isTvSeries} />
|
||||
))}
|
||||
</div>
|
||||
<ScrollBar orientation="horizontal" />
|
||||
@@ -28,7 +42,7 @@ export function CastList({ credits }: CastListProps) {
|
||||
);
|
||||
}
|
||||
|
||||
function CastCard({ credit }: { credit: Credit }) {
|
||||
function CastCard({ credit, isTvSeries }: { credit: Credit; isTvSeries?: boolean }) {
|
||||
const profileUrl = credit.people?.profile_path
|
||||
? getProfileUrl(credit.people.profile_path)
|
||||
: undefined;
|
||||
@@ -59,6 +73,11 @@ function CastCard({ credit }: { credit: Credit }) {
|
||||
<p className="text-[10px] text-muted-foreground leading-tight line-clamp-1">
|
||||
{credit.character}
|
||||
</p>
|
||||
{isTvSeries && credit.episode_count != null && credit.episode_count > 0 && (
|
||||
<p className="text-[10px] text-muted-foreground/70 leading-tight">
|
||||
{credit.episode_count} ep.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user