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
@@ -25,6 +25,8 @@ import {
|
||||
Trash2,
|
||||
ArrowUp,
|
||||
ArrowDown,
|
||||
Eye,
|
||||
EyeOff,
|
||||
} from "lucide-react";
|
||||
import { CollectionEditDialog } from "@/components/dialogs/CollectionEditDialog";
|
||||
import { ConfirmDialog } from "@/components/dialogs/ConfirmDialog";
|
||||
@@ -44,10 +46,12 @@ export function CollectionDetailsPage() {
|
||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||
const collectionSortPrefs = useCollectionSortStore((s) => s.prefs);
|
||||
const setSortPref = useCollectionSortStore((s) => s.setSort);
|
||||
const setHideUnseen = useCollectionSortStore((s) => s.setHideUnseen);
|
||||
const collectionId = Number(id);
|
||||
const sortPref = collectionSortPrefs[collectionId];
|
||||
const sortField: CollectionSortField = sortPref?.field ?? "order";
|
||||
const sortDir: SortDir = sortPref?.dir ?? "asc";
|
||||
const hideUnseen = sortPref?.hideUnseen ?? false;
|
||||
const deleteCollection = useDeleteCollection();
|
||||
const getCollectionParts = useGetCollectionParts();
|
||||
const removeEntryFromCollection = useRemoveEntryFromCollection();
|
||||
@@ -235,27 +239,48 @@ export function CollectionDetailsPage() {
|
||||
</div>
|
||||
|
||||
{/* Sort – bottom right */}
|
||||
{entries.length > 1 && (
|
||||
<div className="ml-auto flex items-center gap-1 self-end">
|
||||
{(["order", "year", "title", "rating"] as const).map((field) => (
|
||||
<Button
|
||||
key={field}
|
||||
variant={sortField === field ? "secondary" : "ghost"}
|
||||
size="sm"
|
||||
className="h-7 text-xs capitalize gap-1"
|
||||
onClick={() => handleSort(field)}
|
||||
>
|
||||
{field}
|
||||
{sortField === field &&
|
||||
(sortDir === "asc" ? (
|
||||
<ArrowUp className="h-3 w-3" />
|
||||
) : (
|
||||
<ArrowDown className="h-3 w-3" />
|
||||
))}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className="ml-auto flex items-center gap-1 self-end">
|
||||
{entries.length > 1 && (
|
||||
<>
|
||||
{(["order", "year", "title", "rating"] as const).map(
|
||||
(field) => (
|
||||
<Button
|
||||
key={field}
|
||||
variant={sortField === field ? "secondary" : "ghost"}
|
||||
size="sm"
|
||||
className="h-7 text-xs capitalize gap-1"
|
||||
onClick={() => handleSort(field)}
|
||||
>
|
||||
{field}
|
||||
{sortField === field &&
|
||||
(sortDir === "asc" ? (
|
||||
<ArrowUp className="h-3 w-3" />
|
||||
) : (
|
||||
<ArrowDown className="h-3 w-3" />
|
||||
))}
|
||||
</Button>
|
||||
),
|
||||
)}
|
||||
<span className="mx-1 h-5 w-px bg-white/30" />
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
variant={hideUnseen ? "secondary" : "ghost"}
|
||||
size="sm"
|
||||
className="h-7 text-xs gap-1"
|
||||
title={
|
||||
hideUnseen ? "Show all entries" : "Gray out unseen entries"
|
||||
}
|
||||
onClick={() => setHideUnseen(collectionId, !hideUnseen)}
|
||||
>
|
||||
{hideUnseen ? (
|
||||
<Eye className="h-3 w-3" />
|
||||
) : (
|
||||
<EyeOff className="h-3 w-3" />
|
||||
)}
|
||||
{hideUnseen ? "Show seen" : "Show all"}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -264,6 +289,7 @@ export function CollectionDetailsPage() {
|
||||
entries={sortedEntries}
|
||||
isLoading={false}
|
||||
collectionId={collection.id}
|
||||
grayOutUnseen={hideUnseen}
|
||||
onRemoveFromCollection={(entryId) =>
|
||||
removeEntryFromCollection.mutate({
|
||||
collectionId: collection.id,
|
||||
|
||||
Reference in new issue
Block a user