feat: UI improvements across Calendar, Cast, People, and Entry Details pages
Calendar: - Add list/agenda view for mobile with view toggle button (defaults to list on small screens) - Grid view: show entry poster cards (not episode stills) with S01E04 label for TV, title for movies - Grid cells use grid-rows-6 to fill exact viewport height with no scrolling on desktop - Clicking a day opens a dialog showing all episodes as a poster grid - Cap grid cells to 3 visible posters with overflow badge - Hide episodes with no known entry title Cast & Crew Page: - Increase people card size (h-32 w-32 avatar, larger text, fewer columns) - Add search box filtering by name and role - Restructure controls: search + count on left, filter + sort on right - Default filter to "Cast", default sort to "Episode Count" People Page: - Mobile layout: search input takes full width, switch & filter move to second line Entry Details Page: - Remove favorite heart icon overlay from poster - Add favorite pill in ratings row (gold background/star when active, dashed border when inactive) Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
1 parent
5fa2556b43
commit
3b882c9c35
4 files changed
+362
-135
No files matched your search
@@ -1,8 +1,9 @@
|
||||
import { useState, useMemo } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { format, startOfMonth, endOfMonth, eachDayOfInterval, getDay, addMonths, subMonths, isSameDay } from 'date-fns';
|
||||
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
||||
import { ChevronLeft, ChevronRight, LayoutGrid, List } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { useEpisodesByMonth } from '@/hooks/useEpisodes';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@/components/ui/tooltip';
|
||||
import { getTmdbPosterUrl } from '@/lib/media-utils';
|
||||
@@ -12,6 +13,10 @@ const DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
||||
|
||||
export function CalendarPage() {
|
||||
const [currentDate, setCurrentDate] = useState(new Date());
|
||||
const [viewMode, setViewMode] = useState<'grid' | 'list'>(
|
||||
() => (typeof window !== 'undefined' && window.innerWidth < 640 ? 'list' : 'grid')
|
||||
);
|
||||
const [selectedDay, setSelectedDay] = useState<{ date: Date; episodes: Episode[] } | null>(null);
|
||||
const monthStart = startOfMonth(currentDate);
|
||||
const monthEnd = endOfMonth(currentDate);
|
||||
|
||||
@@ -37,7 +42,7 @@ export function CalendarPage() {
|
||||
}, [episodes]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-[calc(100vh-7rem)]">
|
||||
<div className="flex flex-col h-[calc(100vh-3rem)]">
|
||||
<div className="flex items-center justify-between mb-4 shrink-0">
|
||||
<h1 className="text-2xl font-bold">Calendar</h1>
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -58,28 +63,85 @@ export function CalendarPage() {
|
||||
>
|
||||
<ChevronRight className="h-4 w-4" />
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
onClick={() => setViewMode((v) => (v === 'grid' ? 'list' : 'grid'))}
|
||||
title={viewMode === 'grid' ? 'Switch to list view' : 'Switch to grid view'}
|
||||
>
|
||||
{viewMode === 'grid' ? <List className="h-4 w-4" /> : <LayoutGrid className="h-4 w-4" />}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Calendar Grid — fills remaining height */}
|
||||
{/* Calendar Grid / List — fills remaining height */}
|
||||
<TooltipProvider>
|
||||
<div className="flex flex-col flex-1 rounded-lg border border-border overflow-hidden min-h-0">
|
||||
{/* Day headers */}
|
||||
<div className="grid grid-cols-7 bg-muted/50 shrink-0">
|
||||
{DAYS.map((day) => (
|
||||
<div key={day} className="px-2 py-2 text-center text-xs font-medium text-muted-foreground">
|
||||
{day}
|
||||
</div>
|
||||
))}
|
||||
{selectedDay && (
|
||||
<DayDialog
|
||||
date={selectedDay.date}
|
||||
episodes={selectedDay.episodes}
|
||||
onClose={() => setSelectedDay(null)}
|
||||
/>
|
||||
)}
|
||||
{viewMode === 'grid' ? (
|
||||
<div className="flex flex-col flex-1 rounded-lg border border-border overflow-hidden min-h-0">
|
||||
{/* Day headers */}
|
||||
<div className="grid grid-cols-7 bg-muted/50 shrink-0">
|
||||
{DAYS.map((day) => (
|
||||
<div key={day} className="px-2 py-2 text-center text-xs font-medium text-muted-foreground">
|
||||
{day}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Day cells — no scroll, rows share the remaining height equally */}
|
||||
<div className="grid grid-cols-7 grid-rows-6 flex-1 min-h-0">
|
||||
{/* Empty cells for offset */}
|
||||
{Array.from({ length: startDayOfWeek }).map((_, i) => (
|
||||
<div key={`empty-${i}`} className="border-t border-r border-border bg-muted/20" />
|
||||
))}
|
||||
|
||||
{days.map((day) => {
|
||||
const key = format(day, 'yyyy-MM-dd');
|
||||
const dayEpisodes = episodesByDate.get(key) || [];
|
||||
const isToday = isSameDay(day, new Date());
|
||||
|
||||
return (
|
||||
<div
|
||||
key={key}
|
||||
onClick={() => dayEpisodes.length > 0 && setSelectedDay({ date: day, episodes: dayEpisodes })}
|
||||
className={`border-t border-r border-border p-1 overflow-hidden flex flex-col min-h-0 ${
|
||||
isToday ? 'bg-primary/5' : ''
|
||||
} ${dayEpisodes.length > 0 ? 'cursor-pointer hover:bg-accent/30 transition-colors' : ''}`}
|
||||
>
|
||||
<span
|
||||
className={`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[10px] mb-0.5 ${
|
||||
isToday
|
||||
? 'bg-primary text-primary-foreground font-bold'
|
||||
: 'text-muted-foreground'
|
||||
}`}
|
||||
>
|
||||
{format(day, 'd')}
|
||||
</span>
|
||||
<div className="flex gap-0.5 flex-1 min-h-0 overflow-hidden items-start">
|
||||
{dayEpisodes.slice(0, 3).map((ep) => (
|
||||
<EpisodeCalendarItem key={ep.id} episode={ep} variant="grid" />
|
||||
))}
|
||||
{dayEpisodes.length > 3 && (
|
||||
<span className="text-[9px] text-muted-foreground shrink-0 self-end pb-0.5">
|
||||
+{dayEpisodes.length - 3}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Day cells */}
|
||||
<div className="grid grid-cols-7 flex-1 overflow-y-auto">
|
||||
{/* Empty cells for offset */}
|
||||
{Array.from({ length: startDayOfWeek }).map((_, i) => (
|
||||
<div key={`empty-${i}`} className="border-t border-r border-border bg-muted/20" />
|
||||
))}
|
||||
|
||||
) : (
|
||||
/* List / Agenda view */
|
||||
<div className="flex flex-col flex-1 overflow-y-auto min-h-0 gap-1">
|
||||
{days.map((day) => {
|
||||
const key = format(day, 'yyyy-MM-dd');
|
||||
const dayEpisodes = episodesByDate.get(key) || [];
|
||||
@@ -88,40 +150,57 @@ export function CalendarPage() {
|
||||
return (
|
||||
<div
|
||||
key={key}
|
||||
className={`border-t border-r border-border p-1.5 ${
|
||||
isToday ? 'bg-primary/5' : ''
|
||||
className={`rounded-lg border ${
|
||||
isToday
|
||||
? 'border-primary/30 bg-primary/5'
|
||||
: dayEpisodes.length > 0
|
||||
? 'border-border'
|
||||
: 'border-transparent'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
className={`inline-flex h-6 w-6 items-center justify-center rounded-full text-xs mb-1 ${
|
||||
isToday
|
||||
? 'bg-primary text-primary-foreground font-bold'
|
||||
: 'text-muted-foreground'
|
||||
<div
|
||||
className={`flex items-center gap-3 px-3 py-2 ${
|
||||
dayEpisodes.length > 0 ? 'border-b border-border/40' : ''
|
||||
}`}
|
||||
>
|
||||
{format(day, 'd')}
|
||||
</span>
|
||||
<div className="space-y-1">
|
||||
{dayEpisodes.slice(0, 4).map((ep) => (
|
||||
<EpisodeCalendarItem key={ep.id} episode={ep} />
|
||||
))}
|
||||
{dayEpisodes.length > 4 && (
|
||||
<span className="text-[10px] text-muted-foreground pl-1">
|
||||
+{dayEpisodes.length - 4} more
|
||||
<span
|
||||
className={`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-sm ${
|
||||
isToday
|
||||
? 'bg-primary text-primary-foreground font-bold'
|
||||
: 'text-muted-foreground'
|
||||
}`}
|
||||
>
|
||||
{format(day, 'd')}
|
||||
</span>
|
||||
<span className={`text-sm ${
|
||||
isToday ? 'font-medium text-foreground' : 'text-muted-foreground'
|
||||
}`}>
|
||||
{format(day, 'EEEE, MMM d')}
|
||||
</span>
|
||||
{dayEpisodes.length > 0 && (
|
||||
<span className="ml-auto text-xs text-muted-foreground">
|
||||
{dayEpisodes.length} ep{dayEpisodes.length !== 1 ? 's' : ''}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{dayEpisodes.length > 0 && (
|
||||
<div className="p-2 space-y-1">
|
||||
{dayEpisodes.map((ep) => (
|
||||
<EpisodeCalendarItem key={ep.id} episode={ep} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function EpisodeCalendarItem({ episode }: { episode: Episode }) {
|
||||
function EpisodeCalendarItem({ episode, variant = 'list' }: { episode: Episode; variant?: 'grid' | 'list' | 'dialog' }) {
|
||||
type EpisodeWithEntry = Episode & {
|
||||
entry?: { id: number; title?: string; poster_path?: string | null };
|
||||
};
|
||||
@@ -129,6 +208,10 @@ function EpisodeCalendarItem({ episode }: { episode: Episode }) {
|
||||
const entry = ep.entry;
|
||||
const entryId = entry?.id;
|
||||
const entryTitle = entry?.title ?? '';
|
||||
|
||||
// Hide episodes with no known entry title
|
||||
if (!entryTitle) return null;
|
||||
|
||||
const seasonId = episode.season_id;
|
||||
const seasonNumber = episode.season?.season_number ?? null;
|
||||
|
||||
@@ -137,28 +220,115 @@ function EpisodeCalendarItem({ episode }: { episode: Episode }) {
|
||||
: '';
|
||||
const episodeLabel = `E${String(episode.episode_number).padStart(2, '0')}`;
|
||||
|
||||
const thumbSrc = episode.still_path
|
||||
? getTmdbPosterUrl(episode.still_path, 'w92')
|
||||
: entry?.poster_path
|
||||
const thumbSrc = entry?.poster_path
|
||||
? getTmdbPosterUrl(entry.poster_path, 'w92')
|
||||
: undefined;
|
||||
|
||||
const isMovie = entry && !(entry as any).is_tvseries;
|
||||
|
||||
if (variant === 'grid') {
|
||||
const gridContent = (
|
||||
<div className="w-14 shrink-0 rounded overflow-hidden bg-primary/10 hover:bg-primary/20 transition-colors cursor-pointer">
|
||||
{thumbSrc ? (
|
||||
<img
|
||||
src={thumbSrc}
|
||||
alt={entryTitle}
|
||||
className="w-full aspect-2/3 object-cover"
|
||||
/>
|
||||
) : (
|
||||
<div className="w-full aspect-2/3 bg-muted/40 flex items-center justify-center">
|
||||
<span className="text-[7px] text-muted-foreground text-center px-0.5 leading-tight">{entryTitle}</span>
|
||||
</div>
|
||||
)}
|
||||
<p className="text-[7px] text-center text-muted-foreground tabular-nums py-0.5 leading-tight truncate px-0.5">
|
||||
{isMovie ? entryTitle : `${seasonLabel}${episodeLabel}`}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
{entryId ? (
|
||||
<Link to={`/entry/${entryId}/season/${seasonId}/episode/${episode.id}`} className="block">
|
||||
{gridContent}
|
||||
</Link>
|
||||
) : (
|
||||
<div>{gridContent}</div>
|
||||
)}
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right" className="max-w-50">
|
||||
<div className="space-y-0.5">
|
||||
<p className="text-xs font-semibold">{entryTitle}</p>
|
||||
{episode.name && (
|
||||
<p className="text-xs text-muted-foreground">{episode.name}</p>
|
||||
)}
|
||||
{!isMovie && (
|
||||
<p className="text-xs text-muted-foreground tabular-nums">
|
||||
{seasonLabel} {episodeLabel}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
if (variant === 'dialog') {
|
||||
const dialogContent = (
|
||||
<div className="rounded-lg overflow-hidden bg-primary/10 hover:bg-primary/20 transition-colors cursor-pointer">
|
||||
{thumbSrc ? (
|
||||
<img
|
||||
src={thumbSrc}
|
||||
alt={entryTitle}
|
||||
className="w-full aspect-2/3 object-cover"
|
||||
/>
|
||||
) : (
|
||||
<div className="w-full aspect-2/3 bg-muted/40 flex items-center justify-center p-2">
|
||||
<span className="text-xs text-muted-foreground text-center leading-tight">{entryTitle}</span>
|
||||
</div>
|
||||
)}
|
||||
<div className="p-1.5">
|
||||
<p className="text-xs font-medium leading-tight truncate">{entryTitle}</p>
|
||||
{!isMovie && (
|
||||
<p className="text-[10px] text-muted-foreground tabular-nums leading-tight mt-0.5">
|
||||
{seasonLabel}{episodeLabel}
|
||||
</p>
|
||||
)}
|
||||
{episode.name && (
|
||||
<p className="text-[10px] text-muted-foreground leading-tight truncate mt-0.5">{episode.name}</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
return entryId ? (
|
||||
<Link to={`/entry/${entryId}/season/${seasonId}/episode/${episode.id}`} className="block">
|
||||
{dialogContent}
|
||||
</Link>
|
||||
) : (
|
||||
<div>{dialogContent}</div>
|
||||
);
|
||||
}
|
||||
|
||||
const content = (
|
||||
<div className="flex items-stretch gap-1 rounded bg-primary/10 hover:bg-primary/20 px-1 py-0.5 transition-colors cursor-pointer overflow-hidden">
|
||||
<div className="flex items-stretch gap-2 rounded bg-primary/10 hover:bg-primary/20 px-1.5 py-1 transition-colors cursor-pointer overflow-hidden">
|
||||
{thumbSrc && (
|
||||
<img
|
||||
src={thumbSrc}
|
||||
alt=""
|
||||
className="h-8 w-5 rounded-sm object-cover shrink-0"
|
||||
className="h-14 w-9 rounded-sm object-cover shrink-0"
|
||||
/>
|
||||
)}
|
||||
<div className="min-w-0 flex flex-col justify-center">
|
||||
<p className="text-[10px] font-medium truncate leading-tight">
|
||||
{entryTitle || 'Unknown'}
|
||||
</p>
|
||||
<p className="text-[9px] text-muted-foreground tabular-nums leading-tight">
|
||||
{seasonLabel} {episodeLabel}
|
||||
<p className="text-xs font-medium truncate leading-tight">
|
||||
{entryTitle}
|
||||
</p>
|
||||
{!isMovie && (
|
||||
<p className="text-[10px] text-muted-foreground tabular-nums leading-tight mt-0.5">
|
||||
{seasonLabel} {episodeLabel}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -191,3 +361,20 @@ function EpisodeCalendarItem({ episode }: { episode: Episode }) {
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
function DayDialog({ date, episodes, onClose }: { date: Date; episodes: Episode[]; onClose: () => void }) {
|
||||
return (
|
||||
<Dialog open onOpenChange={(open) => !open && onClose()}>
|
||||
<DialogContent className="max-w-2xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{format(date, 'EEEE, MMMM d')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3 max-h-[70vh] overflow-y-auto pr-1">
|
||||
{episodes.map((ep) => (
|
||||
<EpisodeCalendarItem key={ep.id} episode={ep} variant="dialog" />
|
||||
))}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { useEntry, useEntryCredits } from '@/hooks/useEntries';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
@@ -72,24 +73,34 @@ export function EntryCastsPage() {
|
||||
const { data: entry, isLoading } = useEntry(entryId);
|
||||
const { data: allCredits = [], isLoading: creditsLoading } = useEntryCredits(entryId);
|
||||
|
||||
const [sortField, setSortField] = useState<SortField>('order');
|
||||
const [sortField, setSortField] = useState<SortField>('episode_count');
|
||||
const [sortDir, setSortDir] = useState<SortDir>('asc');
|
||||
const [filter, setFilter] = useState<CastFilter>('all');
|
||||
const [filter, setFilter] = useState<CastFilter>('cast');
|
||||
const [search, setSearch] = useState('');
|
||||
const [visibleCount, setVisibleCount] = useState(PAGE_SIZE);
|
||||
|
||||
const filtered = useMemo(() => {
|
||||
if (!allCredits) return [];
|
||||
if (filter === 'cast') return allCredits.filter((c) => c.cast_type === 'cast');
|
||||
if (filter === 'crew') return allCredits.filter((c) => c.cast_type === 'crew');
|
||||
return allCredits;
|
||||
}, [allCredits, filter]);
|
||||
let result = allCredits;
|
||||
if (filter === 'cast') result = result.filter((c) => c.cast_type === 'cast');
|
||||
else if (filter === 'crew') result = result.filter((c) => c.cast_type === 'crew');
|
||||
if (search.trim()) {
|
||||
const q = search.trim().toLowerCase();
|
||||
result = result.filter((c) => {
|
||||
const name = c.people?.name?.toLowerCase() ?? '';
|
||||
const role = (c.cast_type === 'cast' ? c.character : (c.job || c.department))?.toLowerCase() ?? '';
|
||||
return name.includes(q) || role.includes(q);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}, [allCredits, filter, search]);
|
||||
|
||||
const sorted = useMemo(() => sortCredits(filtered, sortField, sortDir), [filtered, sortField, sortDir]);
|
||||
|
||||
// Reset visible window whenever filter/sort changes
|
||||
// Reset visible window whenever filter/sort/search changes
|
||||
useEffect(() => {
|
||||
setVisibleCount(PAGE_SIZE);
|
||||
}, [filter, sortField, sortDir]);
|
||||
}, [filter, sortField, sortDir, search]);
|
||||
|
||||
const visible = useMemo(() => sorted.slice(0, visibleCount), [sorted, visibleCount]);
|
||||
const hasMore = visibleCount < sorted.length;
|
||||
@@ -116,10 +127,10 @@ export function EntryCastsPage() {
|
||||
return (
|
||||
<div className="space-y-6 mx-auto max-w-4xl">
|
||||
<Skeleton className="h-5 w-64" />
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6">
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5">
|
||||
{Array.from({ length: 18 }).map((_, i) => (
|
||||
<div key={i} className="flex flex-col items-center gap-2">
|
||||
<Skeleton className="h-24 w-24 rounded-full" />
|
||||
<Skeleton className="h-32 w-32 rounded-full" />
|
||||
<Skeleton className="h-4 w-20" />
|
||||
</div>
|
||||
))}
|
||||
@@ -146,43 +157,53 @@ export function EntryCastsPage() {
|
||||
|
||||
{/* Controls */}
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<Select value={filter} onValueChange={(v) => setFilter(v as CastFilter)}>
|
||||
<SelectTrigger className="w-32">
|
||||
<SelectValue>{FILTER_LABELS[filter]}</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All</SelectItem>
|
||||
<SelectItem value="cast">Cast</SelectItem>
|
||||
<SelectItem value="crew">Crew</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Select value={sortField} onValueChange={(v) => setSortField(v as SortField)}>
|
||||
<SelectTrigger className="w-40">
|
||||
<SelectValue>{SORT_LABELS[sortField]}</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="order">Credit Order</SelectItem>
|
||||
<SelectItem value="popularity">Popularity</SelectItem>
|
||||
<SelectItem value="name">Name</SelectItem>
|
||||
<SelectItem value="birthday">Birthday</SelectItem>
|
||||
<SelectItem value="gender">Gender</SelectItem>
|
||||
{isTv && <SelectItem value="episode_count">Episodes</SelectItem>}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-9 w-9"
|
||||
onClick={() => setSortDir((d) => (d === 'asc' ? 'desc' : 'asc'))}
|
||||
>
|
||||
<ArrowUpDown className="h-4 w-4" />
|
||||
</Button>
|
||||
|
||||
<span className="text-sm text-muted-foreground ml-auto">
|
||||
{/* Left: search + count */}
|
||||
<Input
|
||||
placeholder="Search people…"
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
className="w-48"
|
||||
/>
|
||||
<span className="text-sm text-muted-foreground whitespace-nowrap">
|
||||
{sorted.length} {sorted.length === 1 ? 'credit' : 'credits'}
|
||||
</span>
|
||||
|
||||
{/* Right: filter + sort */}
|
||||
<div className="flex items-center gap-3 ml-auto">
|
||||
<Select value={filter} onValueChange={(v) => setFilter(v as CastFilter)}>
|
||||
<SelectTrigger className="w-32">
|
||||
<SelectValue>{FILTER_LABELS[filter]}</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All</SelectItem>
|
||||
<SelectItem value="cast">Cast</SelectItem>
|
||||
<SelectItem value="crew">Crew</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Select value={sortField} onValueChange={(v) => setSortField(v as SortField)}>
|
||||
<SelectTrigger className="w-40">
|
||||
<SelectValue>{SORT_LABELS[sortField]}</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="order">Credit Order</SelectItem>
|
||||
<SelectItem value="popularity">Popularity</SelectItem>
|
||||
<SelectItem value="name">Name</SelectItem>
|
||||
<SelectItem value="birthday">Birthday</SelectItem>
|
||||
<SelectItem value="gender">Gender</SelectItem>
|
||||
{isTv && <SelectItem value="episode_count">Episodes</SelectItem>}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-9 w-9"
|
||||
onClick={() => setSortDir((d) => (d === 'asc' ? 'desc' : 'asc'))}
|
||||
>
|
||||
<ArrowUpDown className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Grid */}
|
||||
@@ -190,17 +211,17 @@ export function EntryCastsPage() {
|
||||
<p className="text-center text-muted-foreground py-12">No credits found.</p>
|
||||
) : (
|
||||
<>
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6">
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5">
|
||||
{visible.map((credit) => (
|
||||
<CreditCard key={credit.id} credit={credit} isTv={isTv} />
|
||||
))}
|
||||
</div>
|
||||
{hasMore && (
|
||||
<div ref={sentinelRef} className="flex justify-center py-6">
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 w-full">
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 w-full">
|
||||
{Array.from({ length: Math.min(PAGE_SIZE, sorted.length - visibleCount) }).map((_, i) => (
|
||||
<div key={i} className="flex flex-col items-center gap-2 p-2">
|
||||
<Skeleton className="h-20 w-20 rounded-full" />
|
||||
<Skeleton className="h-32 w-32 rounded-full" />
|
||||
<Skeleton className="h-3 w-16" />
|
||||
</div>
|
||||
))}
|
||||
@@ -230,11 +251,11 @@ function CreditCard({ credit, isTv }: { credit: Credit; isTv: boolean }) {
|
||||
return (
|
||||
<Link
|
||||
to={personLink}
|
||||
className="group flex flex-col items-center gap-2 text-center p-2 rounded-lg hover:bg-accent/50 transition-colors"
|
||||
className="group flex flex-col items-center gap-3 text-center p-3 rounded-lg hover:bg-accent/50 transition-colors"
|
||||
>
|
||||
<Avatar className="h-20 w-20 transition-transform group-hover:scale-105">
|
||||
<Avatar className="h-32 w-32 transition-transform group-hover:scale-105">
|
||||
<AvatarImage src={profileUrl} alt={credit.people?.name} />
|
||||
<AvatarFallback className="text-xs">
|
||||
<AvatarFallback className="text-sm">
|
||||
{credit.people?.name
|
||||
?.split(' ')
|
||||
.map((n) => n[0])
|
||||
@@ -242,14 +263,14 @@ function CreditCard({ credit, isTv }: { credit: Credit; isTv: boolean }) {
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="min-w-0 w-full">
|
||||
<p className="text-xs font-medium leading-tight line-clamp-2">{credit.people?.name}</p>
|
||||
<p className="text-sm font-medium leading-tight line-clamp-2">{credit.people?.name}</p>
|
||||
{roleLabel && (
|
||||
<p className="text-[10px] text-muted-foreground leading-tight line-clamp-1 mt-0.5">
|
||||
<p className="text-xs text-muted-foreground leading-tight line-clamp-1 mt-0.5">
|
||||
{roleLabel}
|
||||
</p>
|
||||
)}
|
||||
{isTv && credit.episode_count != null && credit.episode_count > 0 && (
|
||||
<p className="text-[10px] text-muted-foreground/70 leading-tight mt-0.5">
|
||||
<p className="text-xs text-muted-foreground/70 leading-tight mt-0.5">
|
||||
{credit.episode_count} {credit.episode_count === 1 ? 'episode' : 'episodes'}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -190,11 +190,6 @@ export function EntryDetailsPage() {
|
||||
{/* LEFT: Sticky poster */}
|
||||
<div className="sm:sticky sm:top-20 w-32 sm:w-44 shrink-0 self-start mx-auto sm:mx-0">
|
||||
<div className="relative">
|
||||
{e.favorit && (
|
||||
<div className="absolute top-2 left-2 z-10 rounded-full bg-background/80 p-1 backdrop-blur-sm">
|
||||
<Heart className="h-4 w-4 fill-red-500 text-red-500" />
|
||||
</div>
|
||||
)}
|
||||
<img
|
||||
src={poster}
|
||||
alt={e.title}
|
||||
@@ -364,6 +359,28 @@ export function EntryDetailsPage() {
|
||||
Rate
|
||||
</button>
|
||||
)}
|
||||
{/* Favorite pill */}
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
onClick={toggleFavorite}
|
||||
disabled={updateEntry.isPending}
|
||||
className={`inline-flex items-center gap-1 rounded-full border px-3 py-1 text-sm font-medium transition-colors ${
|
||||
e.favorit
|
||||
? 'bg-yellow-500/15 border-yellow-500/30 text-yellow-600 dark:text-yellow-400 hover:bg-yellow-500/25'
|
||||
: 'border-dashed border-border text-muted-foreground hover:border-yellow-500/40 hover:text-yellow-500'
|
||||
}`}
|
||||
>
|
||||
<Star className={`h-3.5 w-3.5 ${e.favorit ? 'fill-yellow-400 text-yellow-400' : ''}`} />
|
||||
Favorit
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>{e.favorit ? 'Remove from favorites' : 'Add to favorites'}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
</div>
|
||||
|
||||
{/* Storyline */}
|
||||
|
||||
@@ -93,8 +93,8 @@ export function PeoplePage() {
|
||||
<h1 className="text-2xl font-bold">People</h1>
|
||||
|
||||
{/* Controls row */}
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<div className="relative flex-1 max-w-xs">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center">
|
||||
<div className="relative w-full sm:flex-1 sm:max-w-xs">
|
||||
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
||||
<Input
|
||||
placeholder="Search people..."
|
||||
@@ -104,34 +104,36 @@ export function PeoplePage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Local DB toggle */}
|
||||
<div className="flex items-center gap-2">
|
||||
<Switch
|
||||
id="local-toggle"
|
||||
checked={localOnly}
|
||||
onCheckedChange={setLocalOnly}
|
||||
/>
|
||||
<Label htmlFor="local-toggle" className="text-sm cursor-pointer">
|
||||
Local DB
|
||||
</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-3 sm:contents">
|
||||
{/* Local DB toggle */}
|
||||
<div className="flex items-center gap-2">
|
||||
<Switch
|
||||
id="local-toggle"
|
||||
checked={localOnly}
|
||||
onCheckedChange={setLocalOnly}
|
||||
/>
|
||||
<Label htmlFor="local-toggle" className="text-sm cursor-pointer">
|
||||
Local DB
|
||||
</Label>
|
||||
</div>
|
||||
|
||||
{/* Filter tabs: All / Favorite — always visible, disabled when not local */}
|
||||
<div className="ml-auto">
|
||||
<Tabs
|
||||
value={filter}
|
||||
onValueChange={(v) => setFilter(v as PeopleFilter)}
|
||||
>
|
||||
<TabsList>
|
||||
<TabsTrigger value="all" disabled={!localOnly}>
|
||||
All
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="favorite" disabled={!localOnly}>
|
||||
<Heart className="mr-1 h-3 w-3" />
|
||||
Favorite
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
{/* Filter tabs: All / Favorite — always visible, disabled when not local */}
|
||||
<div className="sm:ml-auto">
|
||||
<Tabs
|
||||
value={filter}
|
||||
onValueChange={(v) => setFilter(v as PeopleFilter)}
|
||||
>
|
||||
<TabsList>
|
||||
<TabsTrigger value="all" disabled={!localOnly}>
|
||||
All
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="favorite" disabled={!localOnly}>
|
||||
<Heart className="mr-1 h-3 w-3" />
|
||||
Favorite
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user