feat(react): add toasts, loading states, skeletons, animations, and mobile responsiveness
- Toast notifications (sonner): success/error toasts on all mutations - Loading spinners: EntryCard add/remove, ConfirmDialog, EntrySeenDialog, favorite/refresh buttons - Page skeletons: 13 page-specific Suspense fallbacks replacing generic skeleton - CSS animations: card-enter (staggered), page-enter, slide-up-fade keyframes - Mobile layout: hamburger menu with sheet sidebar, responsive entry details - Mobile controls: separate compact filter/sort popovers for Library and Watchlist - Desktop sort: popover menu replacing Select dropdown on Library and Watchlist - Filter ranges: year 1950-2100, rating 0-10
This commit is contained in:
1 parent
ae67663623
commit
d60d142d17
29 files changed
+1008
-226
No files matched your search
@@ -4,7 +4,6 @@ import { useEntry, useEntrySeasons, useRefreshEntry } from '@/hooks/useEntries';
|
||||
import { useEntrySeenByEntry, useDeleteEntrySeen } from '@/hooks/useEntrySeen';
|
||||
import { useCollections } from '@/hooks/useCollections';
|
||||
import { useLibraryStore } from '@/stores/useLibraryStore';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
@@ -25,6 +24,7 @@ import {
|
||||
ImageIcon,
|
||||
Settings,
|
||||
Star,
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
Tooltip,
|
||||
@@ -40,6 +40,7 @@ import { EntrySeenDialog } from '@/components/dialogs/EntrySeenDialog';
|
||||
import { EntryMediaDialog } from '@/components/dialogs/EntryMediaDialog';
|
||||
import { AddEntryToCollectionDialog } from '@/components/dialogs/AddEntryToCollectionDialog';
|
||||
import { RatingDialog } from '@/components/dialogs/RatingDialog';
|
||||
import { EntryDetailsSkeleton } from '@/components/skeletons/PageSkeletons';
|
||||
import {
|
||||
getPosterUrl,
|
||||
getBackdropUrl,
|
||||
@@ -107,9 +108,9 @@ export function EntryDetailsPage() {
|
||||
{/* Main content */}
|
||||
<div className="mx-auto max-w-4xl">
|
||||
{/* Two-column header: sticky poster | info */}
|
||||
<div className="flex gap-8 -mt-24 relative items-start">
|
||||
<div className="flex flex-col gap-6 -mt-16 relative items-start sm:flex-row sm:gap-8 sm:-mt-24">
|
||||
{/* LEFT: Sticky poster + actions */}
|
||||
<div className="sticky top-20 w-44 shrink-0 space-y-3 self-start">
|
||||
<div className="sm:sticky sm:top-20 w-32 sm:w-44 shrink-0 space-y-3 self-start mx-auto sm:mx-0">
|
||||
<img
|
||||
src={poster}
|
||||
alt={e.title}
|
||||
@@ -121,8 +122,13 @@ export function EntryDetailsPage() {
|
||||
size="sm"
|
||||
className="w-full justify-start"
|
||||
onClick={toggleFavorite}
|
||||
disabled={updateEntry.isPending}
|
||||
>
|
||||
<Heart className={`mr-2 h-4 w-4 ${e.favorit ? 'fill-current' : ''}`} />
|
||||
{updateEntry.isPending ? (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
<Heart className={`mr-2 h-4 w-4 ${e.favorit ? 'fill-current' : ''}`} />
|
||||
)}
|
||||
{e.favorit ? 'Favorited' : 'Favorite'}
|
||||
</Button>
|
||||
|
||||
@@ -156,9 +162,9 @@ export function EntryDetailsPage() {
|
||||
<EyeOff className="mr-2 h-4 w-4" />
|
||||
{e.hidden ? 'Unhide' : 'Hide'}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => refreshEntry.mutate(e.id)}>
|
||||
<RefreshCw className="mr-2 h-4 w-4" />
|
||||
Refresh details
|
||||
<DropdownMenuItem onClick={() => refreshEntry.mutate(e.id)} disabled={refreshEntry.isPending}>
|
||||
<RefreshCw className={`mr-2 h-4 w-4 ${refreshEntry.isPending ? 'animate-spin' : ''}`} />
|
||||
{refreshEntry.isPending ? 'Refreshing...' : 'Refresh details'}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setShowCollectionDialog(true)}>
|
||||
<FolderPlus className="mr-2 h-4 w-4" />
|
||||
@@ -409,23 +415,3 @@ function EntryCollectionsSection({ entryId }: { entryId: number }) {
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function EntryDetailsSkeleton() {
|
||||
return (
|
||||
<div>
|
||||
<div className="h-52 -mx-6 -mt-6 bg-muted animate-pulse" />
|
||||
<div className="max-w-4xl mx-auto flex gap-8 -mt-24">
|
||||
<Skeleton className="h-64 w-44 shrink-0 rounded-xl" />
|
||||
<div className="flex-1 space-y-4 pt-24">
|
||||
<Skeleton className="h-8 w-64" />
|
||||
<Skeleton className="h-4 w-32" />
|
||||
<Skeleton className="h-4 w-80" />
|
||||
<div className="flex gap-2">
|
||||
<Skeleton className="h-6 w-16" />
|
||||
<Skeleton className="h-6 w-12" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user