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
@@ -18,13 +18,15 @@ type SortDir = 'asc' | 'desc';
|
||||
|
||||
interface Filters {
|
||||
genre: string;
|
||||
ratingMin: string;
|
||||
ratingMax: string;
|
||||
tmdbRatingMin: string;
|
||||
tmdbRatingMax: string;
|
||||
userRatingMin: string;
|
||||
userRatingMax: string;
|
||||
yearMin: string;
|
||||
yearMax: string;
|
||||
}
|
||||
|
||||
const defaultFilters: Filters = { genre: '', ratingMin: '', ratingMax: '', yearMin: '', yearMax: '' };
|
||||
const defaultFilters: Filters = { genre: '', tmdbRatingMin: '', tmdbRatingMax: '', userRatingMin: '', userRatingMax: '', yearMin: '', yearMax: '' };
|
||||
|
||||
const sortLabels: Record<SortField, string> = {
|
||||
date_last_seen: 'Last Watched',
|
||||
@@ -84,7 +86,7 @@ export function LibraryPage() {
|
||||
const ratingMin = searchParams.get('ratingMin') || '';
|
||||
const ratingMax = searchParams.get('ratingMax') || '';
|
||||
if (genre || ratingMin || ratingMax) {
|
||||
const newFilters = { ...defaultFilters, genre, ratingMin, ratingMax };
|
||||
const newFilters = { ...defaultFilters, genre, userRatingMin: ratingMin, userRatingMax: ratingMax };
|
||||
setFilters(newFilters);
|
||||
setDebouncedFilters(newFilters);
|
||||
// Clear URL params after applying
|
||||
@@ -116,7 +118,7 @@ export function LibraryPage() {
|
||||
return Array.from(set).sort();
|
||||
}, [allEntries]);
|
||||
|
||||
const hasActiveFilters = filters.genre || filters.ratingMin || filters.ratingMax || filters.yearMin || filters.yearMax;
|
||||
const hasActiveFilters = filters.genre || filters.tmdbRatingMin || filters.tmdbRatingMax || filters.userRatingMin || filters.userRatingMax || filters.yearMin || filters.yearMax;
|
||||
|
||||
const baseEntries = useMemo(() => {
|
||||
switch (activeTab) {
|
||||
@@ -144,12 +146,20 @@ export function LibraryPage() {
|
||||
if (debouncedFilters.genre) {
|
||||
result = result.filter((e) => e.genres?.some((g) => g.name === debouncedFilters.genre));
|
||||
}
|
||||
if (debouncedFilters.ratingMin) {
|
||||
const min = parseFloat(debouncedFilters.ratingMin);
|
||||
if (debouncedFilters.tmdbRatingMin) {
|
||||
const min = parseFloat(debouncedFilters.tmdbRatingMin);
|
||||
result = result.filter((e) => (e.entryRatings?.tmdb_rating ?? 0) >= min);
|
||||
}
|
||||
if (debouncedFilters.tmdbRatingMax) {
|
||||
const max = parseFloat(debouncedFilters.tmdbRatingMax);
|
||||
result = result.filter((e) => (e.entryRatings?.tmdb_rating ?? 0) <= max);
|
||||
}
|
||||
if (debouncedFilters.userRatingMin) {
|
||||
const min = parseFloat(debouncedFilters.userRatingMin);
|
||||
result = result.filter((e) => (e.entryRatings?.user_rating ?? 0) >= min);
|
||||
}
|
||||
if (debouncedFilters.ratingMax) {
|
||||
const max = parseFloat(debouncedFilters.ratingMax);
|
||||
if (debouncedFilters.userRatingMax) {
|
||||
const max = parseFloat(debouncedFilters.userRatingMax);
|
||||
result = result.filter((e) => (e.entryRatings?.user_rating ?? 0) <= max);
|
||||
}
|
||||
if (debouncedFilters.yearMin) {
|
||||
@@ -260,7 +270,7 @@ export function LibraryPage() {
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-72 space-y-4" align="end">
|
||||
<div className="space-y-2">
|
||||
<div className="">
|
||||
<label className="text-sm font-medium">Genre</label>
|
||||
<Select value={filters.genre} onValueChange={(v) => setFilters((f) => ({ ...f, genre: v === '_all' ? '' : (v || '') }))}>
|
||||
<SelectTrigger className="h-9"><SelectValue placeholder="All genres" /></SelectTrigger>
|
||||
@@ -270,15 +280,23 @@ export function LibraryPage() {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium">Rating Range</label>
|
||||
<div className="">
|
||||
<label className="text-sm font-medium">TMDB Rating</label>
|
||||
<div className="flex items-center gap-2">
|
||||
<Input type="number" placeholder="Min" min={0} max={10} step={0.1} value={filters.ratingMin} onChange={(e) => setFilters((f) => ({ ...f, ratingMin: e.target.value }))} className="h-9" />
|
||||
<Input type="number" placeholder="Min" min={0} max={10} step={1} value={filters.tmdbRatingMin} onChange={(e) => setFilters((f) => ({ ...f, tmdbRatingMin: e.target.value }))} className="h-9" />
|
||||
<span className="text-muted-foreground">–</span>
|
||||
<Input type="number" placeholder="Max" min={0} max={10} step={0.1} value={filters.ratingMax} onChange={(e) => setFilters((f) => ({ ...f, ratingMax: e.target.value }))} className="h-9" />
|
||||
<Input type="number" placeholder="Max" min={0} max={10} step={1} value={filters.tmdbRatingMax} onChange={(e) => setFilters((f) => ({ ...f, tmdbRatingMax: e.target.value }))} className="h-9" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<div className="">
|
||||
<label className="text-sm font-medium">User Rating</label>
|
||||
<div className="flex items-center gap-2">
|
||||
<Input type="number" placeholder="Min" min={0} max={10} step={1} value={filters.userRatingMin} onChange={(e) => setFilters((f) => ({ ...f, userRatingMin: e.target.value }))} className="h-9" />
|
||||
<span className="text-muted-foreground">–</span>
|
||||
<Input type="number" placeholder="Max" min={0} max={10} step={1} value={filters.userRatingMax} onChange={(e) => setFilters((f) => ({ ...f, userRatingMax: e.target.value }))} className="h-9" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="">
|
||||
<label className="text-sm font-medium">Year Range</label>
|
||||
<div className="flex items-center gap-2">
|
||||
<Input type="number" placeholder="From" min={1950} max={2100} value={filters.yearMin} onChange={(e) => setFilters((f) => ({ ...f, yearMin: e.target.value }))} className="h-9" />
|
||||
@@ -371,22 +389,30 @@ export function LibraryPage() {
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-72 space-y-4" align="end">
|
||||
<div className="space-y-2">
|
||||
<div className="space-y-2 mb-0">
|
||||
<label className="text-sm font-medium">Genre</label>
|
||||
<Select value={filters.genre} onValueChange={(v) => setFilters((f) => ({ ...f, genre: v === '_all' ? '' : (v || '') }))}>
|
||||
<SelectTrigger className="h-9"><SelectValue placeholder="All genres" /></SelectTrigger>
|
||||
<Select value={filters.genre} onValueChange={(v) => setFilters((f) => ({ ...f, genre: v === '_all' ? '' : (v || '') }))}>
|
||||
<SelectTrigger className="h-9 w-full"><SelectValue placeholder="All genres" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="_all">All genres</SelectItem>
|
||||
{allGenres.map((g) => <SelectItem key={g} value={g}>{g}</SelectItem>)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium">Rating Range</label>
|
||||
<div className="space-y-2 mb-0">
|
||||
<label className="text-sm font-medium">TMDB Rating</label>
|
||||
<div className="flex items-center gap-2">
|
||||
<Input type="number" placeholder="Min" min={0} max={10} step={0.1} value={filters.ratingMin} onChange={(e) => setFilters((f) => ({ ...f, ratingMin: e.target.value }))} className="h-9" />
|
||||
<Input type="number" placeholder="Min" min={0} max={10} step={1} value={filters.tmdbRatingMin} onChange={(e) => setFilters((f) => ({ ...f, tmdbRatingMin: e.target.value }))} className="h-9" />
|
||||
<span className="text-muted-foreground">–</span>
|
||||
<Input type="number" placeholder="Max" min={0} max={10} step={0.1} value={filters.ratingMax} onChange={(e) => setFilters((f) => ({ ...f, ratingMax: e.target.value }))} className="h-9" />
|
||||
<Input type="number" placeholder="Max" min={0} max={10} step={1} value={filters.tmdbRatingMax} onChange={(e) => setFilters((f) => ({ ...f, tmdbRatingMax: e.target.value }))} className="h-9" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2 mb-0">
|
||||
<label className="text-sm font-medium">User Rating</label>
|
||||
<div className="flex items-center gap-2">
|
||||
<Input type="number" placeholder="Min" min={0} max={10} step={1} value={filters.userRatingMin} onChange={(e) => setFilters((f) => ({ ...f, userRatingMin: e.target.value }))} className="h-9" />
|
||||
<span className="text-muted-foreground">–</span>
|
||||
<Input type="number" placeholder="Max" min={0} max={10} step={1} value={filters.userRatingMax} onChange={(e) => setFilters((f) => ({ ...f, userRatingMax: e.target.value }))} className="h-9" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
|
||||
Reference in new issue
Block a user