Skip to content

Commit 0bf4b4f

Browse files
xCJPECKOVERxollioddi
authored andcommitted
fix(web): Duplicate arrow shortcuts go to next/previous duplicate when viewing assets (immich-app#21200)
- get assetviewer state and don't handle next/previous duplicate if isViewing
1 parent c2471c8 commit 0bf4b4f

File tree

1 file changed

+16
-2
lines changed
  • web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]

1 file changed

+16
-2
lines changed

web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.svelte

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import DuplicatesInformationModal from '$lib/modals/DuplicatesInformationModal.svelte';
1313
import MetadataSelectionModal from '$lib/modals/MetadataSelectionModal.svelte';
1414
import ShortcutsModal from '$lib/modals/ShortcutsModal.svelte';
15+
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
1516
import { metadataPreferenceStore } from '$lib/stores/duplicates-metadata.store';
1617
import { locale } from '$lib/stores/preferences.store';
1718
import { featureFlags } from '$lib/stores/server-config.store';
@@ -62,6 +63,7 @@
6263
};
6364
6465
let duplicates = $state(data.duplicates);
66+
const { isViewing: showAssetViewer } = assetViewingStore;
6567
6668
const correctDuplicatesIndex = (index: number) => {
6769
return Math.max(0, Math.min(index, duplicates.length - 1));
@@ -191,9 +193,21 @@
191193
const handlePrevious = async () => {
192194
await correctDuplicatesIndexAndGo(Math.max(duplicatesIndex - 1, 0));
193195
};
196+
const handlePreviousShortcut = async () => {
197+
if ($showAssetViewer) {
198+
return;
199+
}
200+
await handlePrevious();
201+
};
194202
const handleNext = async () => {
195203
await correctDuplicatesIndexAndGo(Math.min(duplicatesIndex + 1, duplicates.length - 1));
196204
};
205+
const handleNextShortcut = async () => {
206+
if ($showAssetViewer) {
207+
return;
208+
}
209+
await handleNext();
210+
};
197211
const handleLast = async () => {
198212
await correctDuplicatesIndexAndGo(duplicates.length - 1);
199213
};
@@ -205,8 +219,8 @@
205219

206220
<svelte:document
207221
use:shortcuts={[
208-
{ shortcut: { key: 'ArrowLeft' }, onShortcut: handlePrevious },
209-
{ shortcut: { key: 'ArrowRight' }, onShortcut: handleNext },
222+
{ shortcut: { key: 'ArrowLeft' }, onShortcut: handlePreviousShortcut },
223+
{ shortcut: { key: 'ArrowRight' }, onShortcut: handleNextShortcut },
210224
]}
211225
/>
212226

0 commit comments

Comments
 (0)