Complete frontend refactoring: UI enhancements, pagination, filtering, search architecture, and data management improvements
# Phase 1: Feature Implementation
- Add "Create new..." option in `AddEntryToCollectionDialog` for inline collection creation with auto-select
- Implement lazy loading pagination with IntersectionObserver for Watchlist, Collections, and Media pages
- Add reusable useDebounce hook (300-400ms) and apply to all search inputs across pages
- Reset scroll position to top when switching between sidebar navigation pages via useLocation()
- Reorganize MediaPage with horizontal control layout, add Media Type filter (All/Audio/Video), and Custom Media filter (Show All/Official Only/Custom Only)
- Add three-dot menu (MoreHorizontal icon) to collection cards with Edit/Delete options and "Get all parts" feature
- Replace numeric rating input with interactive star rating component in EditCollectionDialog (0-10 stars with half-star support)
- Display entry type badges ("Movie" / "TV Series") on home page trending/popular sections and search results
- Create PeopleSearchResult component with profile images; integrate useTmdbSearchPeople hook linking to `/people/tmdb/:tmdbId`
- Add TMDB Rating and User Rating filters to Library page with range sliders (0-10, step 1) and state persistence in useLibraryStore
- Add All/Movies/TV Series type filter to Watchlist page with filtered count display
- Improve People Details page mobile UI: optimize header, info section sizing, and filmography card layouts for touch
# Phase 2: Architecture Refactoring & Bug Fixes
- Fix scroll-to-top on sidebar navigation by constraining AppLayout root to `h-screen overflow-hidden` so `<main>` becomes proper scroll container
- Extract search from HomePage into dedicated SearchPage component with `/search` route, debounced input, and URL query sync via SearchParams
- Add Search nav item with icon to sidebar for easy search access
- HomePage search input now navigates to `/search?q=...` instead of handling inline, separating concerns and enabling search bookmarking
- Entry type pill badges now conditionally render via `showTypeBadge` prop on EntryCard—only SearchPage passes this to prevent display on home/discover pages
- Fix people ID bug: people search results now link to `/people/tmdb/:tmdbId` (TMDB redirect route) instead of `/people/:id`, correctly mapping TMDB IDs to local database IDs through PersonTmdbRedirectPage
- Enhance People Details filmography sorting: "Not in Library" section now detects self roles (self/themselves/himself/herself) and sorts non-self by release date (new→old) with all self roles pushed to end of list
# Summary
- Created new files: SearchPage.tsx, useDebounce.ts
This commit is contained in:
1 parent
d28b4caa7e
commit
9a8ee181e5
23 files changed
+680
-188
No files matched your search
@@ -25,11 +25,11 @@ export function PersonDetailsPage() {
|
||||
if (isLoading || !person) {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex gap-6">
|
||||
<Skeleton className="h-48 w-48 rounded-full" />
|
||||
<div className="flex-1 space-y-3">
|
||||
<Skeleton className="h-8 w-48" />
|
||||
<Skeleton className="h-4 w-32" />
|
||||
<div className="flex flex-col items-center gap-4 sm:flex-row sm:items-start sm:gap-6">
|
||||
<Skeleton className="h-32 w-32 rounded-full sm:h-48 sm:w-48" />
|
||||
<div className="flex-1 space-y-3 w-full">
|
||||
<Skeleton className="h-8 w-48 mx-auto sm:mx-0" />
|
||||
<Skeleton className="h-4 w-32 mx-auto sm:mx-0" />
|
||||
<Skeleton className="h-20 w-full" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,16 +39,16 @@ export function PersonDetailsPage() {
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<div className="flex gap-8">
|
||||
<Avatar className="h-48 w-48 shrink-0">
|
||||
<div className="flex flex-col items-center gap-4 sm:flex-row sm:items-start sm:gap-8">
|
||||
<Avatar className="h-32 w-32 shrink-0 sm:h-48 sm:w-48">
|
||||
<AvatarImage src={getProfileUrl(person.profile_path)} alt={person.name} />
|
||||
<AvatarFallback className="text-3xl">
|
||||
<AvatarFallback className="text-2xl sm:text-3xl">
|
||||
{person.name.split(' ').map((n: string) => n[0]).join('')}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="space-y-3">
|
||||
<h1 className="text-3xl font-bold">{person.name}</h1>
|
||||
<div className="flex flex-wrap items-center gap-3 text-sm text-muted-foreground">
|
||||
<div className="space-y-2 text-center sm:text-left sm:space-y-3">
|
||||
<h1 className="text-2xl font-bold sm:text-3xl">{person.name}</h1>
|
||||
<div className="flex flex-wrap items-center justify-center gap-2 text-sm text-muted-foreground sm:justify-start sm:gap-3">
|
||||
{person.known_for_department && <span>{person.known_for_department}</span>}
|
||||
{person.birthday && (<><span>•</span><span>Born: {formatDate(person.birthday)}</span></>)}
|
||||
{person.deathday && (<><span>•</span><span>Died: {formatDate(person.deathday)}</span></>)}
|
||||
@@ -85,7 +85,7 @@ function FilmographySection({ libraryMap, libraryLoaded, tmdbFilmography, tmdbLo
|
||||
const [libraryPage, setLibraryPage] = useState(0);
|
||||
const [otherPage, setOtherPage] = useState(0);
|
||||
const PAGE_SIZE = 6; // 6 cols × 1 row
|
||||
const GRID = 'grid grid-cols-3 gap-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6';
|
||||
const GRID = 'grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6';
|
||||
|
||||
if (tmdbLoading || !libraryLoaded) {
|
||||
return (
|
||||
@@ -121,7 +121,25 @@ function FilmographySection({ libraryMap, libraryLoaded, tmdbFilmography, tmdbLo
|
||||
// Sort by popularity descending
|
||||
const sorted = [...dedupedCredits].sort((a, b) => (b.popularity ?? 0) - (a.popularity ?? 0));
|
||||
const libraryCredits = sorted.filter((c) => tmdbIdToLibraryEntry.has(c.id));
|
||||
const otherCredits = sorted.filter((c) => !tmdbIdToLibraryEntry.has(c.id));
|
||||
|
||||
// "Not in library": sort by release date (new→old), push "self" roles to the end
|
||||
const isSelfRole = (character?: string) => {
|
||||
if (!character) return false;
|
||||
const lower = character.toLowerCase().trim();
|
||||
return lower === 'self' || lower.startsWith('self -') || lower.startsWith('self (') || lower === 'themselves' || lower === 'himself' || lower === 'herself';
|
||||
};
|
||||
const otherCreditsSorted = sorted
|
||||
.filter((c) => !tmdbIdToLibraryEntry.has(c.id))
|
||||
.sort((a, b) => {
|
||||
const aSelf = isSelfRole(a.character) ? 1 : 0;
|
||||
const bSelf = isSelfRole(b.character) ? 1 : 0;
|
||||
if (aSelf !== bSelf) return aSelf - bSelf;
|
||||
// Both same self status → sort by date descending (new first)
|
||||
const dateA = new Date(a.release_date || a.first_air_date || '1900').getTime();
|
||||
const dateB = new Date(b.release_date || b.first_air_date || '1900').getTime();
|
||||
return dateB - dateA;
|
||||
});
|
||||
const otherCredits = otherCreditsSorted;
|
||||
|
||||
if (sorted.length === 0) {
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user