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
Generated
+11
@@ -24,6 +24,7 @@
|
|||||||
"react-router-dom": "^7.13.2",
|
"react-router-dom": "^7.13.2",
|
||||||
"recharts": "^3.8.1",
|
"recharts": "^3.8.1",
|
||||||
"shadcn": "^4.1.1",
|
"shadcn": "^4.1.1",
|
||||||
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.5.0",
|
"tailwind-merge": "^3.5.0",
|
||||||
"tw-animate-css": "^1.4.0",
|
"tw-animate-css": "^1.4.0",
|
||||||
"zod": "^4.3.6",
|
"zod": "^4.3.6",
|
||||||
@@ -6814,6 +6815,16 @@
|
|||||||
"integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
|
"integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/sonner": {
|
||||||
|
"version": "2.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.7.tgz",
|
||||||
|
"integrity": "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/source-map": {
|
"node_modules/source-map": {
|
||||||
"version": "0.6.1",
|
"version": "0.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
"react-router-dom": "^7.13.2",
|
"react-router-dom": "^7.13.2",
|
||||||
"recharts": "^3.8.1",
|
"recharts": "^3.8.1",
|
||||||
"shadcn": "^4.1.1",
|
"shadcn": "^4.1.1",
|
||||||
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.5.0",
|
"tailwind-merge": "^3.5.0",
|
||||||
"tw-animate-css": "^1.4.0",
|
"tw-animate-css": "^1.4.0",
|
||||||
"zod": "^4.3.6",
|
"zod": "^4.3.6",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { RouterProvider } from 'react-router-dom';
|
import { RouterProvider } from 'react-router-dom';
|
||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||||
import { TooltipProvider } from '@/components/ui/tooltip';
|
import { TooltipProvider } from '@/components/ui/tooltip';
|
||||||
|
import { Toaster } from '@/components/ui/sonner';
|
||||||
import { router } from './router';
|
import { router } from './router';
|
||||||
|
|
||||||
const queryClient = new QueryClient({
|
const queryClient = new QueryClient({
|
||||||
@@ -18,6 +19,7 @@ export function App() {
|
|||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<RouterProvider router={router} />
|
<RouterProvider router={router} />
|
||||||
|
<Toaster position="bottom-right" richColors closeButton duration={3000} />
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -63,8 +63,14 @@ export function CollectionsGrid({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<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 xl:grid-cols-6">
|
||||||
{collections.map((collection) => (
|
{collections.map((collection, index) => (
|
||||||
<CollectionCard key={collection.id} collection={collection} />
|
<div
|
||||||
|
key={collection.id}
|
||||||
|
className="animate-card-enter"
|
||||||
|
style={{ animationDelay: `${Math.min(index * 30, 300)}ms` }}
|
||||||
|
>
|
||||||
|
<CollectionCard collection={collection} />
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
DialogTitle,
|
DialogTitle,
|
||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { Loader2 } from 'lucide-react';
|
||||||
|
|
||||||
interface ConfirmDialogProps {
|
interface ConfirmDialogProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -17,6 +18,7 @@ interface ConfirmDialogProps {
|
|||||||
cancelLabel?: string;
|
cancelLabel?: string;
|
||||||
onConfirm: () => void;
|
onConfirm: () => void;
|
||||||
variant?: 'default' | 'destructive';
|
variant?: 'default' | 'destructive';
|
||||||
|
isLoading?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ConfirmDialog({
|
export function ConfirmDialog({
|
||||||
@@ -28,6 +30,7 @@ export function ConfirmDialog({
|
|||||||
cancelLabel = 'Cancel',
|
cancelLabel = 'Cancel',
|
||||||
onConfirm,
|
onConfirm,
|
||||||
variant = 'default',
|
variant = 'default',
|
||||||
|
isLoading = false,
|
||||||
}: ConfirmDialogProps) {
|
}: ConfirmDialogProps) {
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||||
@@ -37,13 +40,15 @@ export function ConfirmDialog({
|
|||||||
<DialogDescription>{description}</DialogDescription>
|
<DialogDescription>{description}</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
<Button variant="outline" onClick={() => onOpenChange(false)} disabled={isLoading}>
|
||||||
{cancelLabel}
|
{cancelLabel}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant={variant === 'destructive' ? 'destructive' : 'default'}
|
variant={variant === 'destructive' ? 'destructive' : 'default'}
|
||||||
onClick={onConfirm}
|
onClick={onConfirm}
|
||||||
|
disabled={isLoading}
|
||||||
>
|
>
|
||||||
|
{isLoading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
|
||||||
{confirmLabel}
|
{confirmLabel}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useForm } from 'react-hook-form';
|
|||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
import { CalendarIcon } from 'lucide-react';
|
import { CalendarIcon, Loader2 } from 'lucide-react';
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
@@ -239,10 +239,17 @@ export function EntrySeenDialog({
|
|||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => onOpenChange(false)}
|
onClick={() => onOpenChange(false)}
|
||||||
|
disabled={createEntrySeen.isPending || updateEntrySeen.isPending || createEpisodeSeen.isPending}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="submit">
|
<Button
|
||||||
|
type="submit"
|
||||||
|
disabled={createEntrySeen.isPending || updateEntrySeen.isPending || createEpisodeSeen.isPending}
|
||||||
|
>
|
||||||
|
{(createEntrySeen.isPending || updateEntrySeen.isPending || createEpisodeSeen.isPending) && (
|
||||||
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||||
|
)}
|
||||||
{mode === 'edit' ? 'Save Changes' : 'Mark as Watched'}
|
{mode === 'edit' ? 'Save Changes' : 'Mark as Watched'}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Plus, Trash2, Star } from 'lucide-react';
|
import { Plus, Trash2, Star, Loader2 } from 'lucide-react';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
@@ -76,13 +76,14 @@ export function EntryCard({ entry, tmdbEntry }: EntryCardProps) {
|
|||||||
|
|
||||||
const confirmRemove = () => {
|
const confirmRemove = () => {
|
||||||
if (libraryEntry) {
|
if (libraryEntry) {
|
||||||
deleteEntry.mutate(libraryEntry.id);
|
deleteEntry.mutate(libraryEntry.id, {
|
||||||
|
onSettled: () => setShowConfirm(false),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
setShowConfirm(false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const card = (
|
const card = (
|
||||||
<div className="group relative overflow-hidden rounded-lg transition-all duration-200 hover:scale-[1.02] hover:shadow-xl">
|
<div className="group relative overflow-hidden rounded-lg transition-all duration-300 hover:scale-[1.02] hover:shadow-xl animate-in fade-in zoom-in-95">
|
||||||
{/* Poster */}
|
{/* Poster */}
|
||||||
<div className="relative aspect-[2/3] w-full overflow-hidden rounded-lg bg-muted">
|
<div className="relative aspect-[2/3] w-full overflow-hidden rounded-lg bg-muted">
|
||||||
<img
|
<img
|
||||||
@@ -129,9 +130,14 @@ export function EntryCard({ entry, tmdbEntry }: EntryCardProps) {
|
|||||||
variant="destructive"
|
variant="destructive"
|
||||||
className="h-7 w-full text-xs"
|
className="h-7 w-full text-xs"
|
||||||
onClick={handleRemove}
|
onClick={handleRemove}
|
||||||
|
disabled={deleteEntry.isPending}
|
||||||
>
|
>
|
||||||
<Trash2 className="mr-1 h-3 w-3" />
|
{deleteEntry.isPending ? (
|
||||||
Remove
|
<Loader2 className="mr-1 h-3 w-3 animate-spin" />
|
||||||
|
) : (
|
||||||
|
<Trash2 className="mr-1 h-3 w-3" />
|
||||||
|
)}
|
||||||
|
{deleteEntry.isPending ? 'Removing...' : 'Remove'}
|
||||||
</Button>
|
</Button>
|
||||||
) : tmdbEntry ? (
|
) : tmdbEntry ? (
|
||||||
<Button
|
<Button
|
||||||
@@ -140,7 +146,11 @@ export function EntryCard({ entry, tmdbEntry }: EntryCardProps) {
|
|||||||
onClick={handleAdd}
|
onClick={handleAdd}
|
||||||
disabled={createEntry.isPending}
|
disabled={createEntry.isPending}
|
||||||
>
|
>
|
||||||
<Plus className="mr-1 h-3 w-3" />
|
{createEntry.isPending ? (
|
||||||
|
<Loader2 className="mr-1 h-3 w-3 animate-spin" />
|
||||||
|
) : (
|
||||||
|
<Plus className="mr-1 h-3 w-3" />
|
||||||
|
)}
|
||||||
{createEntry.isPending ? 'Adding...' : 'Add to Library'}
|
{createEntry.isPending ? 'Adding...' : 'Add to Library'}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ export function EntryLibraryGrid({
|
|||||||
<div
|
<div
|
||||||
key={entry.id}
|
key={entry.id}
|
||||||
ref={index === entries.length - 1 ? lastEntryRef : undefined}
|
ref={index === entries.length - 1 ? lastEntryRef : undefined}
|
||||||
|
className="animate-card-enter"
|
||||||
|
style={{ animationDelay: `${Math.min(index * 30, 300)}ms` }}
|
||||||
>
|
>
|
||||||
<EntryCard entry={entry} />
|
<EntryCard entry={entry} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -61,8 +61,14 @@ export function TrendingGrid({
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||||
{displayEntries.map((tmdbEntry) => (
|
{displayEntries.map((tmdbEntry, index) => (
|
||||||
<EntryCard key={tmdbEntry.id} tmdbEntry={tmdbEntry} />
|
<div
|
||||||
|
key={tmdbEntry.id}
|
||||||
|
className="animate-card-enter"
|
||||||
|
style={{ animationDelay: `${Math.min(index * 30, 300)}ms` }}
|
||||||
|
>
|
||||||
|
<EntryCard tmdbEntry={tmdbEntry} />
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,12 +1,45 @@
|
|||||||
import { Outlet } from 'react-router-dom';
|
import { Outlet } from 'react-router-dom';
|
||||||
import { Sidebar } from './Sidebar';
|
import { useState } from 'react';
|
||||||
|
import { Menu } from 'lucide-react';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import {
|
||||||
|
Sheet,
|
||||||
|
SheetContent,
|
||||||
|
SheetHeader,
|
||||||
|
SheetTitle,
|
||||||
|
} from '@/components/ui/sheet';
|
||||||
|
import { Sidebar, MobileSidebarContent } from './Sidebar';
|
||||||
|
|
||||||
export function AppLayout() {
|
export function AppLayout() {
|
||||||
|
const [mobileOpen, setMobileOpen] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-h-screen">
|
<div className="flex min-h-screen">
|
||||||
<Sidebar />
|
{/* Desktop sidebar */}
|
||||||
<main className="ml-56 flex-1 overflow-y-auto">
|
<div className="hidden md:block">
|
||||||
<div className="container mx-auto px-6 py-6">
|
<Sidebar />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Mobile header */}
|
||||||
|
<div className="fixed inset-x-0 top-0 z-40 flex h-14 items-center gap-3 border-b border-border bg-background px-4 md:hidden">
|
||||||
|
<Button variant="ghost" size="icon" onClick={() => setMobileOpen(true)}>
|
||||||
|
<Menu className="h-5 w-5" />
|
||||||
|
</Button>
|
||||||
|
<span className="text-lg font-bold">Showy</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Mobile sidebar sheet */}
|
||||||
|
<Sheet open={mobileOpen} onOpenChange={setMobileOpen}>
|
||||||
|
<SheetContent side="left" className="w-64 p-0" showCloseButton={false}>
|
||||||
|
<SheetHeader className="sr-only">
|
||||||
|
<SheetTitle>Navigation</SheetTitle>
|
||||||
|
</SheetHeader>
|
||||||
|
<MobileSidebarContent onNavigate={() => setMobileOpen(false)} />
|
||||||
|
</SheetContent>
|
||||||
|
</Sheet>
|
||||||
|
|
||||||
|
<main className="flex-1 overflow-y-auto md:ml-56">
|
||||||
|
<div className="container mx-auto px-4 py-4 pt-18 md:px-6 md:py-6 md:pt-6">
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export function Sidebar() {
|
|||||||
const { theme, toggleTheme } = useThemeStore();
|
const { theme, toggleTheme } = useThemeStore();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside className="fixed inset-y-0 left-0 z-50 flex w-56 flex-col border-r border-sidebar-border bg-sidebar">
|
<aside className="fixed inset-y-0 left-0 z-50 hidden md:flex w-56 flex-col border-r border-sidebar-border bg-sidebar">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<div className="flex h-14 items-center gap-2 px-4">
|
<div className="flex h-14 items-center gap-2 px-4">
|
||||||
<Film className="h-6 w-6 text-sidebar-primary" />
|
<Film className="h-6 w-6 text-sidebar-primary" />
|
||||||
@@ -134,3 +134,95 @@ export function Sidebar() {
|
|||||||
</aside>
|
</aside>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function MobileNavItem({
|
||||||
|
to,
|
||||||
|
icon: Icon,
|
||||||
|
label,
|
||||||
|
onClick,
|
||||||
|
}: {
|
||||||
|
to: string;
|
||||||
|
icon: React.ComponentType<{ className?: string }>;
|
||||||
|
label: string;
|
||||||
|
onClick?: () => void;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<NavLink
|
||||||
|
to={to}
|
||||||
|
end={to === '/'}
|
||||||
|
onClick={onClick}
|
||||||
|
className={({ isActive }) =>
|
||||||
|
`flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm transition-colors ${
|
||||||
|
isActive
|
||||||
|
? 'bg-sidebar-accent text-sidebar-primary font-medium'
|
||||||
|
: 'text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground'
|
||||||
|
}`
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Icon className="h-4 w-4 shrink-0" />
|
||||||
|
<span>{label}</span>
|
||||||
|
</NavLink>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MobileSidebarContent({ onNavigate }: { onNavigate: () => void }) {
|
||||||
|
const { theme, toggleTheme } = useThemeStore();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex h-full flex-col bg-sidebar">
|
||||||
|
{/* Logo */}
|
||||||
|
<div className="flex h-14 items-center gap-2 px-4">
|
||||||
|
<Film className="h-6 w-6 text-sidebar-primary" />
|
||||||
|
<span className="text-lg font-bold text-sidebar-foreground">Showy</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Separator className="bg-sidebar-border" />
|
||||||
|
|
||||||
|
{/* Nav */}
|
||||||
|
<nav className="flex-1 space-y-1 overflow-y-auto px-3 py-4">
|
||||||
|
<p className="mb-2 px-3 text-xs font-semibold uppercase tracking-wider text-sidebar-foreground/50">
|
||||||
|
Main
|
||||||
|
</p>
|
||||||
|
{mainNav.map((item) => (
|
||||||
|
<MobileNavItem key={item.to} {...item} onClick={onNavigate} />
|
||||||
|
))}
|
||||||
|
|
||||||
|
<Separator className="my-3 bg-sidebar-border" />
|
||||||
|
|
||||||
|
<p className="mb-2 px-3 text-xs font-semibold uppercase tracking-wider text-sidebar-foreground/50">
|
||||||
|
Library
|
||||||
|
</p>
|
||||||
|
{libraryNav.map((item) => (
|
||||||
|
<MobileNavItem key={item.to} {...item} onClick={onNavigate} />
|
||||||
|
))}
|
||||||
|
|
||||||
|
<Separator className="my-3 bg-sidebar-border" />
|
||||||
|
|
||||||
|
<p className="mb-2 px-3 text-xs font-semibold uppercase tracking-wider text-sidebar-foreground/50">
|
||||||
|
Other
|
||||||
|
</p>
|
||||||
|
{otherNav.map((item) => (
|
||||||
|
<MobileNavItem key={item.to} {...item} onClick={onNavigate} />
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
{/* Bottom actions */}
|
||||||
|
<div className="border-t border-sidebar-border px-3 py-3 space-y-1">
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
className="w-full justify-start gap-3 text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"
|
||||||
|
onClick={toggleTheme}
|
||||||
|
>
|
||||||
|
{theme === 'dark' ? (
|
||||||
|
<Sun className="h-4 w-4" />
|
||||||
|
) : (
|
||||||
|
<Moon className="h-4 w-4" />
|
||||||
|
)}
|
||||||
|
<span>{theme === 'dark' ? 'Light Mode' : 'Dark Mode'}</span>
|
||||||
|
</Button>
|
||||||
|
<MobileNavItem to="/settings" icon={Settings} label="Settings" onClick={onNavigate} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,313 @@
|
|||||||
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
|
import { Card, CardContent, CardHeader } from '@/components/ui/card';
|
||||||
|
|
||||||
|
export function DashboardSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-8 animate-in fade-in duration-300">
|
||||||
|
<Skeleton className="h-8 w-48" />
|
||||||
|
|
||||||
|
{/* Stats cards */}
|
||||||
|
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5">
|
||||||
|
{Array.from({ length: 5 }).map((_, i) => (
|
||||||
|
<Card key={i}>
|
||||||
|
<CardHeader className="flex flex-row items-center justify-between pb-2">
|
||||||
|
<Skeleton className="h-4 w-20" />
|
||||||
|
<Skeleton className="h-5 w-5 rounded" />
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<Skeleton className="h-8 w-16" />
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Chart skeletons */}
|
||||||
|
<Skeleton className="h-80 w-full rounded-xl" />
|
||||||
|
<Skeleton className="h-64 w-full rounded-xl" />
|
||||||
|
|
||||||
|
<div className="grid gap-4 lg:grid-cols-2">
|
||||||
|
<Skeleton className="h-64 rounded-xl" />
|
||||||
|
<Skeleton className="h-64 rounded-xl" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Recently Watched */}
|
||||||
|
<div className="space-y-4">
|
||||||
|
<Skeleton className="h-6 w-40" />
|
||||||
|
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||||
|
{Array.from({ length: 7 }).map((_, i) => (
|
||||||
|
<div key={i} className="space-y-2">
|
||||||
|
<Skeleton className="aspect-[2/3] w-full rounded-lg" />
|
||||||
|
<Skeleton className="h-3 w-3/4" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HomeSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-8 animate-in fade-in duration-300">
|
||||||
|
{/* Search */}
|
||||||
|
<Skeleton className="h-10 max-w-md rounded-lg" />
|
||||||
|
|
||||||
|
{/* Trending section */}
|
||||||
|
{[1, 2].map((section) => (
|
||||||
|
<div key={section} className="space-y-4">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<Skeleton className="h-6 w-32" />
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Skeleton className="h-8 w-40 rounded-lg" />
|
||||||
|
<Skeleton className="h-8 w-16" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||||
|
{Array.from({ length: 14 }).map((_, i) => (
|
||||||
|
<Skeleton key={i} className="aspect-[2/3] w-full rounded-lg" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LibrarySkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 animate-in fade-in duration-300">
|
||||||
|
<Skeleton className="h-8 w-32" />
|
||||||
|
|
||||||
|
{/* Controls */}
|
||||||
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
|
<Skeleton className="h-10 w-64 rounded-lg" />
|
||||||
|
<div className="flex-1" />
|
||||||
|
<Skeleton className="h-9 w-44" />
|
||||||
|
<Skeleton className="h-9 w-24" />
|
||||||
|
<Skeleton className="h-9 w-64 rounded-lg" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Grid */}
|
||||||
|
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||||
|
{Array.from({ length: 21 }).map((_, i) => (
|
||||||
|
<Skeleton key={i} className="aspect-[2/3] w-full rounded-lg" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WatchlistSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 animate-in fade-in duration-300">
|
||||||
|
<Skeleton className="h-8 w-36" />
|
||||||
|
|
||||||
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
|
<Skeleton className="h-10 w-64 rounded-lg" />
|
||||||
|
<div className="flex-1" />
|
||||||
|
<Skeleton className="h-9 w-44" />
|
||||||
|
<Skeleton className="h-9 w-24" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||||
|
{Array.from({ length: 14 }).map((_, i) => (
|
||||||
|
<Skeleton key={i} className="aspect-[2/3] w-full rounded-lg" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CollectionsSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 animate-in fade-in duration-300">
|
||||||
|
<Skeleton className="h-8 w-40" />
|
||||||
|
|
||||||
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
|
<Skeleton className="h-9 w-56 rounded-lg" />
|
||||||
|
<Skeleton className="h-10 w-64 rounded-lg" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6">
|
||||||
|
{Array.from({ length: 12 }).map((_, i) => (
|
||||||
|
<Skeleton key={i} className="aspect-[2/3] w-full rounded-lg" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CollectionDetailsSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 animate-in fade-in duration-300">
|
||||||
|
<Skeleton className="h-48 w-full rounded-xl sm:h-64" />
|
||||||
|
<Skeleton className="h-8 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">
|
||||||
|
{Array.from({ length: 6 }).map((_, i) => (
|
||||||
|
<Skeleton key={i} className="aspect-[2/3] w-full rounded-lg" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function EntryDetailsSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="animate-in fade-in duration-300">
|
||||||
|
<div className="h-52 -mx-6 -mt-6 bg-muted animate-pulse rounded-b-lg" />
|
||||||
|
<div className="max-w-4xl mx-auto flex gap-8 -mt-24">
|
||||||
|
<div className="w-44 shrink-0 space-y-3">
|
||||||
|
<Skeleton className="aspect-[2/3] w-full rounded-xl" />
|
||||||
|
<Skeleton className="h-9 w-full rounded-lg" />
|
||||||
|
<Skeleton className="h-9 w-full rounded-lg" />
|
||||||
|
<Skeleton className="h-9 w-full rounded-lg" />
|
||||||
|
</div>
|
||||||
|
<div className="flex-1 space-y-4 pt-24">
|
||||||
|
<Skeleton className="h-9 w-72" />
|
||||||
|
<Skeleton className="h-4 w-32" />
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<Skeleton className="h-5 w-12" />
|
||||||
|
<Skeleton className="h-5 w-16" />
|
||||||
|
<Skeleton className="h-5 w-20" />
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<Skeleton className="h-8 w-24 rounded-full" />
|
||||||
|
<Skeleton className="h-8 w-24 rounded-full" />
|
||||||
|
<Skeleton className="h-8 w-20 rounded-full" />
|
||||||
|
</div>
|
||||||
|
<Skeleton className="h-20 w-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function PeopleSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 animate-in fade-in duration-300">
|
||||||
|
<Skeleton className="h-8 w-28" />
|
||||||
|
<Skeleton className="h-10 max-w-xs rounded-lg" />
|
||||||
|
<div className="grid grid-cols-3 gap-4 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-8">
|
||||||
|
{Array.from({ length: 24 }).map((_, i) => (
|
||||||
|
<div key={i} className="flex flex-col items-center gap-2">
|
||||||
|
<Skeleton className="h-24 w-24 rounded-full" />
|
||||||
|
<Skeleton className="h-4 w-20" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function PersonDetailsSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-8 animate-in fade-in duration-300">
|
||||||
|
<div className="flex gap-6">
|
||||||
|
<Skeleton className="h-48 w-36 shrink-0 rounded-xl" />
|
||||||
|
<div className="flex-1 space-y-3">
|
||||||
|
<Skeleton className="h-8 w-48" />
|
||||||
|
<Skeleton className="h-4 w-32" />
|
||||||
|
<Skeleton className="h-4 w-24" />
|
||||||
|
<Skeleton className="h-16 w-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Skeleton className="h-6 w-32" />
|
||||||
|
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||||
|
{Array.from({ length: 7 }).map((_, i) => (
|
||||||
|
<Skeleton key={i} className="aspect-[2/3] w-full rounded-lg" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SeasonSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-8 animate-in fade-in duration-300">
|
||||||
|
<div className="flex gap-6">
|
||||||
|
<Skeleton className="h-56 w-36 shrink-0 rounded-lg" />
|
||||||
|
<div className="flex-1 space-y-3">
|
||||||
|
<Skeleton className="h-7 w-48" />
|
||||||
|
<Skeleton className="h-4 w-32" />
|
||||||
|
<Skeleton className="h-2 w-48 rounded-full" />
|
||||||
|
<Skeleton className="h-12 w-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Skeleton className="h-6 w-28" />
|
||||||
|
<div className="space-y-2">
|
||||||
|
{Array.from({ length: 8 }).map((_, i) => (
|
||||||
|
<div key={i} className="flex gap-4 rounded-lg border border-border p-3">
|
||||||
|
<Skeleton className="h-16 w-28 shrink-0 rounded" />
|
||||||
|
<div className="flex-1 space-y-2">
|
||||||
|
<Skeleton className="h-4 w-40" />
|
||||||
|
<Skeleton className="h-3 w-24" />
|
||||||
|
<Skeleton className="h-3 w-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function EpisodeSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 animate-in fade-in duration-300">
|
||||||
|
<Skeleton className="aspect-video w-full max-w-2xl rounded-xl" />
|
||||||
|
<div className="space-y-3">
|
||||||
|
<Skeleton className="h-8 w-64" />
|
||||||
|
<Skeleton className="h-4 w-32" />
|
||||||
|
<Skeleton className="h-16 w-full max-w-prose" />
|
||||||
|
</div>
|
||||||
|
<Skeleton className="h-6 w-32" />
|
||||||
|
<div className="space-y-2">
|
||||||
|
{Array.from({ length: 3 }).map((_, i) => (
|
||||||
|
<Skeleton key={i} className="h-12 w-full rounded-lg" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MediaSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 animate-in fade-in duration-300">
|
||||||
|
<Skeleton className="h-8 w-24" />
|
||||||
|
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5">
|
||||||
|
{Array.from({ length: 10 }).map((_, i) => (
|
||||||
|
<Skeleton key={i} className="aspect-[2/3] w-full rounded-lg" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CalendarSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 animate-in fade-in duration-300">
|
||||||
|
<Skeleton className="h-8 w-32" />
|
||||||
|
<Skeleton className="h-10 w-48" />
|
||||||
|
<div className="grid grid-cols-7 gap-2">
|
||||||
|
{Array.from({ length: 35 }).map((_, i) => (
|
||||||
|
<Skeleton key={i} className="h-24 rounded-lg" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SettingsSkeleton() {
|
||||||
|
return (
|
||||||
|
<div className="space-y-8 animate-in fade-in duration-300">
|
||||||
|
<Skeleton className="h-8 w-28" />
|
||||||
|
<div className="space-y-6 max-w-2xl">
|
||||||
|
{Array.from({ length: 4 }).map((_, i) => (
|
||||||
|
<div key={i} className="space-y-2">
|
||||||
|
<Skeleton className="h-5 w-32" />
|
||||||
|
<Skeleton className="h-10 w-full rounded-lg" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { Toaster as Sonner, type ToasterProps } from "sonner"
|
||||||
|
import { useThemeStore } from "@/stores/useThemeStore"
|
||||||
|
|
||||||
|
function Toaster({ ...props }: ToasterProps) {
|
||||||
|
const theme = useThemeStore((s) => s.theme)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Sonner
|
||||||
|
theme={theme}
|
||||||
|
className="toaster group"
|
||||||
|
toastOptions={{
|
||||||
|
classNames: {
|
||||||
|
toast:
|
||||||
|
"group toast group-[.toaster]:bg-card group-[.toaster]:text-card-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:rounded-xl",
|
||||||
|
description: "group-[.toast]:text-muted-foreground",
|
||||||
|
actionButton:
|
||||||
|
"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
||||||
|
cancelButton:
|
||||||
|
"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
|
||||||
|
success: "group-[.toaster]:!bg-green-500/10 group-[.toaster]:!border-green-500/20 group-[.toaster]:!text-green-600 dark:group-[.toaster]:!text-green-400",
|
||||||
|
error: "group-[.toaster]:!bg-destructive/10 group-[.toaster]:!border-destructive/20 group-[.toaster]:!text-destructive",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Toaster }
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
|
import { toast } from 'sonner';
|
||||||
import { collectionsApi } from '@/api/collections';
|
import { collectionsApi } from '@/api/collections';
|
||||||
|
|
||||||
export const collectionKeys = {
|
export const collectionKeys = {
|
||||||
@@ -30,6 +31,10 @@ export function useUpdateCollection() {
|
|||||||
onSuccess: (_data, variables) => {
|
onSuccess: (_data, variables) => {
|
||||||
queryClient.invalidateQueries({ queryKey: collectionKeys.detail(variables.id) });
|
queryClient.invalidateQueries({ queryKey: collectionKeys.detail(variables.id) });
|
||||||
queryClient.invalidateQueries({ queryKey: collectionKeys.all });
|
queryClient.invalidateQueries({ queryKey: collectionKeys.all });
|
||||||
|
toast.success('Collection updated');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to update collection');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
|
import { toast } from 'sonner';
|
||||||
import { entriesApi } from '@/api/entries';
|
import { entriesApi } from '@/api/entries';
|
||||||
import { useLibraryStore } from '@/stores/useLibraryStore';
|
import { useLibraryStore } from '@/stores/useLibraryStore';
|
||||||
import type { Entry } from '@/types';
|
import type { Entry } from '@/types';
|
||||||
@@ -54,6 +55,10 @@ export function useCreateEntry() {
|
|||||||
onSuccess: (entry) => {
|
onSuccess: (entry) => {
|
||||||
addEntry(entry);
|
addEntry(entry);
|
||||||
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
||||||
|
toast.success(`"${entry.title}" added to library`);
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to add entry to library');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -66,11 +71,13 @@ export function useUpdateEntry() {
|
|||||||
mutationFn: ({ id, data }: { id: number; data: Partial<Entry> }) =>
|
mutationFn: ({ id, data }: { id: number; data: Partial<Entry> }) =>
|
||||||
entriesApi.update(id, data),
|
entriesApi.update(id, data),
|
||||||
onSuccess: (entry) => {
|
onSuccess: (entry) => {
|
||||||
// Update library store immediately so the UI reflects the change
|
|
||||||
updateEntry(entry.id, entry);
|
updateEntry(entry.id, entry);
|
||||||
// Invalidate both the detail query and the library list
|
|
||||||
queryClient.invalidateQueries({ queryKey: entryKeys.detail(entry.id) });
|
queryClient.invalidateQueries({ queryKey: entryKeys.detail(entry.id) });
|
||||||
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
||||||
|
toast.success('Entry updated');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to update entry');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -84,6 +91,10 @@ export function useDeleteEntry() {
|
|||||||
onSuccess: (_data, id) => {
|
onSuccess: (_data, id) => {
|
||||||
removeEntry(id);
|
removeEntry(id);
|
||||||
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
||||||
|
toast.success('Entry removed from library');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to remove entry');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -97,6 +108,10 @@ export function useRefreshEntry() {
|
|||||||
onSuccess: (entry) => {
|
onSuccess: (entry) => {
|
||||||
updateEntry(entry.id, entry);
|
updateEntry(entry.id, entry);
|
||||||
queryClient.invalidateQueries({ queryKey: entryKeys.detail(entry.id) });
|
queryClient.invalidateQueries({ queryKey: entryKeys.detail(entry.id) });
|
||||||
|
toast.success('Entry details refreshed');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to refresh entry');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -115,6 +130,10 @@ export function useUpdateEntryRatings() {
|
|||||||
onSuccess: (_data, { id }) => {
|
onSuccess: (_data, { id }) => {
|
||||||
queryClient.invalidateQueries({ queryKey: entryKeys.detail(id) });
|
queryClient.invalidateQueries({ queryKey: entryKeys.detail(id) });
|
||||||
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
||||||
|
toast.success('Rating updated');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to update rating');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -127,6 +146,10 @@ export function useUploadMedia() {
|
|||||||
entriesApi.uploadMedia(id, formData),
|
entriesApi.uploadMedia(id, formData),
|
||||||
onSuccess: (_data, { id }) => {
|
onSuccess: (_data, { id }) => {
|
||||||
queryClient.invalidateQueries({ queryKey: entryKeys.detail(id) });
|
queryClient.invalidateQueries({ queryKey: entryKeys.detail(id) });
|
||||||
|
toast.success('Media uploaded successfully');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to upload media');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
|
import { toast } from 'sonner';
|
||||||
import { entrySeenApi } from '@/api/entry-seen';
|
import { entrySeenApi } from '@/api/entry-seen';
|
||||||
import { entryKeys } from './useEntries';
|
import { entryKeys } from './useEntries';
|
||||||
|
|
||||||
@@ -32,6 +33,10 @@ export function useCreateEntrySeen() {
|
|||||||
queryKey: entryKeys.detail(variables.entry_id),
|
queryKey: entryKeys.detail(variables.entry_id),
|
||||||
});
|
});
|
||||||
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
||||||
|
toast.success('Marked as watched');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to mark as watched');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -51,6 +56,10 @@ export function useUpdateEntrySeen() {
|
|||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: entrySeenKeys.byEntry(variables.data.entry_id),
|
queryKey: entrySeenKeys.byEntry(variables.data.entry_id),
|
||||||
});
|
});
|
||||||
|
toast.success('Watch record updated');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to update watch record');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -66,6 +75,10 @@ export function useDeleteEntrySeen() {
|
|||||||
queryKey: entrySeenKeys.byEntry(variables.entryId),
|
queryKey: entrySeenKeys.byEntry(variables.entryId),
|
||||||
});
|
});
|
||||||
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
queryClient.invalidateQueries({ queryKey: entryKeys.all });
|
||||||
|
toast.success('Watch record removed');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to remove watch record');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
|
import { toast } from 'sonner';
|
||||||
import { episodeSeenApi } from '@/api/episode-seen';
|
import { episodeSeenApi } from '@/api/episode-seen';
|
||||||
import { entryKeys } from './useEntries';
|
import { entryKeys } from './useEntries';
|
||||||
|
|
||||||
@@ -36,6 +37,10 @@ export function useCreateEpisodeSeen() {
|
|||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: entryKeys.seasons(variables.entry_id),
|
queryKey: entryKeys.seasons(variables.entry_id),
|
||||||
});
|
});
|
||||||
|
toast.success('Episode marked as watched');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to mark episode as watched');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -58,6 +63,10 @@ export function useUpdateEpisodeSeen() {
|
|||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: entryKeys.detail(variables.data.entry_id),
|
queryKey: entryKeys.detail(variables.data.entry_id),
|
||||||
});
|
});
|
||||||
|
toast.success('Episode watch record updated');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to update episode watch record');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -82,6 +91,10 @@ export function useDeleteEpisodeSeen() {
|
|||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: entryKeys.detail(variables.entryId),
|
queryKey: entryKeys.detail(variables.entryId),
|
||||||
});
|
});
|
||||||
|
toast.success('Episode watch record removed');
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
toast.error('Failed to remove episode watch record');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -130,9 +130,58 @@
|
|||||||
}
|
}
|
||||||
html {
|
html {
|
||||||
@apply font-sans;
|
@apply font-sans;
|
||||||
|
scroll-behavior: smooth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Staggered card entrance animation */
|
||||||
|
@keyframes card-enter {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(12px) scale(0.97);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0) scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-card-enter {
|
||||||
|
animation: card-enter 0.35s ease-out both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Page entrance transition */
|
||||||
|
@keyframes page-enter {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(8px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-page-enter {
|
||||||
|
animation: page-enter 0.3s ease-out both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Slide-up for cards on hover */
|
||||||
|
@keyframes slide-up-fade {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(4px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-slide-up {
|
||||||
|
animation: slide-up-fade 0.2s ease-out both;
|
||||||
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
--background: oklch(0.15 0.01 260);
|
--background: oklch(0.15 0.01 260);
|
||||||
--foreground: oklch(0.95 0.01 260);
|
--foreground: oklch(0.95 0.01 260);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
// const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:4000/api/v1';
|
// const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:4000/api/v1';
|
||||||
const API_BASE_URL = import.meta.env.VITE_API_URL || '/api/v1';
|
const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://showyback.coolguy.space/api/v1';
|
||||||
|
|
||||||
export const api = axios.create({
|
export const api = axios.create({
|
||||||
baseURL: API_BASE_URL,
|
baseURL: API_BASE_URL,
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export function CollectionDetailsPage() {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6 animate-page-enter">
|
||||||
{/* Hero banner */}
|
{/* Hero banner */}
|
||||||
<div className="relative overflow-hidden rounded-xl">
|
<div className="relative overflow-hidden rounded-xl">
|
||||||
{backdropUrl ? (
|
{backdropUrl ? (
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export function CollectionsPage() {
|
|||||||
}, [collections, filter, search]);
|
}, [collections, filter, search]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6 animate-page-enter">
|
||||||
<h1 className="text-2xl font-bold">Collections</h1>
|
<h1 className="text-2xl font-bold">Collections</h1>
|
||||||
|
|
||||||
<div className="flex flex-wrap items-center gap-3">
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export function DashboardPage() {
|
|||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8">
|
<div className="space-y-8 animate-page-enter">
|
||||||
<h1 className="text-2xl font-bold">Dashboard</h1>
|
<h1 className="text-2xl font-bold">Dashboard</h1>
|
||||||
|
|
||||||
{/* Stats Grid */}
|
{/* Stats Grid */}
|
||||||
@@ -105,11 +105,12 @@ export function DashboardPage() {
|
|||||||
new Date(a.date_last_seen!).getTime()
|
new Date(a.date_last_seen!).getTime()
|
||||||
)
|
)
|
||||||
.slice(0, 14)
|
.slice(0, 14)
|
||||||
.map((entry) => (
|
.map((entry, index) => (
|
||||||
<Link
|
<Link
|
||||||
key={entry.id}
|
key={entry.id}
|
||||||
to={`/entry/${entry.id}`}
|
to={`/entry/${entry.id}`}
|
||||||
className="group transition-transform hover:scale-[1.02]"
|
className="group transition-transform hover:scale-[1.02] animate-card-enter"
|
||||||
|
style={{ animationDelay: `${Math.min(index * 30, 300)}ms` }}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src={getPosterUrl(entry)}
|
src={getPosterUrl(entry)}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { useEntry, useEntrySeasons, useRefreshEntry } from '@/hooks/useEntries';
|
|||||||
import { useEntrySeenByEntry, useDeleteEntrySeen } from '@/hooks/useEntrySeen';
|
import { useEntrySeenByEntry, useDeleteEntrySeen } from '@/hooks/useEntrySeen';
|
||||||
import { useCollections } from '@/hooks/useCollections';
|
import { useCollections } from '@/hooks/useCollections';
|
||||||
import { useLibraryStore } from '@/stores/useLibraryStore';
|
import { useLibraryStore } from '@/stores/useLibraryStore';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Separator } from '@/components/ui/separator';
|
import { Separator } from '@/components/ui/separator';
|
||||||
@@ -25,6 +24,7 @@ import {
|
|||||||
ImageIcon,
|
ImageIcon,
|
||||||
Settings,
|
Settings,
|
||||||
Star,
|
Star,
|
||||||
|
Loader2,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import {
|
import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
@@ -40,6 +40,7 @@ import { EntrySeenDialog } from '@/components/dialogs/EntrySeenDialog';
|
|||||||
import { EntryMediaDialog } from '@/components/dialogs/EntryMediaDialog';
|
import { EntryMediaDialog } from '@/components/dialogs/EntryMediaDialog';
|
||||||
import { AddEntryToCollectionDialog } from '@/components/dialogs/AddEntryToCollectionDialog';
|
import { AddEntryToCollectionDialog } from '@/components/dialogs/AddEntryToCollectionDialog';
|
||||||
import { RatingDialog } from '@/components/dialogs/RatingDialog';
|
import { RatingDialog } from '@/components/dialogs/RatingDialog';
|
||||||
|
import { EntryDetailsSkeleton } from '@/components/skeletons/PageSkeletons';
|
||||||
import {
|
import {
|
||||||
getPosterUrl,
|
getPosterUrl,
|
||||||
getBackdropUrl,
|
getBackdropUrl,
|
||||||
@@ -107,9 +108,9 @@ export function EntryDetailsPage() {
|
|||||||
{/* Main content */}
|
{/* Main content */}
|
||||||
<div className="mx-auto max-w-4xl">
|
<div className="mx-auto max-w-4xl">
|
||||||
{/* Two-column header: sticky poster | info */}
|
{/* 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 */}
|
{/* 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
|
<img
|
||||||
src={poster}
|
src={poster}
|
||||||
alt={e.title}
|
alt={e.title}
|
||||||
@@ -121,8 +122,13 @@ export function EntryDetailsPage() {
|
|||||||
size="sm"
|
size="sm"
|
||||||
className="w-full justify-start"
|
className="w-full justify-start"
|
||||||
onClick={toggleFavorite}
|
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'}
|
{e.favorit ? 'Favorited' : 'Favorite'}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
@@ -156,9 +162,9 @@ export function EntryDetailsPage() {
|
|||||||
<EyeOff className="mr-2 h-4 w-4" />
|
<EyeOff className="mr-2 h-4 w-4" />
|
||||||
{e.hidden ? 'Unhide' : 'Hide'}
|
{e.hidden ? 'Unhide' : 'Hide'}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={() => refreshEntry.mutate(e.id)}>
|
<DropdownMenuItem onClick={() => refreshEntry.mutate(e.id)} disabled={refreshEntry.isPending}>
|
||||||
<RefreshCw className="mr-2 h-4 w-4" />
|
<RefreshCw className={`mr-2 h-4 w-4 ${refreshEntry.isPending ? 'animate-spin' : ''}`} />
|
||||||
Refresh details
|
{refreshEntry.isPending ? 'Refreshing...' : 'Refresh details'}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={() => setShowCollectionDialog(true)}>
|
<DropdownMenuItem onClick={() => setShowCollectionDialog(true)}>
|
||||||
<FolderPlus className="mr-2 h-4 w-4" />
|
<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>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -27,7 +27,7 @@ export function HomePage() {
|
|||||||
const isSearching = searchQuery.length > 0;
|
const isSearching = searchQuery.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8">
|
<div className="space-y-8 animate-page-enter">
|
||||||
{/* Search */}
|
{/* Search */}
|
||||||
<div className="relative max-w-md">
|
<div className="relative max-w-md">
|
||||||
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
||||||
@@ -47,9 +47,15 @@ export function HomePage() {
|
|||||||
{searchEntries.length === 0 && !searchResults.isLoading ? (
|
{searchEntries.length === 0 && !searchResults.isLoading ? (
|
||||||
<p className="text-muted-foreground">No results found.</p>
|
<p className="text-muted-foreground">No results 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 2xl:grid-cols-7">
|
<div className="grid grid-cols-2 gap-3 sm:gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||||
{searchEntries.map((entry) => (
|
{searchEntries.map((entry, index) => (
|
||||||
<EntryCard key={entry.id} tmdbEntry={entry} />
|
<div
|
||||||
|
key={entry.id}
|
||||||
|
className="animate-card-enter"
|
||||||
|
style={{ animationDelay: `${Math.min(index * 30, 300)}ms` }}
|
||||||
|
>
|
||||||
|
<EntryCard tmdbEntry={entry} />
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -126,13 +126,141 @@ export function LibraryPage() {
|
|||||||
const clearFilters = useCallback(() => setFilters(defaultFilters), []);
|
const clearFilters = useCallback(() => setFilters(defaultFilters), []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6 animate-page-enter">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<h1 className="text-2xl font-bold">Library</h1>
|
<h1 className="text-2xl font-bold">Library</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Controls row: search left, sort + filter + tabs right */}
|
{/* ── Mobile controls (< md) ── */}
|
||||||
<div className="flex flex-wrap items-center gap-3">
|
<div className="flex flex-col gap-2 md:hidden">
|
||||||
|
{/* Row 1: search + sort dir + filter */}
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1">
|
||||||
|
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
||||||
|
<Input
|
||||||
|
placeholder="Search library..."
|
||||||
|
value={search}
|
||||||
|
onChange={(e) => setSearch(e.target.value)}
|
||||||
|
className="pl-10 h-9"
|
||||||
|
/>
|
||||||
|
{search && (
|
||||||
|
<button
|
||||||
|
onClick={() => setSearch('')}
|
||||||
|
className="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
|
||||||
|
>
|
||||||
|
<X className="h-4 w-4" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Sort (icon + popover on mobile) */}
|
||||||
|
<Popover>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button variant="outline" size="icon" className="h-9 w-9 shrink-0 relative">
|
||||||
|
<ArrowUpDown className="h-4 w-4" />
|
||||||
|
{sortField !== 'date_last_seen' && (
|
||||||
|
<span className="absolute -top-1 -right-1 h-2 w-2 rounded-full bg-primary" />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-52 space-y-3 p-3" align="end">
|
||||||
|
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">Sort by</p>
|
||||||
|
<div className="space-y-1">
|
||||||
|
{Object.entries(sortLabels).map(([value, label]) => (
|
||||||
|
<button
|
||||||
|
key={value}
|
||||||
|
onClick={() => setSortField(value as SortField)}
|
||||||
|
className={`w-full rounded-md px-3 py-1.5 text-left text-sm transition-colors ${
|
||||||
|
sortField === value
|
||||||
|
? 'bg-accent text-accent-foreground font-medium'
|
||||||
|
: 'hover:bg-accent/50'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-1 pt-1 border-t border-border">
|
||||||
|
<Button
|
||||||
|
variant={sortDir === 'desc' ? 'default' : 'outline'}
|
||||||
|
size="sm"
|
||||||
|
className="flex-1 h-8 text-xs"
|
||||||
|
onClick={() => setSortDir('desc')}
|
||||||
|
>
|
||||||
|
↓ Desc
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant={sortDir === 'asc' ? 'default' : 'outline'}
|
||||||
|
size="sm"
|
||||||
|
className="flex-1 h-8 text-xs"
|
||||||
|
onClick={() => setSortDir('asc')}
|
||||||
|
>
|
||||||
|
↑ Asc
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
|
||||||
|
{/* Filter */}
|
||||||
|
<Popover>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button variant="outline" size="icon" className="h-9 w-9 shrink-0 relative">
|
||||||
|
<SlidersHorizontal className="h-4 w-4" />
|
||||||
|
{hasActiveFilters && (
|
||||||
|
<span className="absolute -top-1 -right-1 h-2 w-2 rounded-full bg-primary" />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-72 space-y-4" align="end">
|
||||||
|
<div className="space-y-2">
|
||||||
|
<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>
|
||||||
|
<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="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" />
|
||||||
|
<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" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<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" />
|
||||||
|
<span className="text-muted-foreground">–</span>
|
||||||
|
<Input type="number" placeholder="To" min={1950} max={2100} value={filters.yearMax} onChange={(e) => setFilters((f) => ({ ...f, yearMax: e.target.value }))} className="h-9" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{hasActiveFilters && (
|
||||||
|
<Button variant="ghost" size="sm" className="w-full" onClick={clearFilters}>Clear Filters</Button>
|
||||||
|
)}
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Row 2: scrollable type tabs */}
|
||||||
|
<div className="overflow-x-auto pb-1">
|
||||||
|
<Tabs value={activeTab} onValueChange={(v) => setActiveTab(v as FilterTab)}>
|
||||||
|
<TabsList className="w-max">
|
||||||
|
<TabsTrigger value="all">All</TabsTrigger>
|
||||||
|
<TabsTrigger value="movies">Movies</TabsTrigger>
|
||||||
|
<TabsTrigger value="tv">TV</TabsTrigger>
|
||||||
|
<TabsTrigger value="favorites">Favorites</TabsTrigger>
|
||||||
|
<TabsTrigger value="hidden">Hidden</TabsTrigger>
|
||||||
|
</TabsList>
|
||||||
|
</Tabs>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* ── Desktop controls (≥ md) ── */}
|
||||||
|
<div className="hidden md:flex flex-wrap items-center gap-3">
|
||||||
{/* Search - far left */}
|
{/* Search - far left */}
|
||||||
<div className="relative flex-1 max-w-xs">
|
<div className="relative flex-1 max-w-xs">
|
||||||
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
||||||
@@ -150,31 +278,40 @@ export function LibraryPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Spacer */}
|
|
||||||
<div className="flex-1" />
|
<div className="flex-1" />
|
||||||
|
|
||||||
{/* Sort */}
|
{/* Sort */}
|
||||||
<div className="flex items-center gap-1">
|
<Popover>
|
||||||
<ArrowUpDown className="h-4 w-4 text-muted-foreground" />
|
<PopoverTrigger asChild>
|
||||||
<Select value={sortField} onValueChange={(v) => setSortField(v as SortField)}>
|
<Button variant="outline" size="sm" className="h-9 gap-1.5">
|
||||||
<SelectTrigger className="w-[160px] h-9">
|
<ArrowUpDown className="h-4 w-4" />
|
||||||
<SelectValue>{sortLabels[sortField]}</SelectValue>
|
{sortLabels[sortField]}
|
||||||
</SelectTrigger>
|
<span className="text-xs opacity-60">{sortDir === 'desc' ? '↓' : '↑'}</span>
|
||||||
<SelectContent>
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-52 space-y-3 p-3" align="end">
|
||||||
|
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">Sort by</p>
|
||||||
|
<div className="space-y-1">
|
||||||
{Object.entries(sortLabels).map(([value, label]) => (
|
{Object.entries(sortLabels).map(([value, label]) => (
|
||||||
<SelectItem key={value} value={value}>{label}</SelectItem>
|
<button
|
||||||
|
key={value}
|
||||||
|
onClick={() => setSortField(value as SortField)}
|
||||||
|
className={`w-full rounded-md px-3 py-1.5 text-left text-sm transition-colors ${
|
||||||
|
sortField === value
|
||||||
|
? 'bg-accent text-accent-foreground font-medium'
|
||||||
|
: 'hover:bg-accent/50'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</button>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</div>
|
||||||
</Select>
|
<div className="flex gap-1 pt-1 border-t border-border">
|
||||||
<Button
|
<Button variant={sortDir === 'desc' ? 'default' : 'outline'} size="sm" className="flex-1 h-8 text-xs" onClick={() => setSortDir('desc')}>↓ Desc</Button>
|
||||||
variant="ghost"
|
<Button variant={sortDir === 'asc' ? 'default' : 'outline'} size="sm" className="flex-1 h-8 text-xs" onClick={() => setSortDir('asc')}>↑ Asc</Button>
|
||||||
size="icon"
|
</div>
|
||||||
className="h-9 w-9"
|
</PopoverContent>
|
||||||
onClick={() => setSortDir((d) => (d === 'desc' ? 'asc' : 'desc'))}
|
</Popover>
|
||||||
>
|
|
||||||
<span className="text-xs font-medium">{sortDir === 'desc' ? '↓' : '↑'}</span>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Filter */}
|
{/* Filter */}
|
||||||
<Popover>
|
<Popover>
|
||||||
@@ -189,80 +326,37 @@ export function LibraryPage() {
|
|||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="text-sm font-medium">Genre</label>
|
<label className="text-sm font-medium">Genre</label>
|
||||||
<Select value={filters.genre} onValueChange={(v) => setFilters((f) => ({ ...f, genre: v === '_all' ? '' : v }))}>
|
<Select value={filters.genre} onValueChange={(v) => setFilters((f) => ({ ...f, genre: v === '_all' ? '' : v }))}>
|
||||||
<SelectTrigger className="h-9">
|
<SelectTrigger className="h-9"><SelectValue placeholder="All genres" /></SelectTrigger>
|
||||||
<SelectValue placeholder="All genres" />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="_all">All genres</SelectItem>
|
<SelectItem value="_all">All genres</SelectItem>
|
||||||
{allGenres.map((g) => (
|
{allGenres.map((g) => <SelectItem key={g} value={g}>{g}</SelectItem>)}
|
||||||
<SelectItem key={g} value={g}>{g}</SelectItem>
|
|
||||||
))}
|
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="text-sm font-medium">Rating Range</label>
|
<label className="text-sm font-medium">Rating Range</label>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Input
|
<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" />
|
||||||
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"
|
|
||||||
/>
|
|
||||||
<span className="text-muted-foreground">–</span>
|
<span className="text-muted-foreground">–</span>
|
||||||
<Input
|
<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" />
|
||||||
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"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="text-sm font-medium">Year Range</label>
|
<label className="text-sm font-medium">Year Range</label>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Input
|
<Input type="number" placeholder="From" min={1950} max={2100} value={filters.yearMin} onChange={(e) => setFilters((f) => ({ ...f, yearMin: e.target.value }))} className="h-9" />
|
||||||
type="number"
|
|
||||||
placeholder="From"
|
|
||||||
min={1900}
|
|
||||||
max={2099}
|
|
||||||
value={filters.yearMin}
|
|
||||||
onChange={(e) => setFilters((f) => ({ ...f, yearMin: e.target.value }))}
|
|
||||||
className="h-9"
|
|
||||||
/>
|
|
||||||
<span className="text-muted-foreground">–</span>
|
<span className="text-muted-foreground">–</span>
|
||||||
<Input
|
<Input type="number" placeholder="To" min={1950} max={2100} value={filters.yearMax} onChange={(e) => setFilters((f) => ({ ...f, yearMax: e.target.value }))} className="h-9" />
|
||||||
type="number"
|
|
||||||
placeholder="To"
|
|
||||||
min={1900}
|
|
||||||
max={2099}
|
|
||||||
value={filters.yearMax}
|
|
||||||
onChange={(e) => setFilters((f) => ({ ...f, yearMax: e.target.value }))}
|
|
||||||
className="h-9"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{hasActiveFilters && (
|
{hasActiveFilters && (
|
||||||
<Button variant="ghost" size="sm" className="w-full" onClick={clearFilters}>
|
<Button variant="ghost" size="sm" className="w-full" onClick={clearFilters}>Clear Filters</Button>
|
||||||
Clear Filters
|
|
||||||
</Button>
|
|
||||||
)}
|
)}
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
||||||
{/* Tabs */}
|
{/* Tabs */}
|
||||||
<Tabs
|
<Tabs value={activeTab} onValueChange={(v) => setActiveTab(v as FilterTab)}>
|
||||||
value={activeTab}
|
|
||||||
onValueChange={(v) => setActiveTab(v as FilterTab)}
|
|
||||||
>
|
|
||||||
<TabsList>
|
<TabsList>
|
||||||
<TabsTrigger value="all">All</TabsTrigger>
|
<TabsTrigger value="all">All</TabsTrigger>
|
||||||
<TabsTrigger value="movies">Movies</TabsTrigger>
|
<TabsTrigger value="movies">Movies</TabsTrigger>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export function PeoplePage() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6 animate-page-enter">
|
||||||
<h1 className="text-2xl font-bold">People</h1>
|
<h1 className="text-2xl font-bold">People</h1>
|
||||||
|
|
||||||
<div className="relative max-w-xs">
|
<div className="relative max-w-xs">
|
||||||
@@ -65,6 +65,8 @@ export function PeoplePage() {
|
|||||||
<div
|
<div
|
||||||
key={person.id}
|
key={person.id}
|
||||||
ref={index === people.length - 1 ? lastRef : undefined}
|
ref={index === people.length - 1 ? lastRef : undefined}
|
||||||
|
className="animate-card-enter"
|
||||||
|
style={{ animationDelay: `${Math.min(index * 20, 300)}ms` }}
|
||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
to={`/people/tmdb/${person.id}`}
|
to={`/people/tmdb/${person.id}`}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export function SeasonPage() {
|
|||||||
const progress = totalEpisodes > 0 ? (watchedCount / totalEpisodes) * 100 : 0;
|
const progress = totalEpisodes > 0 ? (watchedCount / totalEpisodes) * 100 : 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8">
|
<div className="space-y-8 animate-page-enter">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div className="flex gap-6">
|
<div className="flex gap-6">
|
||||||
<img
|
<img
|
||||||
|
|||||||
@@ -107,10 +107,104 @@ export function WatchlistPage() {
|
|||||||
const clearFilters = useCallback(() => setFilters(defaultFilters), []);
|
const clearFilters = useCallback(() => setFilters(defaultFilters), []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6 animate-page-enter">
|
||||||
<h1 className="text-2xl font-bold">Watchlist</h1>
|
<h1 className="text-2xl font-bold">Watchlist</h1>
|
||||||
|
|
||||||
<div className="flex flex-wrap items-center gap-3">
|
{/* ── Mobile controls (< md) ── */}
|
||||||
|
<div className="flex flex-col gap-2 md:hidden">
|
||||||
|
{/* Row 1: search + sort icon + filter icon */}
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="relative flex-1">
|
||||||
|
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
||||||
|
<Input
|
||||||
|
placeholder="Search watchlist..."
|
||||||
|
value={search}
|
||||||
|
onChange={(e) => setSearch(e.target.value)}
|
||||||
|
className="pl-10 h-9"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Sort popover */}
|
||||||
|
<Popover>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button variant="outline" size="icon" className="h-9 w-9 shrink-0 relative">
|
||||||
|
<ArrowUpDown className="h-4 w-4" />
|
||||||
|
{sortField !== 'createdAt' && (
|
||||||
|
<span className="absolute -top-1 -right-1 h-2 w-2 rounded-full bg-primary" />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-52 space-y-3 p-3" align="end">
|
||||||
|
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">Sort by</p>
|
||||||
|
<div className="space-y-1">
|
||||||
|
{Object.entries(sortLabels).map(([value, label]) => (
|
||||||
|
<button
|
||||||
|
key={value}
|
||||||
|
onClick={() => setSortField(value as SortField)}
|
||||||
|
className={`w-full rounded-md px-3 py-1.5 text-left text-sm transition-colors ${
|
||||||
|
sortField === value
|
||||||
|
? 'bg-accent text-accent-foreground font-medium'
|
||||||
|
: 'hover:bg-accent/50'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-1 pt-1 border-t border-border">
|
||||||
|
<Button variant={sortDir === 'desc' ? 'default' : 'outline'} size="sm" className="flex-1 h-8 text-xs" onClick={() => setSortDir('desc')}>↓ Desc</Button>
|
||||||
|
<Button variant={sortDir === 'asc' ? 'default' : 'outline'} size="sm" className="flex-1 h-8 text-xs" onClick={() => setSortDir('asc')}>↑ Asc</Button>
|
||||||
|
</div>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
|
||||||
|
{/* Filter popover */}
|
||||||
|
<Popover>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button variant="outline" size="icon" className="h-9 w-9 shrink-0 relative">
|
||||||
|
<SlidersHorizontal className="h-4 w-4" />
|
||||||
|
{hasActiveFilters && (
|
||||||
|
<span className="absolute -top-1 -right-1 h-2 w-2 rounded-full bg-primary" />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-72 space-y-4" align="end">
|
||||||
|
<div className="space-y-2">
|
||||||
|
<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>
|
||||||
|
<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="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" />
|
||||||
|
<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" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<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" />
|
||||||
|
<span className="text-muted-foreground">–</span>
|
||||||
|
<Input type="number" placeholder="To" min={1950} max={2100} value={filters.yearMax} onChange={(e) => setFilters((f) => ({ ...f, yearMax: e.target.value }))} className="h-9" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{hasActiveFilters && (
|
||||||
|
<Button variant="ghost" size="sm" className="w-full" onClick={clearFilters}>Clear Filters</Button>
|
||||||
|
)}
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* ── Desktop controls (≥ md) ── */}
|
||||||
|
<div className="hidden md:flex flex-wrap items-center gap-3">
|
||||||
{/* Search */}
|
{/* Search */}
|
||||||
<div className="relative flex-1 max-w-xs">
|
<div className="relative flex-1 max-w-xs">
|
||||||
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
||||||
@@ -122,31 +216,40 @@ export function WatchlistPage() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Spacer */}
|
|
||||||
<div className="flex-1" />
|
<div className="flex-1" />
|
||||||
|
|
||||||
{/* Sort */}
|
{/* Sort */}
|
||||||
<div className="flex items-center gap-1">
|
<Popover>
|
||||||
<ArrowUpDown className="h-4 w-4 text-muted-foreground" />
|
<PopoverTrigger asChild>
|
||||||
<Select value={sortField} onValueChange={(v) => setSortField(v as SortField)}>
|
<Button variant="outline" size="sm" className="h-9 gap-1.5">
|
||||||
<SelectTrigger className="w-[160px] h-9">
|
<ArrowUpDown className="h-4 w-4" />
|
||||||
<SelectValue>{sortLabels[sortField]}</SelectValue>
|
{sortLabels[sortField]}
|
||||||
</SelectTrigger>
|
<span className="text-xs opacity-60">{sortDir === 'desc' ? '↓' : '↑'}</span>
|
||||||
<SelectContent>
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-52 space-y-3 p-3" align="end">
|
||||||
|
<p className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">Sort by</p>
|
||||||
|
<div className="space-y-1">
|
||||||
{Object.entries(sortLabels).map(([value, label]) => (
|
{Object.entries(sortLabels).map(([value, label]) => (
|
||||||
<SelectItem key={value} value={value}>{label}</SelectItem>
|
<button
|
||||||
|
key={value}
|
||||||
|
onClick={() => setSortField(value as SortField)}
|
||||||
|
className={`w-full rounded-md px-3 py-1.5 text-left text-sm transition-colors ${
|
||||||
|
sortField === value
|
||||||
|
? 'bg-accent text-accent-foreground font-medium'
|
||||||
|
: 'hover:bg-accent/50'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</button>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</div>
|
||||||
</Select>
|
<div className="flex gap-1 pt-1 border-t border-border">
|
||||||
<Button
|
<Button variant={sortDir === 'desc' ? 'default' : 'outline'} size="sm" className="flex-1 h-8 text-xs" onClick={() => setSortDir('desc')}>↓ Desc</Button>
|
||||||
variant="ghost"
|
<Button variant={sortDir === 'asc' ? 'default' : 'outline'} size="sm" className="flex-1 h-8 text-xs" onClick={() => setSortDir('asc')}>↑ Asc</Button>
|
||||||
size="icon"
|
</div>
|
||||||
className="h-9 w-9"
|
</PopoverContent>
|
||||||
onClick={() => setSortDir((d) => (d === 'desc' ? 'asc' : 'desc'))}
|
</Popover>
|
||||||
>
|
|
||||||
<span className="text-xs font-medium">{sortDir === 'desc' ? '↓' : '↑'}</span>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Filter */}
|
{/* Filter */}
|
||||||
<Popover>
|
<Popover>
|
||||||
@@ -161,63 +264,27 @@ export function WatchlistPage() {
|
|||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="text-sm font-medium">Genre</label>
|
<label className="text-sm font-medium">Genre</label>
|
||||||
<Select value={filters.genre} onValueChange={(v) => setFilters((f) => ({ ...f, genre: v === '_all' ? '' : v }))}>
|
<Select value={filters.genre} onValueChange={(v) => setFilters((f) => ({ ...f, genre: v === '_all' ? '' : v }))}>
|
||||||
<SelectTrigger className="h-9">
|
<SelectTrigger className="h-9"><SelectValue placeholder="All genres" /></SelectTrigger>
|
||||||
<SelectValue placeholder="All genres" />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="_all">All genres</SelectItem>
|
<SelectItem value="_all">All genres</SelectItem>
|
||||||
{allGenres.map((g) => (
|
{allGenres.map((g) => <SelectItem key={g} value={g}>{g}</SelectItem>)}
|
||||||
<SelectItem key={g} value={g}>{g}</SelectItem>
|
|
||||||
))}
|
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="text-sm font-medium">Rating Range</label>
|
<label className="text-sm font-medium">Rating Range</label>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Input
|
<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" />
|
||||||
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"
|
|
||||||
/>
|
|
||||||
<span className="text-muted-foreground">–</span>
|
<span className="text-muted-foreground">–</span>
|
||||||
<Input
|
<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" />
|
||||||
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"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="text-sm font-medium">Year Range</label>
|
<label className="text-sm font-medium">Year Range</label>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Input
|
<Input type="number" placeholder="From" min={1950} max={2100} value={filters.yearMin} onChange={(e) => setFilters((f) => ({ ...f, yearMin: e.target.value }))} className="h-9" />
|
||||||
type="number"
|
|
||||||
placeholder="From"
|
|
||||||
min={1900}
|
|
||||||
max={2099}
|
|
||||||
value={filters.yearMin}
|
|
||||||
onChange={(e) => setFilters((f) => ({ ...f, yearMin: e.target.value }))}
|
|
||||||
className="h-9"
|
|
||||||
/>
|
|
||||||
<span className="text-muted-foreground">–</span>
|
<span className="text-muted-foreground">–</span>
|
||||||
<Input
|
<Input type="number" placeholder="To" min={1950} max={2100} value={filters.yearMax} onChange={(e) => setFilters((f) => ({ ...f, yearMax: e.target.value }))}
|
||||||
type="number"
|
|
||||||
placeholder="To"
|
|
||||||
min={1900}
|
|
||||||
max={2099}
|
|
||||||
value={filters.yearMax}
|
|
||||||
onChange={(e) => setFilters((f) => ({ ...f, yearMax: e.target.value }))}
|
|
||||||
className="h-9"
|
className="h-9"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,22 @@
|
|||||||
import { createBrowserRouter } from 'react-router-dom';
|
import { createBrowserRouter } from 'react-router-dom';
|
||||||
import { lazy, Suspense } from 'react';
|
import { lazy, Suspense, type ReactNode } from 'react';
|
||||||
import { AppLayout } from '@/components/layout/AppLayout';
|
import { AppLayout } from '@/components/layout/AppLayout';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import {
|
||||||
|
DashboardSkeleton,
|
||||||
|
HomeSkeleton,
|
||||||
|
LibrarySkeleton,
|
||||||
|
WatchlistSkeleton,
|
||||||
|
CollectionsSkeleton,
|
||||||
|
CollectionDetailsSkeleton,
|
||||||
|
EntryDetailsSkeleton,
|
||||||
|
SeasonSkeleton,
|
||||||
|
EpisodeSkeleton,
|
||||||
|
PeopleSkeleton,
|
||||||
|
PersonDetailsSkeleton,
|
||||||
|
MediaSkeleton,
|
||||||
|
CalendarSkeleton,
|
||||||
|
SettingsSkeleton,
|
||||||
|
} from '@/components/skeletons/PageSkeletons';
|
||||||
|
|
||||||
// Lazy-loaded pages
|
// Lazy-loaded pages
|
||||||
const HomePage = lazy(() =>
|
const HomePage = lazy(() =>
|
||||||
@@ -60,17 +75,8 @@ const SettingsPage = lazy(() =>
|
|||||||
import('@/pages/SettingsPage').then((m) => ({ default: m.SettingsPage }))
|
import('@/pages/SettingsPage').then((m) => ({ default: m.SettingsPage }))
|
||||||
);
|
);
|
||||||
|
|
||||||
function PageFallback() {
|
function SuspensePage({ children, fallback }: { children: ReactNode; fallback?: ReactNode }) {
|
||||||
return (
|
return <Suspense fallback={fallback ?? <HomeSkeleton />}>{children}</Suspense>;
|
||||||
<div className="space-y-4 p-6">
|
|
||||||
<Skeleton className="h-8 w-48" />
|
|
||||||
<Skeleton className="h-64 w-full" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function SuspensePage({ children }: { children: React.ReactNode }) {
|
|
||||||
return <Suspense fallback={<PageFallback />}>{children}</Suspense>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const router = createBrowserRouter([
|
export const router = createBrowserRouter([
|
||||||
@@ -80,7 +86,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<HomeSkeleton />}>
|
||||||
<HomePage />
|
<HomePage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -88,7 +94,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/dashboard',
|
path: '/dashboard',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<DashboardSkeleton />}>
|
||||||
<DashboardPage />
|
<DashboardPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -96,7 +102,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/library',
|
path: '/library',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<LibrarySkeleton />}>
|
||||||
<LibraryPage />
|
<LibraryPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -104,7 +110,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/watchlist',
|
path: '/watchlist',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<WatchlistSkeleton />}>
|
||||||
<WatchlistPage />
|
<WatchlistPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -112,7 +118,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/collections',
|
path: '/collections',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<CollectionsSkeleton />}>
|
||||||
<CollectionsPage />
|
<CollectionsPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -120,7 +126,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/collections/:id',
|
path: '/collections/:id',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<CollectionDetailsSkeleton />}>
|
||||||
<CollectionDetailsPage />
|
<CollectionDetailsPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -128,7 +134,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/media',
|
path: '/media',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<MediaSkeleton />}>
|
||||||
<MediaPage />
|
<MediaPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -136,7 +142,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/calendar',
|
path: '/calendar',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<CalendarSkeleton />}>
|
||||||
<CalendarPage />
|
<CalendarPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -144,7 +150,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/entry/:id',
|
path: '/entry/:id',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<EntryDetailsSkeleton />}>
|
||||||
<EntryDetailsPage />
|
<EntryDetailsPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -152,7 +158,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/entry/:entryId/season/:seasonId',
|
path: '/entry/:entryId/season/:seasonId',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<SeasonSkeleton />}>
|
||||||
<SeasonPage />
|
<SeasonPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -160,7 +166,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/entry/:entryId/season/:seasonId/episode/:episodeId',
|
path: '/entry/:entryId/season/:seasonId/episode/:episodeId',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<EpisodeSkeleton />}>
|
||||||
<EpisodePage />
|
<EpisodePage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -168,7 +174,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/people',
|
path: '/people',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<PeopleSkeleton />}>
|
||||||
<PeoplePage />
|
<PeoplePage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -176,7 +182,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/people/tmdb/:tmdbId',
|
path: '/people/tmdb/:tmdbId',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<PersonDetailsSkeleton />}>
|
||||||
<PersonTmdbRedirectPage />
|
<PersonTmdbRedirectPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -184,7 +190,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/people/:id',
|
path: '/people/:id',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<PersonDetailsSkeleton />}>
|
||||||
<PersonDetailsPage />
|
<PersonDetailsPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
@@ -192,7 +198,7 @@ export const router = createBrowserRouter([
|
|||||||
{
|
{
|
||||||
path: '/settings',
|
path: '/settings',
|
||||||
element: (
|
element: (
|
||||||
<SuspensePage>
|
<SuspensePage fallback={<SettingsSkeleton />}>
|
||||||
<SettingsPage />
|
<SettingsPage />
|
||||||
</SuspensePage>
|
</SuspensePage>
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in new issue
Block a user