|
12 | 12 | import DuplicatesInformationModal from '$lib/modals/DuplicatesInformationModal.svelte'; |
13 | 13 | import MetadataSelectionModal from '$lib/modals/MetadataSelectionModal.svelte'; |
14 | 14 | import ShortcutsModal from '$lib/modals/ShortcutsModal.svelte'; |
| 15 | + import { assetViewingStore } from '$lib/stores/asset-viewing.store'; |
15 | 16 | import { metadataPreferenceStore } from '$lib/stores/duplicates-metadata.store'; |
16 | 17 | import { locale } from '$lib/stores/preferences.store'; |
17 | 18 | import { featureFlags } from '$lib/stores/server-config.store'; |
|
62 | 63 | }; |
63 | 64 |
|
64 | 65 | let duplicates = $state(data.duplicates); |
| 66 | + const { isViewing: showAssetViewer } = assetViewingStore; |
65 | 67 |
|
66 | 68 | const correctDuplicatesIndex = (index: number) => { |
67 | 69 | return Math.max(0, Math.min(index, duplicates.length - 1)); |
|
191 | 193 | const handlePrevious = async () => { |
192 | 194 | await correctDuplicatesIndexAndGo(Math.max(duplicatesIndex - 1, 0)); |
193 | 195 | }; |
| 196 | + const handlePreviousShortcut = async () => { |
| 197 | + if ($showAssetViewer) { |
| 198 | + return; |
| 199 | + } |
| 200 | + await handlePrevious(); |
| 201 | + }; |
194 | 202 | const handleNext = async () => { |
195 | 203 | await correctDuplicatesIndexAndGo(Math.min(duplicatesIndex + 1, duplicates.length - 1)); |
196 | 204 | }; |
| 205 | + const handleNextShortcut = async () => { |
| 206 | + if ($showAssetViewer) { |
| 207 | + return; |
| 208 | + } |
| 209 | + await handleNext(); |
| 210 | + }; |
197 | 211 | const handleLast = async () => { |
198 | 212 | await correctDuplicatesIndexAndGo(duplicates.length - 1); |
199 | 213 | }; |
|
205 | 219 |
|
206 | 220 | <svelte:document |
207 | 221 | 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 }, |
210 | 224 | ]} |
211 | 225 | /> |
212 | 226 |
|
|
0 commit comments