High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
feat(web): Duplicate-Page shortcut changes (#11183)
Jane1ac73718c94
diff --git a/web/src/lib/components/shared-components/show-shortcuts.svelte b/web/src/lib/components/shared-components/show-shortcuts.svelteindex 9d79ed4648..ebc0dd688c 100644--- a/web/src/lib/components/shared-components/show-shortcuts.svelte+++ b/web/src/lib/components/shared-components/show-shortcuts.svelte@@ -16,7 +16,7 @@info?: string;}- const shortcuts: Shortcuts = {+ export let shortcuts: Shortcuts = {general: [{ key: ['←', '→'], action: $t('previous_or_next_photo') },{ key: ['Esc'], action: $t('back_close_deselect') },@@ -40,45 +40,48 @@<FullScreenModal title={$t('keyboard_shortcuts')} width="auto" onClose={() => dispatch('close')}><div class="grid grid-cols-1 gap-4 px-4 pb-4 md:grid-cols-2">- <div class="p-4">- <h2>{$t('general')}</h2>- <div class="text-sm">- {#each shortcuts.general as shortcut}- <div class="grid grid-cols-[30%_70%] items-center gap-4 pt-4 text-sm">- <div class="flex justify-self-end">- {#each shortcut.key as key}- <p class="mr-1 flex items-center justify-center justify-self-end rounded-lg bg-immich-primary/25 p-2">- {key}- </p>- {/each}+ {#if shortcuts.general.length > 0}+ <div class="p-4">+ <h2>{$t('general')}</h2>+ <div class="text-sm">+ {#each shortcuts.general as shortcut}+ <div class="grid grid-cols-[30%_70%] items-center gap-4 pt-4 text-sm">+ <div class="flex justify-self-end">+ {#each shortcut.key as key}+ <p class="mr-1 flex items-center justify-center justify-self-end rounded-lg bg-immich-primary/25 p-2">+ {key}+ </p>+ {/each}+ </div>+ <p class="mb-1 mt-1 flex">{shortcut.action}</p></div>- <p class="mb-1 mt-1 flex">{shortcut.action}</p>- </div>- {/each}+ {/each}+ </div></div>- </div>-- <div class="p-4">- <h2>{$t('actions')}</h2>- <div class="text-sm">- {#each shortcuts.actions as shortcut}- <div class="grid grid-cols-[30%_70%] items-center gap-4 pt-4 text-sm">- <div class="flex justify-self-end">- {#each shortcut.key as key}- <p class="mr-1 flex items-center justify-center justify-self-end rounded-lg bg-immich-primary/25 p-2">- {key}- </p>- {/each}- </div>- <div class="flex items-center gap-2">- <p class="mb-1 mt-1 flex">{shortcut.action}</p>- {#if shortcut.info}- <Icon path={mdiInformationOutline} title={shortcut.info} />- {/if}+ {/if}+ {#if shortcuts.actions.length > 0}+ <div class="p-4">+ <h2>{$t('actions')}</h2>+ <div class="text-sm">+ {#each shortcuts.actions as shortcut}+ <div class="grid grid-cols-[30%_70%] items-center gap-4 pt-4 text-sm">+ <div class="flex justify-self-end">+ {#each shortcut.key as key}+ <p class="mr-1 flex items-center justify-center justify-self-end rounded-lg bg-immich-primary/25 p-2">+ {key}+ </p>+ {/each}+ </div>+ <div class="flex items-center gap-2">+ <p class="mb-1 mt-1 flex">{shortcut.action}</p>+ {#if shortcut.info}+ <Icon path={mdiInformationOutline} title={shortcut.info} />+ {/if}+ </div></div>- </div>- {/each}+ {/each}+ </div></div>- </div>+ {/if}</div></FullScreenModal>diff --git a/web/src/lib/components/utilities-page/duplicates/duplicates-compare-control.svelte b/web/src/lib/components/utilities-page/duplicates/duplicates-compare-control.svelteindex 03140ecc98..c4015b80e5 100644--- a/web/src/lib/components/utilities-page/duplicates/duplicates-compare-control.svelte+++ b/web/src/lib/components/utilities-page/duplicates/duplicates-compare-control.svelte@@ -64,8 +64,14 @@<svelte:windowuse:shortcuts={[- { shortcut: { key: 'k', shift: true }, onShortcut: onSelectAll },- { shortcut: { key: 't', shift: true }, onShortcut: onSelectNone },+ { shortcut: { key: 'a' }, onShortcut: onSelectAll },+ {+ shortcut: { key: 's' },+ onShortcut: () => {+ setAsset(assets[0]);+ },+ },+ { shortcut: { key: 'd' }, onShortcut: onSelectNone },{ shortcut: { key: 'c', shift: true }, onShortcut: handleResolve },]}/>diff --git a/web/src/lib/i18n/en.json b/web/src/lib/i18n/en.jsonindex 8173324f8e..88dc40a3b3 100644--- a/web/src/lib/i18n/en.json+++ b/web/src/lib/i18n/en.json@@ -997,6 +997,7 @@"reset_password": "Reset password","reset_people_visibility": "Reset people visibility","reset_to_default": "Reset to default",+ "resolve_duplicates": "Resolve duplicates","resolved_all_duplicates": "Resolved all duplicates","restore": "Restore","restore_all": "Restore all",@@ -1041,6 +1042,7 @@"see_all_people": "See all people","select_album_cover": "Select album cover","select_all": "Select all",+ "select_all_duplicates": "Select all duplicates","select_avatar_color": "Select avatar color","select_face": "Select face","select_featured_photo": "Select featured photo",@@ -1166,6 +1168,7 @@"unnamed_share": "Unnamed Share","unsaved_change": "Unsaved change","unselect_all": "Unselect all",+ "unselect_all_duplicates": "Unselect all duplicates","unstack": "Un-stack","unstacked_assets_count": "Un-stacked {count, plural, one {# asset} other {# assets}}","untracked_files": "Untracked files",diff --git a/web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.svelteindex dc614d0f0e..35b2d62f29 100644--- a/web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.svelte+++ b/web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.svelte@@ -13,10 +13,34 @@import type { PageData } from './$types';import { suggestDuplicateByFileSize } from '$lib/utils';import LinkButton from '$lib/components/elements/buttons/link-button.svelte';+ import ShowShortcuts from '$lib/components/shared-components/show-shortcuts.svelte';+ import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';+ import { mdiKeyboard } from '@mdi/js';import { mdiCheckOutline, mdiTrashCanOutline } from '@mdi/js';import Icon from '$lib/components/elements/icon.svelte';export let data: PageData;+ export let isShowKeyboardShortcut = false;++ interface Shortcuts {+ general: ExplainedShortcut[];+ actions: ExplainedShortcut[];+ }+ interface ExplainedShortcut {+ key: string[];+ action: string;+ info?: string;+ }++ const duplicateShortcuts: Shortcuts = {+ general: [],+ actions: [+ { key: ['a'], action: $t('select_all_duplicates') },+ { key: ['s'], action: $t('view') },+ { key: ['d'], action: $t('unselect_all_duplicates') },+ { key: ['⇧', 'c'], action: $t('resolve_duplicates') },+ ],+ };$: hasDuplicates = data.duplicates.length > 0;@@ -132,6 +156,11 @@{$t('keep_all')}</div></LinkButton>+ <CircleIconButton+ icon={mdiKeyboard}+ title={$t('show_keyboard_shortcuts')}+ on:click={() => (isShowKeyboardShortcut = !isShowKeyboardShortcut)}+ /></div><div class="mt-4">@@ -153,3 +182,7 @@{/if}</div></UserPageLayout>++{#if isShowKeyboardShortcut}+ <ShowShortcuts shortcuts={duplicateShortcuts} on:close={() => (isShowKeyboardShortcut = false)} />+{/if}