Add poster popup, selectable title, collection media previews and library toggles
- Collection edit dialog shows the current poster and backdrop when available - Entry details: title is selectable (action row no longer overlays it) - Entry details: clicking the poster opens it full size in a dialog - Library: Favorites and Hidden are toggles that combine with the type tabs
This commit is contained in:
1 parent
c74e54bc2a
commit
834e02e76b
6 files changed
+258
-114
No files matched your search
@@ -13,6 +13,11 @@ import { Textarea } from "@/components/ui/textarea";
|
||||
import { ImageIcon } from "lucide-react";
|
||||
import { StarRating } from "@/components/ui/star-rating";
|
||||
import { useUpdateCollection } from "@/hooks/useCollections";
|
||||
import {
|
||||
DEFAULT_POSTER,
|
||||
getCollectionDisplayBackdropUrl,
|
||||
getCollectionDisplayPosterUrl,
|
||||
} from "@/lib/collection-media";
|
||||
import type { Collection } from "@/types";
|
||||
|
||||
interface CollectionEditDialogProps {
|
||||
@@ -34,6 +39,14 @@ export function CollectionEditDialog({
|
||||
const [posterPreview, setPosterPreview] = useState<string | null>(null);
|
||||
const [backdropPreview, setBackdropPreview] = useState<string | null>(null);
|
||||
|
||||
// What the collection page currently shows, so the user can see what an
|
||||
// upload would replace. The default placeholder doesn't count as a poster.
|
||||
const displayPoster = getCollectionDisplayPosterUrl(collection);
|
||||
const currentPoster = displayPoster === DEFAULT_POSTER ? null : displayPoster;
|
||||
const currentBackdrop = getCollectionDisplayBackdropUrl(collection);
|
||||
const shownPoster = posterPreview ?? currentPoster;
|
||||
const shownBackdrop = backdropPreview ?? currentBackdrop;
|
||||
|
||||
const posterInputRef = useRef<HTMLInputElement>(null);
|
||||
const backdropInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
@@ -131,15 +144,20 @@ export function CollectionEditDialog({
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="w-full h-20 flex flex-col gap-1"
|
||||
className="group relative w-full h-32 p-0 overflow-hidden flex flex-col gap-1"
|
||||
onClick={() => posterInputRef.current?.click()}
|
||||
>
|
||||
{posterPreview ? (
|
||||
<img
|
||||
src={posterPreview}
|
||||
alt="Poster preview"
|
||||
className="h-14 w-auto rounded object-cover"
|
||||
/>
|
||||
{shownPoster ? (
|
||||
<>
|
||||
<img
|
||||
src={shownPoster}
|
||||
alt="Poster preview"
|
||||
className="h-full w-full object-contain bg-muted"
|
||||
/>
|
||||
<span className="absolute inset-0 flex items-center justify-center bg-black/50 text-xs font-medium text-white opacity-0 transition-opacity group-hover:opacity-100">
|
||||
Change Poster
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<ImageIcon className="h-5 w-5 text-muted-foreground" />
|
||||
@@ -163,15 +181,20 @@ export function CollectionEditDialog({
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="w-full h-20 flex flex-col gap-1"
|
||||
className="group relative w-full h-32 p-0 overflow-hidden flex flex-col gap-1"
|
||||
onClick={() => backdropInputRef.current?.click()}
|
||||
>
|
||||
{backdropPreview ? (
|
||||
<img
|
||||
src={backdropPreview}
|
||||
alt="Backdrop preview"
|
||||
className="h-14 w-auto rounded object-cover"
|
||||
/>
|
||||
{shownBackdrop ? (
|
||||
<>
|
||||
<img
|
||||
src={shownBackdrop}
|
||||
alt="Backdrop preview"
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
<span className="absolute inset-0 flex items-center justify-center bg-black/50 text-xs font-medium text-white opacity-0 transition-opacity group-hover:opacity-100">
|
||||
Change Backdrop
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<ImageIcon className="h-5 w-5 text-muted-foreground" />
|
||||
|
||||
Reference in new issue
Block a user