From 9df6d7850148a49347bb64aa5279966fe06b1e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Gil=20P=C3=A9rez?= Date: Mon, 20 Apr 2026 23:03:40 +0200 Subject: [PATCH] fix(AssetGrid): dim non-selected siblings during selection mode Upstream already shows the selected ring + clickable check badge on each thumbnail. This adds the missing piece for dense grids: a slight opacity reduction on non-selected items while a selection is in progress, so the selected set stays visible at a glance. Implemented by passing selectionMode={selectable && selectedIds.length > 0} from AssetGrid to LazyGridImage; LazyGridImage applies opacity-60 to its container when selectionMode && !photo.isSelected. --- src/components/shared/AssetGrid.tsx | 1 + src/components/ui/lazy-grid-image.tsx | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/shared/AssetGrid.tsx b/src/components/shared/AssetGrid.tsx index 74b33a6..160d52d 100644 --- a/src/components/shared/AssetGrid.tsx +++ b/src/components/shared/AssetGrid.tsx @@ -216,6 +216,7 @@ const AssetGrid = forwardRef(({ assets, isInternal height={context.height} selectable={selectable} onSelect={(event) => handleSelect(context.index, context.photo, event)} + selectionMode={selectable && selectedIds.length > 0} /> ); }; diff --git a/src/components/ui/lazy-grid-image.tsx b/src/components/ui/lazy-grid-image.tsx index 703bf10..4751fa5 100644 --- a/src/components/ui/lazy-grid-image.tsx +++ b/src/components/ui/lazy-grid-image.tsx @@ -13,15 +13,17 @@ interface LazyGridImageProps { height: number; selectable?: boolean; onSelect?: (event: React.MouseEvent) => void; + /** When true, dim non-selected siblings so the selected set is visible in dense grids. */ + selectionMode?: boolean; } -export default function LazyGridImage({ imageProps, photo, width, height, selectable, onSelect }: LazyGridImageProps) { +export default function LazyGridImage({ imageProps, photo, width, height, selectable, onSelect, selectionMode = false }: LazyGridImageProps) { const [isVisible, setIsVisible] = React.useState(false) const imageRef = React.useRef(null) const setupObserver = () => { const observer = new IntersectionObserver((entries) => { - + entries.forEach((entry) => { if (entry.isIntersecting) { setIsVisible(true) @@ -47,14 +49,16 @@ export default function LazyGridImage({ imageProps, photo, width, height, select
) + const dim = selectionMode && !photo.isSelected ? 'opacity-60' : ''; + return ( -
{imageProps.alt {photo.isVideo &&
@@ -62,7 +66,7 @@ export default function LazyGridImage({ imageProps, photo, width, height, select {!!photo.duration && {humanizeDuration(photo.duration)}}
} {selectable && ( -
{ e.stopPropagation();