Merge branch 'feat/entry-details-redesign'
This commit is contained in:
commit
cee6f7f961
2 files changed
+505
-362
No files matched your search
@@ -154,28 +154,39 @@ export function CollectionDetailsSkeleton() {
|
|||||||
export function EntryDetailsSkeleton() {
|
export function EntryDetailsSkeleton() {
|
||||||
return (
|
return (
|
||||||
<div className="animate-in fade-in duration-300">
|
<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="relative -mx-4 -mt-4 bg-muted/40 md:-mx-6 md:-mt-6">
|
||||||
<div className="max-w-4xl mx-auto flex gap-8 -mt-24">
|
<div className="mx-auto flex max-w-6xl flex-col items-center gap-6 px-4 pb-8 pt-28 sm:flex-row sm:items-end sm:gap-8 sm:pt-44 md:px-6">
|
||||||
<div className="w-44 shrink-0 space-y-3">
|
<Skeleton className="aspect-[2/3] w-40 shrink-0 rounded-xl sm:w-52 lg:w-60" />
|
||||||
<Skeleton className="aspect-[2/3] w-full rounded-xl" />
|
<div className="w-full flex-1 space-y-4">
|
||||||
<Skeleton className="h-9 w-full rounded-lg" />
|
<Skeleton className="h-5 w-24 rounded-full" />
|
||||||
<Skeleton className="h-9 w-full rounded-lg" />
|
<Skeleton className="h-12 w-3/4 max-w-md" />
|
||||||
<Skeleton className="h-9 w-full rounded-lg" />
|
<Skeleton className="h-4 w-48" />
|
||||||
</div>
|
<div className="flex gap-1.5">
|
||||||
<div className="flex-1 space-y-4 pt-24">
|
<Skeleton className="h-6 w-16 rounded-full" />
|
||||||
<Skeleton className="h-9 w-72" />
|
<Skeleton className="h-6 w-20 rounded-full" />
|
||||||
<Skeleton className="h-4 w-32" />
|
<Skeleton className="h-6 w-14 rounded-full" />
|
||||||
<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>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Skeleton className="h-8 w-24 rounded-full" />
|
<Skeleton className="h-11 w-36 rounded-md" />
|
||||||
<Skeleton className="h-8 w-24 rounded-full" />
|
<Skeleton className="h-11 w-28 rounded-md" />
|
||||||
<Skeleton className="h-8 w-20 rounded-full" />
|
<Skeleton className="h-11 w-11 rounded-full" />
|
||||||
|
<Skeleton className="h-11 w-11 rounded-full" />
|
||||||
</div>
|
</div>
|
||||||
<Skeleton className="h-20 w-full" />
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="mx-auto mt-4 grid max-w-6xl gap-10 lg:grid-cols-[minmax(0,1fr)_300px]">
|
||||||
|
<div className="space-y-3">
|
||||||
|
<Skeleton className="h-6 w-28" />
|
||||||
|
<Skeleton className="h-24 w-full" />
|
||||||
|
</div>
|
||||||
|
<div className="space-y-4">
|
||||||
|
<div className="grid grid-cols-3 gap-2">
|
||||||
|
<Skeleton className="h-20 rounded-xl" />
|
||||||
|
<Skeleton className="h-20 rounded-xl" />
|
||||||
|
<Skeleton className="h-20 rounded-xl" />
|
||||||
|
</div>
|
||||||
|
<Skeleton className="h-40 rounded-xl" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect, type ReactNode } from "react";
|
||||||
import { useParams, Link, useNavigate } from "react-router-dom";
|
import { useParams, Link, useNavigate } from "react-router-dom";
|
||||||
import {
|
import {
|
||||||
useEntry,
|
useEntry,
|
||||||
@@ -10,9 +10,7 @@ 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 { useCommandPaletteStore } from "@/stores/useCommandPaletteStore";
|
import { useCommandPaletteStore } from "@/stores/useCommandPaletteStore";
|
||||||
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 { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
|
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
@@ -36,17 +34,19 @@ import {
|
|||||||
ExternalLink,
|
ExternalLink,
|
||||||
Play,
|
Play,
|
||||||
BookmarkCheck,
|
BookmarkCheck,
|
||||||
|
Film,
|
||||||
|
Tv,
|
||||||
|
Clock,
|
||||||
|
CalendarDays,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import {
|
import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
TooltipContent,
|
TooltipContent,
|
||||||
TooltipProvider,
|
|
||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
import { CastList } from "@/components/entries/CastList";
|
import { CastList } from "@/components/entries/CastList";
|
||||||
import { SeasonsContainer } from "@/components/entries/SeasonsContainer";
|
import { SeasonsContainer } from "@/components/entries/SeasonsContainer";
|
||||||
import { StreamingSection } from "@/components/streaming/StreamingSection";
|
import { StreamingSection } from "@/components/streaming/StreamingSection";
|
||||||
// EpisodeWatchHistory is available for future use
|
|
||||||
import { EntrySettingsDialog } from "@/components/dialogs/EntrySettingsDialog";
|
import { EntrySettingsDialog } from "@/components/dialogs/EntrySettingsDialog";
|
||||||
import { EntrySeenDialog } from "@/components/dialogs/EntrySeenDialog";
|
import { EntrySeenDialog } from "@/components/dialogs/EntrySeenDialog";
|
||||||
import { EntryMediaDialog } from "@/components/dialogs/EntryMediaDialog";
|
import { EntryMediaDialog } from "@/components/dialogs/EntryMediaDialog";
|
||||||
@@ -78,29 +78,29 @@ const WATCH_STATUSES = [
|
|||||||
value: "plan_to_watch",
|
value: "plan_to_watch",
|
||||||
label: "Plan to Watch",
|
label: "Plan to Watch",
|
||||||
color:
|
color:
|
||||||
"bg-slate-500/15 border-slate-500/30 text-slate-600 dark:text-slate-400",
|
"bg-slate-500/15 border-slate-500/30 text-slate-600 dark:text-slate-300",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "watching",
|
value: "watching",
|
||||||
label: "Watching",
|
label: "Watching",
|
||||||
color: "bg-blue-500/15 border-blue-500/30 text-blue-600 dark:text-blue-400",
|
color: "bg-blue-500/15 border-blue-500/30 text-blue-600 dark:text-blue-300",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "completed",
|
value: "completed",
|
||||||
label: "Completed",
|
label: "Completed",
|
||||||
color:
|
color:
|
||||||
"bg-green-500/15 border-green-500/30 text-green-600 dark:text-green-400",
|
"bg-green-500/15 border-green-500/30 text-green-600 dark:text-green-300",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "on_hold",
|
value: "on_hold",
|
||||||
label: "On Hold",
|
label: "On Hold",
|
||||||
color:
|
color:
|
||||||
"bg-amber-500/15 border-amber-500/30 text-amber-600 dark:text-amber-400",
|
"bg-amber-500/15 border-amber-500/30 text-amber-600 dark:text-amber-300",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "dropped",
|
value: "dropped",
|
||||||
label: "Dropped",
|
label: "Dropped",
|
||||||
color: "bg-red-500/15 border-red-500/30 text-red-600 dark:text-red-400",
|
color: "bg-red-500/15 border-red-500/30 text-red-600 dark:text-red-300",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -167,92 +167,239 @@ export function EntryDetailsPage() {
|
|||||||
const director = credits.find(
|
const director = credits.find(
|
||||||
(c) => c.cast_type === "crew" && c.job === "Director",
|
(c) => c.cast_type === "crew" && c.job === "Director",
|
||||||
);
|
);
|
||||||
|
const watchStatus = e.is_tvseries
|
||||||
|
? getWatchStatusInfo(e.watch_status)
|
||||||
|
: undefined;
|
||||||
|
const userRating = e.entryRatings?.user_rating ?? 0;
|
||||||
|
const lastSeen =
|
||||||
|
watchHistory
|
||||||
|
.map((wh) => wh.date_seen)
|
||||||
|
.filter(Boolean)
|
||||||
|
.sort()
|
||||||
|
.at(-1) ?? null;
|
||||||
|
|
||||||
const toggleFavorite = () => {
|
const toggleFavorite = () => {
|
||||||
updateEntry.mutate({ id: e.id, data: { favorit: !e.favorit } });
|
updateEntry.mutate({ id: e.id, data: { favorit: !e.favorit } });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className="animate-page-enter">
|
||||||
{/* Backdrop banner */}
|
{/* ── Hero ── */}
|
||||||
<div className="relative -mx-6 -mt-6 h-52 overflow-hidden">
|
<section className="relative -mx-4 -mt-4 md:-mx-6 md:-mt-6">
|
||||||
|
<div className="absolute inset-0 overflow-hidden">
|
||||||
{backdrop ? (
|
{backdrop ? (
|
||||||
<img
|
<img
|
||||||
src={backdrop}
|
src={backdrop}
|
||||||
alt=""
|
alt=""
|
||||||
className="h-full w-full object-cover opacity-25 blur-sm scale-105"
|
className="h-full w-full object-cover object-top"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="h-full w-full bg-linear-to-br from-primary/15 to-primary/5" />
|
<div className="h-full w-full bg-linear-to-br from-primary/30 via-primary/10 to-background" />
|
||||||
)}
|
)}
|
||||||
<div className="absolute inset-0 bg-linear-to-t from-background via-background/60 to-transparent" />
|
{/* Fade into the page at the bottom and behind the text on the left */}
|
||||||
|
<div className="absolute inset-0 bg-linear-to-t from-background via-background/75 to-background/10" />
|
||||||
|
<div className="absolute inset-0 bg-linear-to-r from-background/90 via-background/40 to-transparent" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Main content */}
|
<div className="relative mx-auto max-w-6xl px-4 pb-8 pt-28 md:px-6 sm:pt-44">
|
||||||
<div className="mx-auto max-w-4xl">
|
<div className="flex flex-col items-center gap-6 sm:flex-row sm:items-end sm:gap-8">
|
||||||
{/* Action buttons — top right. The row overlaps the title below, so
|
<button
|
||||||
only the button itself takes pointer events. */}
|
type="button"
|
||||||
<div className="flex justify-end gap-1 -mt-10 relative z-10 mb-2 pointer-events-none">
|
onClick={() => setShowPosterDialog(true)}
|
||||||
|
className="group relative w-40 shrink-0 cursor-zoom-in rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:w-52 lg:w-60"
|
||||||
|
aria-label="View full-size poster"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={poster}
|
||||||
|
alt={e.title}
|
||||||
|
className="aspect-2/3 w-full rounded-xl object-cover shadow-2xl shadow-black/50 ring-1 ring-white/10 transition-transform duration-300 group-hover:scale-[1.02]"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div className="min-w-0 flex-1 space-y-4 text-center sm:text-left">
|
||||||
|
{/* Eyebrow: type + status */}
|
||||||
|
<div className="flex flex-wrap items-center justify-center gap-2 sm:justify-start">
|
||||||
|
<span className="inline-flex items-center gap-1.5 rounded-full border border-border/60 bg-background/60 px-2.5 py-0.5 text-xs font-medium uppercase tracking-wider text-muted-foreground backdrop-blur">
|
||||||
|
{e.is_tvseries ? (
|
||||||
|
<Tv className="h-3 w-3" />
|
||||||
|
) : (
|
||||||
|
<Film className="h-3 w-3" />
|
||||||
|
)}
|
||||||
|
{e.is_tvseries ? "TV Series" : "Movie"}
|
||||||
|
</span>
|
||||||
|
{e.is_tvseries && e.status && (
|
||||||
|
<span className="rounded-full border border-border/60 bg-background/60 px-2.5 py-0.5 text-xs font-medium text-muted-foreground backdrop-blur">
|
||||||
|
{e.status}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{e.is_tvseries && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowStatusDialog(true)}
|
||||||
|
className={`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors ${
|
||||||
|
watchStatus?.color ??
|
||||||
|
"border-dashed border-border text-muted-foreground hover:text-foreground"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<BookmarkCheck className="h-3 w-3" />
|
||||||
|
{watchStatus?.label ?? "Set status"}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<h1 className="select-text text-4xl font-extrabold leading-[1.05] tracking-tight text-balance sm:text-5xl">
|
||||||
|
{e.title}
|
||||||
|
</h1>
|
||||||
|
{e.original_title && e.original_title !== e.title && (
|
||||||
|
<p className="select-text text-sm text-muted-foreground italic">
|
||||||
|
{e.original_title}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Meta */}
|
||||||
|
<div className="flex flex-wrap items-center justify-center gap-x-3 gap-y-1 text-sm text-muted-foreground sm:justify-start">
|
||||||
|
{e.release_date && (
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger
|
||||||
|
render={
|
||||||
|
<span className="cursor-default font-medium text-foreground/90" />
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{getYear(e.release_date)}
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent>
|
||||||
|
{formatDate(e.release_date)}
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
{e.runtime && !e.is_tvseries && (
|
||||||
|
<MetaItem>{formatRuntime(e.runtime)}</MetaItem>
|
||||||
|
)}
|
||||||
|
{e.is_tvseries && seasons && seasons.length > 0 && (
|
||||||
|
<MetaItem>
|
||||||
|
{seasons.length}{" "}
|
||||||
|
{seasons.length === 1 ? "season" : "seasons"}
|
||||||
|
</MetaItem>
|
||||||
|
)}
|
||||||
|
{director?.people?.name && (
|
||||||
|
<MetaItem>
|
||||||
|
Directed by{" "}
|
||||||
|
<Link
|
||||||
|
to={`/people/${director.people_id}`}
|
||||||
|
className="font-medium text-foreground hover:underline"
|
||||||
|
>
|
||||||
|
{director.people.name}
|
||||||
|
</Link>
|
||||||
|
</MetaItem>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Genres */}
|
||||||
|
{e.genres && e.genres.length > 0 && (
|
||||||
|
<div className="flex flex-wrap justify-center gap-1.5 sm:justify-start">
|
||||||
|
{e.genres.map((g) => (
|
||||||
|
<Link
|
||||||
|
key={g.id}
|
||||||
|
to={`/library?genre=${encodeURIComponent(g.name)}`}
|
||||||
|
className="rounded-full bg-foreground/5 px-3 py-1 text-xs font-medium text-foreground/80 ring-1 ring-border/60 backdrop-blur transition-colors hover:bg-foreground/10 hover:text-foreground"
|
||||||
|
>
|
||||||
|
{g.name}
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Actions */}
|
||||||
|
<div className="flex flex-wrap items-center justify-center gap-2 pt-1 sm:justify-start">
|
||||||
|
<StreamingSection entry={e} seasons={seasons} />
|
||||||
|
<a
|
||||||
|
href={`https://www.youtube.com/results?search_query=${encodeURIComponent(e.title + " official trailer")}`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="inline-flex h-11 items-center gap-2 rounded-md border border-border/60 bg-background/60 px-5 text-sm font-medium backdrop-blur transition-colors hover:bg-accent"
|
||||||
|
>
|
||||||
|
<Play className="h-4 w-4" />
|
||||||
|
Trailer
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-1.5">
|
||||||
|
<IconAction
|
||||||
|
label="Mark as watched"
|
||||||
|
onClick={() => setShowSeenDialog(true)}
|
||||||
|
>
|
||||||
|
<Eye className="h-4 w-4" />
|
||||||
|
</IconAction>
|
||||||
|
<IconAction
|
||||||
|
label={userRating > 0 ? "Change rating" : "Rate this"}
|
||||||
|
onClick={() => setShowRatingDialog(true)}
|
||||||
|
active={userRating > 0}
|
||||||
|
>
|
||||||
|
<Star
|
||||||
|
className={`h-4 w-4 ${userRating > 0 ? "fill-yellow-400 text-yellow-400" : ""}`}
|
||||||
|
/>
|
||||||
|
</IconAction>
|
||||||
|
<IconAction
|
||||||
|
label={
|
||||||
|
e.favorit ? "Remove from favorites" : "Add to favorites"
|
||||||
|
}
|
||||||
|
onClick={toggleFavorite}
|
||||||
|
disabled={updateEntry.isPending}
|
||||||
|
active={e.favorit}
|
||||||
|
>
|
||||||
|
<Heart
|
||||||
|
className={`h-4 w-4 ${e.favorit ? "fill-red-500 text-red-500" : ""}`}
|
||||||
|
/>
|
||||||
|
</IconAction>
|
||||||
|
<IconAction
|
||||||
|
label="Add to collection"
|
||||||
|
onClick={() => setShowCollectionDialog(true)}
|
||||||
|
>
|
||||||
|
<FolderPlus className="h-4 w-4" />
|
||||||
|
</IconAction>
|
||||||
|
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger
|
||||||
|
render={
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="outline"
|
||||||
size="icon"
|
size="icon-lg"
|
||||||
className="h-9 w-9 pointer-events-auto"
|
className="h-11 w-11 rounded-full border-border/60 bg-background/60 backdrop-blur"
|
||||||
|
aria-label="More actions"
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<MoreHorizontal className="h-4 w-4" />
|
<MoreHorizontal className="h-4 w-4" />
|
||||||
</Button>
|
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end" className="w-56">
|
<DropdownMenuContent align="end" className="w-56">
|
||||||
{/* Watch & Rate */}
|
{e.is_tvseries ? (
|
||||||
<DropdownMenuItem onClick={() => setShowSeenDialog(true)}>
|
<DropdownMenuItem
|
||||||
<Eye className="mr-2 h-4 w-4" />
|
onClick={() => setShowStatusDialog(true)}
|
||||||
Mark as watched
|
>
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem onClick={() => setShowRatingDialog(true)}>
|
|
||||||
<Star className="mr-2 h-4 w-4" />
|
|
||||||
Rate this
|
|
||||||
</DropdownMenuItem>
|
|
||||||
{e.is_tvseries && <DropdownMenuSeparator />}
|
|
||||||
{e.is_tvseries && (
|
|
||||||
<DropdownMenuItem onClick={() => setShowStatusDialog(true)}>
|
|
||||||
<BookmarkCheck className="mr-2 h-4 w-4" />
|
<BookmarkCheck className="mr-2 h-4 w-4" />
|
||||||
Set Status
|
Set status
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)}
|
) : (
|
||||||
{!e.is_tvseries && (
|
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onClick={() => setShowWatchHistoryDialog(true)}
|
onClick={() => setShowWatchHistoryDialog(true)}
|
||||||
>
|
>
|
||||||
<History className="mr-2 h-4 w-4" />
|
<History className="mr-2 h-4 w-4" />
|
||||||
Watch History
|
Watch history
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)}
|
)}
|
||||||
<DropdownMenuSeparator />
|
|
||||||
{/* Organize */}
|
|
||||||
<DropdownMenuItem
|
|
||||||
onClick={toggleFavorite}
|
|
||||||
disabled={updateEntry.isPending}
|
|
||||||
>
|
|
||||||
<Heart
|
|
||||||
className={`mr-2 h-4 w-4 ${e.favorit ? "fill-current" : ""}`}
|
|
||||||
/>
|
|
||||||
{e.favorit ? "Unfavorite" : "Favorite"}
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem onClick={() => setShowCollectionDialog(true)}>
|
|
||||||
<FolderPlus className="mr-2 h-4 w-4" />
|
|
||||||
Add to collection
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
updateEntry.mutate({ id: e.id, data: { hidden: !e.hidden } })
|
updateEntry.mutate({
|
||||||
|
id: e.id,
|
||||||
|
data: { hidden: !e.hidden },
|
||||||
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<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>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
{/* Manage */}
|
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onClick={() => refreshEntry.mutate(e.id)}
|
onClick={() => refreshEntry.mutate(e.id)}
|
||||||
disabled={refreshEntry.isPending}
|
disabled={refreshEntry.isPending}
|
||||||
@@ -260,9 +407,13 @@ export function EntryDetailsPage() {
|
|||||||
<RefreshCw
|
<RefreshCw
|
||||||
className={`mr-2 h-4 w-4 ${refreshEntry.isPending ? "animate-spin" : ""}`}
|
className={`mr-2 h-4 w-4 ${refreshEntry.isPending ? "animate-spin" : ""}`}
|
||||||
/>
|
/>
|
||||||
{refreshEntry.isPending ? "Refreshing..." : "Refresh details"}
|
{refreshEntry.isPending
|
||||||
|
? "Refreshing..."
|
||||||
|
: "Refresh details"}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={() => setShowMediaDialog(true)}>
|
<DropdownMenuItem
|
||||||
|
onClick={() => setShowMediaDialog(true)}
|
||||||
|
>
|
||||||
<ImageIcon className="mr-2 h-4 w-4" />
|
<ImageIcon className="mr-2 h-4 w-4" />
|
||||||
Manage media
|
Manage media
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
@@ -271,7 +422,6 @@ export function EntryDetailsPage() {
|
|||||||
Settings
|
Settings
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
{/* Danger */}
|
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
className="text-destructive focus:text-destructive"
|
className="text-destructive focus:text-destructive"
|
||||||
onClick={() => setShowDeleteConfirm(true)}
|
onClick={() => setShowDeleteConfirm(true)}
|
||||||
@@ -282,296 +432,139 @@ export function EntryDetailsPage() {
|
|||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Two-column header: sticky poster | info */}
|
|
||||||
<div className="flex flex-col gap-6 relative items-start sm:flex-row sm:gap-8 sm:-mt-8">
|
|
||||||
{/* LEFT: Sticky poster */}
|
|
||||||
<div className="sm:sticky sm:top-20 w-32 sm:w-44 shrink-0 self-start mx-auto sm:mx-0">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => setShowPosterDialog(true)}
|
|
||||||
className="relative block w-full cursor-zoom-in rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
||||||
aria-label="View full-size poster"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src={poster}
|
|
||||||
alt={e.title}
|
|
||||||
className="w-full aspect-2/3 rounded-xl object-cover shadow-2xl ring-1 ring-border/50"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
{/* External links */}
|
|
||||||
{e.entryIds && (
|
|
||||||
<div className="flex items-center justify-center gap-3 mt-3">
|
|
||||||
{e.entryIds.tmdb_id && (
|
|
||||||
<a
|
|
||||||
href={`https://www.themoviedb.org/${e.is_tvseries ? "tv" : "movie"}/${e.entryIds.tmdb_id}`}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors"
|
|
||||||
>
|
|
||||||
<ExternalLink className="h-3 w-3" />
|
|
||||||
TMDB
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
{e.entryIds.imdb_id && (
|
|
||||||
<a
|
|
||||||
href={`https://www.imdb.com/title/${e.entryIds.imdb_id}`}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors"
|
|
||||||
>
|
|
||||||
<ExternalLink className="h-3 w-3" />
|
|
||||||
IMDb
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* RIGHT: Entry info */}
|
|
||||||
<div className="flex-1 min-w-0 space-y-4">
|
|
||||||
{/* Title + director */}
|
|
||||||
<div className="space-y-1">
|
|
||||||
<h1 className="text-3xl font-bold leading-tight select-text">
|
|
||||||
{e.title}
|
|
||||||
</h1>
|
|
||||||
{director?.people?.name && (
|
|
||||||
<p className="text-sm text-muted-foreground">
|
|
||||||
by{" "}
|
|
||||||
<Link
|
|
||||||
to={`/people/${director.people_id}`}
|
|
||||||
className="font-medium text-foreground hover:underline"
|
|
||||||
>
|
|
||||||
{director.people.name}
|
|
||||||
</Link>
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Meta */}
|
|
||||||
<div className="flex flex-wrap items-center gap-2 text-sm text-muted-foreground">
|
|
||||||
{e.release_date && (
|
|
||||||
<TooltipProvider>
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger asChild>
|
|
||||||
<span className="cursor-default underline decoration-dotted">
|
|
||||||
{getYear(e.release_date)}
|
|
||||||
</span>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent>
|
|
||||||
<p>{formatDate(e.release_date)}</p>
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</TooltipProvider>
|
|
||||||
)}
|
|
||||||
{e.is_tvseries && e.status && (
|
|
||||||
<>
|
|
||||||
<span>•</span>
|
|
||||||
<span>{e.status}</span>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{e.runtime && !e.is_tvseries && (
|
|
||||||
<>
|
|
||||||
<span>•</span>
|
|
||||||
<span>{formatRuntime(e.runtime)}</span>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{!e.is_tvseries && watchHistory.length > 0 && (
|
|
||||||
<>
|
|
||||||
<span>•</span>
|
|
||||||
{watchHistory.length === 1 ? (
|
|
||||||
<span>Seen {formatDate(watchHistory[0].date_seen)}</span>
|
|
||||||
) : (
|
|
||||||
<TooltipProvider>
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger asChild>
|
|
||||||
<span className="cursor-default underline decoration-dotted">
|
|
||||||
Seen {watchHistory.length} times
|
|
||||||
</span>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent>
|
|
||||||
<div className="space-y-0.5 text-xs">
|
|
||||||
{watchHistory.map((wh) => (
|
|
||||||
<p key={wh.id}>{formatDate(wh.date_seen)}</p>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</TooltipProvider>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{!e.is_tvseries && watchHistory.length === 0 && (
|
|
||||||
<>
|
|
||||||
<span>•</span>
|
|
||||||
<button
|
|
||||||
className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors underline decoration-dotted cursor-pointer"
|
|
||||||
onClick={() => setShowSeenDialog(true)}
|
|
||||||
>
|
|
||||||
<Eye className="h-3 w-3" />
|
|
||||||
Mark as watched
|
|
||||||
</button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
{/* Genres */}
|
{/* ── Body ── */}
|
||||||
{e.genres && e.genres.length > 0 && (
|
<div className="mx-auto mt-4 grid max-w-6xl gap-10 lg:grid-cols-[minmax(0,1fr)_300px]">
|
||||||
<div className="flex flex-wrap gap-1.5">
|
<div className="min-w-0 space-y-10">
|
||||||
{e.genres.map((g) => (
|
|
||||||
<Link
|
|
||||||
key={g.id}
|
|
||||||
to={`/library?genre=${encodeURIComponent(g.name)}`}
|
|
||||||
>
|
|
||||||
<Badge
|
|
||||||
variant="outline"
|
|
||||||
className="text-xs cursor-pointer hover:bg-accent transition-colors"
|
|
||||||
>
|
|
||||||
{g.name}
|
|
||||||
</Badge>
|
|
||||||
</Link>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Ratings */}
|
|
||||||
<div className="flex flex-wrap items-center gap-2">
|
|
||||||
{e.entryRatings?.imdb_rating != null &&
|
|
||||||
e.entryRatings.imdb_rating > 0 && (
|
|
||||||
<span className="inline-flex items-center gap-1 rounded-full bg-yellow-500/10 border border-yellow-500/20 px-3 py-1 text-sm text-yellow-600 dark:text-yellow-400 font-medium">
|
|
||||||
<span className="font-bold">IMDb:</span>
|
|
||||||
{e.entryRatings.imdb_rating}/10
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
{e.entryRatings?.tmdb_rating != null &&
|
|
||||||
e.entryRatings.tmdb_rating > 0 && (
|
|
||||||
<span className="inline-flex items-center gap-1 rounded-full bg-blue-500/10 border border-blue-500/20 px-3 py-1 text-sm text-blue-600 dark:text-blue-400 font-medium">
|
|
||||||
<span className="font-bold">TMDB:</span>
|
|
||||||
{e.entryRatings.tmdb_rating.toFixed(1)}/10
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
{e.entryRatings?.user_rating != null &&
|
|
||||||
e.entryRatings.user_rating > 0 ? (
|
|
||||||
<button
|
|
||||||
className="inline-flex items-center gap-1 rounded-full bg-accent border border-border px-3 py-1 text-sm font-medium hover:bg-accent/80 transition-colors"
|
|
||||||
onClick={() => setShowRatingDialog(true)}
|
|
||||||
title="Click to change rating"
|
|
||||||
>
|
|
||||||
<Star className="h-3.5 w-3.5 fill-yellow-400 text-yellow-400" />
|
|
||||||
<span className="font-bold">You:</span>
|
|
||||||
{e.entryRatings.user_rating}/10
|
|
||||||
</button>
|
|
||||||
) : (
|
|
||||||
<button
|
|
||||||
className="inline-flex items-center gap-1.5 rounded-full border border-dashed border-border px-3 py-1 text-sm text-muted-foreground hover:border-border hover:text-foreground transition-colors"
|
|
||||||
onClick={() => setShowRatingDialog(true)}
|
|
||||||
>
|
|
||||||
<Star className="h-3.5 w-3.5" />
|
|
||||||
Rate
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
{/* Favorite pill */}
|
|
||||||
<TooltipProvider>
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger asChild>
|
|
||||||
<button
|
|
||||||
onClick={toggleFavorite}
|
|
||||||
disabled={updateEntry.isPending}
|
|
||||||
className={`inline-flex items-center gap-1 rounded-full border px-3 py-1 text-sm font-medium transition-colors ${
|
|
||||||
e.favorit
|
|
||||||
? "bg-yellow-500/15 border-yellow-500/30 text-yellow-600 dark:text-yellow-400 hover:bg-yellow-500/25"
|
|
||||||
: "border-dashed border-border text-muted-foreground hover:border-yellow-500/40 hover:text-yellow-500"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<Star
|
|
||||||
className={`h-3.5 w-3.5 ${e.favorit ? "fill-yellow-400 text-yellow-400" : ""}`}
|
|
||||||
/>
|
|
||||||
Favorit
|
|
||||||
</button>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent>
|
|
||||||
<p>
|
|
||||||
{e.favorit ? "Remove from favorites" : "Add to favorites"}
|
|
||||||
</p>
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</TooltipProvider>
|
|
||||||
|
|
||||||
{/* Watch status pill — TV only */}
|
|
||||||
{e.is_tvseries &&
|
|
||||||
e.watch_status &&
|
|
||||||
(() => {
|
|
||||||
const info = getWatchStatusInfo(e.watch_status);
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
onClick={() => setShowStatusDialog(true)}
|
|
||||||
className={`inline-flex items-center gap-1 rounded-full border px-3 py-1 text-sm font-medium transition-colors cursor-pointer ${info?.color ?? ""}`}
|
|
||||||
>
|
|
||||||
<BookmarkCheck className="h-3.5 w-3.5" />
|
|
||||||
{info?.label}
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
})()}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Storyline */}
|
|
||||||
{e.storyline && (
|
{e.storyline && (
|
||||||
<p className="text-sm text-muted-foreground leading-relaxed max-w-prose">
|
<Section title="Overview">
|
||||||
|
<p className="select-text max-w-prose text-[15px] leading-relaxed text-foreground/85">
|
||||||
{e.storyline}
|
{e.storyline}
|
||||||
</p>
|
</p>
|
||||||
|
</Section>
|
||||||
)}
|
)}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Sections */}
|
|
||||||
<div className="mt-10 space-y-8">
|
|
||||||
{/* Streaming player + Trailer */}
|
|
||||||
<div className="flex flex-wrap items-center justify-center gap-2">
|
|
||||||
<StreamingSection entry={e} seasons={seasons} />
|
|
||||||
<a
|
|
||||||
href={`https://www.youtube.com/results?search_query=${encodeURIComponent(e.title + " official trailer")}`}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="inline-flex items-center gap-2 h-11 px-6 text-sm font-medium rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors"
|
|
||||||
>
|
|
||||||
<Play className="h-4 w-4" />
|
|
||||||
Watch Trailer
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{credits.length > 0 && (
|
{credits.length > 0 && (
|
||||||
<>
|
|
||||||
<Separator />
|
|
||||||
<CastList
|
<CastList
|
||||||
credits={credits}
|
credits={credits}
|
||||||
entryId={e.id}
|
entryId={e.id}
|
||||||
isTvSeries={e.is_tvseries}
|
isTvSeries={e.is_tvseries}
|
||||||
maxItems={12}
|
maxItems={12}
|
||||||
/>
|
/>
|
||||||
</>
|
)}
|
||||||
|
|
||||||
|
{e.is_tvseries && seasons && seasons.length > 0 && (
|
||||||
|
<SeasonsContainer seasons={seasons} entryId={e.id} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<EntryCollectionsSection entryId={e.id} />
|
<EntryCollectionsSection entryId={e.id} />
|
||||||
|
|
||||||
{e.is_tvseries && seasons && seasons.length > 0 && (
|
|
||||||
<>
|
|
||||||
<Separator />
|
|
||||||
<SeasonsContainer seasons={seasons} entryId={e.id} />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* {watchHistory.length > 0 && (
|
|
||||||
<>
|
|
||||||
<Separator />
|
|
||||||
<EpisodeWatchHistory
|
|
||||||
watchHistory={watchHistory}
|
|
||||||
onDelete={(seenId) =>
|
|
||||||
deleteEntrySeen.mutate({ id: seenId, entryId: e.id })
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)} */}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* ── Sidebar ── */}
|
||||||
|
<aside className="space-y-4 lg:sticky lg:top-6 lg:self-start">
|
||||||
|
<div className="grid grid-cols-3 gap-2">
|
||||||
|
<RatingTile
|
||||||
|
label="IMDb"
|
||||||
|
value={
|
||||||
|
e.entryRatings?.imdb_rating
|
||||||
|
? e.entryRatings.imdb_rating.toFixed(1)
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
accent="text-yellow-500"
|
||||||
|
/>
|
||||||
|
<RatingTile
|
||||||
|
label="TMDB"
|
||||||
|
value={
|
||||||
|
e.entryRatings?.tmdb_rating
|
||||||
|
? e.entryRatings.tmdb_rating.toFixed(1)
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
accent="text-sky-500"
|
||||||
|
/>
|
||||||
|
<RatingTile
|
||||||
|
label="You"
|
||||||
|
value={userRating > 0 ? String(userRating) : null}
|
||||||
|
accent="text-primary"
|
||||||
|
emptyLabel="Rate"
|
||||||
|
onClick={() => setShowRatingDialog(true)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="rounded-xl border border-border/60 bg-card/50 p-4">
|
||||||
|
<h3 className="mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground">
|
||||||
|
Details
|
||||||
|
</h3>
|
||||||
|
<dl className="space-y-2.5 text-sm">
|
||||||
|
{e.release_date && (
|
||||||
|
<DetailRow icon={<CalendarDays />} label="Released">
|
||||||
|
{formatDate(e.release_date)}
|
||||||
|
</DetailRow>
|
||||||
|
)}
|
||||||
|
{e.runtime && !e.is_tvseries && (
|
||||||
|
<DetailRow icon={<Clock />} label="Runtime">
|
||||||
|
{formatRuntime(e.runtime)}
|
||||||
|
</DetailRow>
|
||||||
|
)}
|
||||||
|
{e.is_tvseries && e.networks && e.networks.length > 0 && (
|
||||||
|
<DetailRow icon={<Tv />} label="Network">
|
||||||
|
{e.networks.map((n) => n.name).join(", ")}
|
||||||
|
</DetailRow>
|
||||||
|
)}
|
||||||
|
{e.country && (
|
||||||
|
<DetailRow icon={<Film />} label="Country">
|
||||||
|
{e.country}
|
||||||
|
</DetailRow>
|
||||||
|
)}
|
||||||
|
{!e.is_tvseries && (
|
||||||
|
<DetailRow icon={<Eye />} label="Watched">
|
||||||
|
{watchHistory.length > 0 ? (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowWatchHistoryDialog(true)}
|
||||||
|
className="text-right hover:underline"
|
||||||
|
>
|
||||||
|
{watchHistory.length === 1
|
||||||
|
? formatDate(lastSeen)
|
||||||
|
: `${watchHistory.length}× · last ${formatDate(lastSeen)}`}
|
||||||
|
</button>
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowSeenDialog(true)}
|
||||||
|
className="text-muted-foreground hover:text-foreground hover:underline"
|
||||||
|
>
|
||||||
|
Not yet — mark
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</DetailRow>
|
||||||
|
)}
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
{(e.entryIds?.tmdb_id || e.entryIds?.imdb_id) && (
|
||||||
|
<div className="mt-4 flex gap-2 border-t border-border/60 pt-4">
|
||||||
|
{e.entryIds?.tmdb_id && (
|
||||||
|
<ExternalChip
|
||||||
|
href={`https://www.themoviedb.org/${e.is_tvseries ? "tv" : "movie"}/${e.entryIds.tmdb_id}`}
|
||||||
|
>
|
||||||
|
TMDB
|
||||||
|
</ExternalChip>
|
||||||
|
)}
|
||||||
|
{e.entryIds?.imdb_id && (
|
||||||
|
<ExternalChip
|
||||||
|
href={`https://www.imdb.com/title/${e.entryIds.imdb_id}`}
|
||||||
|
>
|
||||||
|
IMDb
|
||||||
|
</ExternalChip>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Dialogs */}
|
{/* Dialogs */}
|
||||||
@@ -698,6 +691,149 @@ export function EntryDetailsPage() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------- Small building blocks ---------- */
|
||||||
|
|
||||||
|
function MetaItem({ children }: { children: ReactNode }) {
|
||||||
|
return (
|
||||||
|
<span className="inline-flex items-center gap-3">
|
||||||
|
<span className="h-1 w-1 rounded-full bg-muted-foreground/50" />
|
||||||
|
<span>{children}</span>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function IconAction({
|
||||||
|
label,
|
||||||
|
onClick,
|
||||||
|
disabled,
|
||||||
|
active,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
label: string;
|
||||||
|
onClick: () => void;
|
||||||
|
disabled?: boolean;
|
||||||
|
active?: boolean;
|
||||||
|
children: ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger
|
||||||
|
render={
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="icon-lg"
|
||||||
|
onClick={onClick}
|
||||||
|
disabled={disabled}
|
||||||
|
aria-label={label}
|
||||||
|
aria-pressed={active}
|
||||||
|
className={`h-11 w-11 rounded-full border-border/60 bg-background/60 backdrop-blur ${active ? "border-foreground/20 bg-accent" : ""}`}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent>{label}</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Section({ title, children }: { title: string; children: ReactNode }) {
|
||||||
|
return (
|
||||||
|
<section className="space-y-3">
|
||||||
|
<h3 className="text-lg font-semibold">{title}</h3>
|
||||||
|
{children}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function RatingTile({
|
||||||
|
label,
|
||||||
|
value,
|
||||||
|
accent,
|
||||||
|
emptyLabel = "—",
|
||||||
|
onClick,
|
||||||
|
}: {
|
||||||
|
label: string;
|
||||||
|
value: string | null;
|
||||||
|
accent: string;
|
||||||
|
emptyLabel?: string;
|
||||||
|
onClick?: () => void;
|
||||||
|
}) {
|
||||||
|
const content = (
|
||||||
|
<>
|
||||||
|
<span className="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground">
|
||||||
|
{label}
|
||||||
|
</span>
|
||||||
|
{value ? (
|
||||||
|
<span className="flex items-baseline gap-0.5">
|
||||||
|
<span className={`text-2xl font-bold tabular-nums ${accent}`}>
|
||||||
|
{value}
|
||||||
|
</span>
|
||||||
|
<span className="text-xs text-muted-foreground">/10</span>
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span className="text-2xl font-bold text-muted-foreground/40">
|
||||||
|
{emptyLabel}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
const className =
|
||||||
|
"flex flex-col items-center gap-1 rounded-xl border border-border/60 bg-card/50 px-2 py-3";
|
||||||
|
|
||||||
|
return onClick ? (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={onClick}
|
||||||
|
className={`${className} transition-colors hover:bg-accent`}
|
||||||
|
>
|
||||||
|
{content}
|
||||||
|
</button>
|
||||||
|
) : (
|
||||||
|
<div className={className}>{content}</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DetailRow({
|
||||||
|
icon,
|
||||||
|
label,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
icon: ReactNode;
|
||||||
|
label: string;
|
||||||
|
children: ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className="flex items-start justify-between gap-4">
|
||||||
|
<dt className="flex items-center gap-2 text-muted-foreground [&_svg]:h-3.5 [&_svg]:w-3.5">
|
||||||
|
{icon}
|
||||||
|
{label}
|
||||||
|
</dt>
|
||||||
|
<dd className="text-right font-medium">{children}</dd>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ExternalChip({
|
||||||
|
href,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
href: string;
|
||||||
|
children: ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="inline-flex items-center gap-1.5 rounded-md border border-border/60 px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
|
||||||
|
>
|
||||||
|
<ExternalLink className="h-3 w-3" />
|
||||||
|
{children}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------- Collections section ---------- */
|
/* ---------- Collections section ---------- */
|
||||||
function EntryCollectionsSection({ entryId }: { entryId: number }) {
|
function EntryCollectionsSection({ entryId }: { entryId: number }) {
|
||||||
const { data: allCollections = [], isLoading } = useCollections();
|
const { data: allCollections = [], isLoading } = useCollections();
|
||||||
@@ -709,32 +845,29 @@ function EntryCollectionsSection({ entryId }: { entryId: number }) {
|
|||||||
if (isLoading || collections.length === 0) return null;
|
if (isLoading || collections.length === 0) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Section title="In Collections">
|
||||||
<Separator />
|
|
||||||
<div className="space-y-3">
|
|
||||||
<h3 className="text-lg font-semibold">In Collections</h3>
|
|
||||||
<ScrollArea className="w-full">
|
<ScrollArea className="w-full">
|
||||||
<div className="flex gap-4 pb-4">
|
<div className="flex gap-4 pb-4">
|
||||||
{collections.map((col: Collection) => (
|
{collections.map((col: Collection) => (
|
||||||
<Link
|
<Link
|
||||||
key={col.id}
|
key={col.id}
|
||||||
to={`/collections/${col.id}`}
|
to={`/collections/${col.id}`}
|
||||||
className="group shrink-0 w-56 overflow-hidden rounded-lg relative block"
|
className="group relative block w-56 shrink-0 overflow-hidden rounded-xl ring-1 ring-border/60"
|
||||||
>
|
>
|
||||||
<div className="aspect-video w-full overflow-hidden bg-muted rounded-lg">
|
<div className="aspect-video w-full overflow-hidden bg-muted">
|
||||||
<img
|
<img
|
||||||
src={getCollectionBackdropUrl(col)}
|
src={getCollectionBackdropUrl(col)}
|
||||||
alt={col.name}
|
alt={col.name}
|
||||||
className="h-full w-full object-cover transition-transform group-hover:scale-105"
|
className="h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="absolute inset-0 bg-linear-to-t from-black/70 via-black/20 to-transparent rounded-lg" />
|
<div className="absolute inset-0 bg-linear-to-t from-black/80 via-black/20 to-transparent" />
|
||||||
<div className="absolute bottom-0 left-0 right-0 p-3">
|
<div className="absolute bottom-0 left-0 right-0 p-3">
|
||||||
<p className="text-sm font-medium text-white line-clamp-2 leading-tight">
|
<p className="line-clamp-2 text-sm font-semibold leading-tight text-white">
|
||||||
{col.name}
|
{col.name}
|
||||||
</p>
|
</p>
|
||||||
{col.entries && (
|
{col.entries && (
|
||||||
<p className="text-xs text-white/70 mt-0.5">
|
<p className="mt-0.5 text-xs text-white/70">
|
||||||
{col.entries.length}{" "}
|
{col.entries.length}{" "}
|
||||||
{col.entries.length === 1 ? "title" : "titles"}
|
{col.entries.length === 1 ? "title" : "titles"}
|
||||||
</p>
|
</p>
|
||||||
@@ -745,7 +878,6 @@ function EntryCollectionsSection({ entryId }: { entryId: number }) {
|
|||||||
</div>
|
</div>
|
||||||
<ScrollBar orientation="horizontal" />
|
<ScrollBar orientation="horizontal" />
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</div>
|
</Section>
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user