Add toggle to gray out unseen entries in collections
Hide unseen button near sort controls applies grayscale + low opacity to posters of entries that haven't been watched. Preference is persisted per-collection via the existing sort store.
This commit is contained in:
1 parent
e434dd3b5e
commit
3c29cf78ea
4 files changed
+108
-37
No files matched your search
@@ -53,6 +53,8 @@ interface EntryCardProps {
|
||||
collectionId?: number;
|
||||
/** Callback to remove entry from collection */
|
||||
onRemoveFromCollection?: (entryId: number) => void;
|
||||
/** When true, apply grayscale + low opacity to posters of unseen entries */
|
||||
grayOutUnseen?: boolean;
|
||||
}
|
||||
|
||||
export function EntryCard({
|
||||
@@ -61,6 +63,7 @@ export function EntryCard({
|
||||
showTypeBadge,
|
||||
collectionId,
|
||||
onRemoveFromCollection,
|
||||
grayOutUnseen,
|
||||
}: EntryCardProps) {
|
||||
const [showConfirm, setShowConfirm] = useState(false);
|
||||
const [showRemoveCollectionConfirm, setShowRemoveCollectionConfirm] =
|
||||
@@ -90,6 +93,11 @@ export function EntryCard({
|
||||
const isInLibrary = !!libraryEntry;
|
||||
const displayEntry = libraryEntry || entry;
|
||||
|
||||
// Determine if entry has been watched
|
||||
const isSeen = !!(
|
||||
displayEntry?.entrySeens?.length || displayEntry?.date_last_seen
|
||||
);
|
||||
|
||||
// Resolve display data
|
||||
const title =
|
||||
displayEntry?.title || tmdbEntry?.title || tmdbEntry?.name || "Untitled";
|
||||
@@ -164,7 +172,9 @@ export function EntryCard({
|
||||
<img
|
||||
src={posterUrl}
|
||||
alt={title}
|
||||
className="h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
|
||||
className={`h-full w-full object-cover transition-all duration-300 group-hover:scale-105 ${
|
||||
grayOutUnseen && !isSeen ? "grayscale opacity-40" : ""
|
||||
}`}
|
||||
loading="lazy"
|
||||
/>
|
||||
|
||||
@@ -182,7 +192,9 @@ export function EntryCard({
|
||||
|
||||
{/* Quick actions button – top right, shown on hover */}
|
||||
{isInLibrary && (
|
||||
<div className={`absolute right-2 top-2 z-20 transition-opacity ${dropdownOpen ? 'opacity-100' : 'opacity-0 group-hover:opacity-100'}`}>
|
||||
<div
|
||||
className={`absolute right-2 top-2 z-20 transition-opacity ${dropdownOpen ? "opacity-100" : "opacity-0 group-hover:opacity-100"}`}
|
||||
>
|
||||
<DropdownMenu open={dropdownOpen} onOpenChange={setDropdownOpen}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useRef, useEffect } from 'react';
|
||||
import { EntryCard, EntryCardSkeleton } from './EntryCard';
|
||||
import type { Entry } from '@/types';
|
||||
import { useCallback, useRef, useEffect } from "react";
|
||||
import { EntryCard, EntryCardSkeleton } from "./EntryCard";
|
||||
import type { Entry } from "@/types";
|
||||
|
||||
interface EntryLibraryGridProps {
|
||||
entries: Entry[];
|
||||
@@ -9,6 +9,7 @@ interface EntryLibraryGridProps {
|
||||
onLoadMore?: () => void;
|
||||
collectionId?: number;
|
||||
onRemoveFromCollection?: (entryId: number) => void;
|
||||
grayOutUnseen?: boolean;
|
||||
}
|
||||
|
||||
export function EntryLibraryGrid({
|
||||
@@ -18,6 +19,7 @@ export function EntryLibraryGrid({
|
||||
onLoadMore,
|
||||
collectionId,
|
||||
onRemoveFromCollection,
|
||||
grayOutUnseen,
|
||||
}: EntryLibraryGridProps) {
|
||||
const observerRef = useRef<IntersectionObserver | null>(null);
|
||||
|
||||
@@ -32,7 +34,7 @@ export function EntryLibraryGrid({
|
||||
});
|
||||
if (node) observerRef.current.observe(node);
|
||||
},
|
||||
[isLoading, hasMore, onLoadMore]
|
||||
[isLoading, hasMore, onLoadMore],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -66,7 +68,12 @@ export function EntryLibraryGrid({
|
||||
className="animate-card-enter"
|
||||
style={{ animationDelay: `${Math.min(index * 30, 300)}ms` }}
|
||||
>
|
||||
<EntryCard entry={entry} collectionId={collectionId} onRemoveFromCollection={onRemoveFromCollection} />
|
||||
<EntryCard
|
||||
entry={entry}
|
||||
collectionId={collectionId}
|
||||
onRemoveFromCollection={onRemoveFromCollection}
|
||||
grayOutUnseen={grayOutUnseen}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
{isLoading &&
|
||||
|
||||
Reference in new issue
Block a user