From 3b882c9c3545ca148e564ef16b7cbcf96291d62c Mon Sep 17 00:00:00 2001 From: Mohammed Abad Date: Wed, 29 Apr 2026 16:56:19 +0100 Subject: [PATCH] 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 --- react_frontend/src/pages/CalendarPage.tsx | 281 +++++++++++++++--- react_frontend/src/pages/EntryCastsPage.tsx | 129 ++++---- react_frontend/src/pages/EntryDetailsPage.tsx | 27 +- react_frontend/src/pages/PeoplePage.tsx | 60 ++-- 4 files changed, 362 insertions(+), 135 deletions(-) diff --git a/react_frontend/src/pages/CalendarPage.tsx b/react_frontend/src/pages/CalendarPage.tsx index 93fd761..4af6a59 100644 --- a/react_frontend/src/pages/CalendarPage.tsx +++ b/react_frontend/src/pages/CalendarPage.tsx @@ -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 ( -
+

Calendar

@@ -58,28 +63,85 @@ export function CalendarPage() { > + +
- {/* Calendar Grid — fills remaining height */} + {/* Calendar Grid / List — fills remaining height */} -
- {/* Day headers */} -
- {DAYS.map((day) => ( -
- {day} -
- ))} + {selectedDay && ( + setSelectedDay(null)} + /> + )} + {viewMode === 'grid' ? ( +
+ {/* Day headers */} +
+ {DAYS.map((day) => ( +
+ {day} +
+ ))} +
+ + {/* Day cells — no scroll, rows share the remaining height equally */} +
+ {/* Empty cells for offset */} + {Array.from({ length: startDayOfWeek }).map((_, i) => ( +
+ ))} + + {days.map((day) => { + const key = format(day, 'yyyy-MM-dd'); + const dayEpisodes = episodesByDate.get(key) || []; + const isToday = isSameDay(day, new Date()); + + return ( +
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' : ''}`} + > + + {format(day, 'd')} + +
+ {dayEpisodes.slice(0, 3).map((ep) => ( + + ))} + {dayEpisodes.length > 3 && ( + + +{dayEpisodes.length - 3} + + )} +
+
+ ); + })} +
- - {/* Day cells */} -
- {/* Empty cells for offset */} - {Array.from({ length: startDayOfWeek }).map((_, i) => ( -
- ))} - + ) : ( + /* List / Agenda view */ +
{days.map((day) => { const key = format(day, 'yyyy-MM-dd'); const dayEpisodes = episodesByDate.get(key) || []; @@ -88,40 +150,57 @@ export function CalendarPage() { return (
0 + ? 'border-border' + : 'border-transparent' }`} > - 0 ? 'border-b border-border/40' : '' }`} > - {format(day, 'd')} - -
- {dayEpisodes.slice(0, 4).map((ep) => ( - - ))} - {dayEpisodes.length > 4 && ( - - +{dayEpisodes.length - 4} more + + {format(day, 'd')} + + + {format(day, 'EEEE, MMM d')} + + {dayEpisodes.length > 0 && ( + + {dayEpisodes.length} ep{dayEpisodes.length !== 1 ? 's' : ''} )}
+ {dayEpisodes.length > 0 && ( +
+ {dayEpisodes.map((ep) => ( + + ))} +
+ )}
); })}
-
+ )}
); } -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 = ( +
+ {thumbSrc ? ( + {entryTitle} + ) : ( +
+ {entryTitle} +
+ )} +

+ {isMovie ? entryTitle : `${seasonLabel}${episodeLabel}`} +

+
+ ); + + return ( + + + {entryId ? ( + + {gridContent} + + ) : ( +
{gridContent}
+ )} +
+ +
+

{entryTitle}

+ {episode.name && ( +

{episode.name}

+ )} + {!isMovie && ( +

+ {seasonLabel} {episodeLabel} +

+ )} +
+
+
+ ); + } + + if (variant === 'dialog') { + const dialogContent = ( +
+ {thumbSrc ? ( + {entryTitle} + ) : ( +
+ {entryTitle} +
+ )} +
+

{entryTitle}

+ {!isMovie && ( +

+ {seasonLabel}{episodeLabel} +

+ )} + {episode.name && ( +

{episode.name}

+ )} +
+
+ ); + + return entryId ? ( + + {dialogContent} + + ) : ( +
{dialogContent}
+ ); + } + const content = ( -
+
{thumbSrc && ( )}
-

- {entryTitle || 'Unknown'} -

-

- {seasonLabel} {episodeLabel} +

+ {entryTitle}

+ {!isMovie && ( +

+ {seasonLabel} {episodeLabel} +

+ )}
); @@ -191,3 +361,20 @@ function EpisodeCalendarItem({ episode }: { episode: Episode }) { ); } + +function DayDialog({ date, episodes, onClose }: { date: Date; episodes: Episode[]; onClose: () => void }) { + return ( + !open && onClose()}> + + + {format(date, 'EEEE, MMMM d')} + +
+ {episodes.map((ep) => ( + + ))} +
+
+
+ ); +} diff --git a/react_frontend/src/pages/EntryCastsPage.tsx b/react_frontend/src/pages/EntryCastsPage.tsx index eec3147..5bd1584 100644 --- a/react_frontend/src/pages/EntryCastsPage.tsx +++ b/react_frontend/src/pages/EntryCastsPage.tsx @@ -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('order'); + const [sortField, setSortField] = useState('episode_count'); const [sortDir, setSortDir] = useState('asc'); - const [filter, setFilter] = useState('all'); + const [filter, setFilter] = useState('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 (
-
+
{Array.from({ length: 18 }).map((_, i) => (
- +
))} @@ -146,43 +157,53 @@ export function EntryCastsPage() { {/* Controls */}
- - - - - - - + {/* Left: search + count */} + setSearch(e.target.value)} + className="w-48" + /> + {sorted.length} {sorted.length === 1 ? 'credit' : 'credits'} + + {/* Right: filter + sort */} +
+ + + + + +
{/* Grid */} @@ -190,17 +211,17 @@ export function EntryCastsPage() {

No credits found.

) : ( <> -
+
{visible.map((credit) => ( ))}
{hasMore && (
-
+
{Array.from({ length: Math.min(PAGE_SIZE, sorted.length - visibleCount) }).map((_, i) => (
- +
))} @@ -230,11 +251,11 @@ function CreditCard({ credit, isTv }: { credit: Credit; isTv: boolean }) { return ( - + - + {credit.people?.name ?.split(' ') .map((n) => n[0]) @@ -242,14 +263,14 @@ function CreditCard({ credit, isTv }: { credit: Credit; isTv: boolean }) {
-

{credit.people?.name}

+

{credit.people?.name}

{roleLabel && ( -

+

{roleLabel}

)} {isTv && credit.episode_count != null && credit.episode_count > 0 && ( -

+

{credit.episode_count} {credit.episode_count === 1 ? 'episode' : 'episodes'}

)} diff --git a/react_frontend/src/pages/EntryDetailsPage.tsx b/react_frontend/src/pages/EntryDetailsPage.tsx index 0854845..2d7452d 100644 --- a/react_frontend/src/pages/EntryDetailsPage.tsx +++ b/react_frontend/src/pages/EntryDetailsPage.tsx @@ -190,11 +190,6 @@ export function EntryDetailsPage() { {/* LEFT: Sticky poster */}
- {e.favorit && ( -
- -
- )} {e.title} )} + {/* Favorite pill */} + + + + + + +

{e.favorit ? 'Remove from favorites' : 'Add to favorites'}

+
+
+
{/* Storyline */} diff --git a/react_frontend/src/pages/PeoplePage.tsx b/react_frontend/src/pages/PeoplePage.tsx index 29618b8..995fc79 100644 --- a/react_frontend/src/pages/PeoplePage.tsx +++ b/react_frontend/src/pages/PeoplePage.tsx @@ -93,8 +93,8 @@ export function PeoplePage() {

People

{/* Controls row */} -
-
+
+
- {/* Local DB toggle */} -
- - -
+
+ {/* Local DB toggle */} +
+ + +
- {/* Filter tabs: All / Favorite — always visible, disabled when not local */} -
- setFilter(v as PeopleFilter)} - > - - - All - - - - Favorite - - - + {/* Filter tabs: All / Favorite — always visible, disabled when not local */} +
+ setFilter(v as PeopleFilter)} + > + + + All + + + + Favorite + + + +