diff --git a/web/src/lib/components/shared-components/show-shortcuts.svelte b/web/src/lib/components/shared-components/show-shortcuts.svelte index 9d79ed4648c51..ebc0dd688c1a6 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 @@ dispatch('close')}>
-
-

{$t('general')}

-
- {#each shortcuts.general as shortcut} -
-
- {#each shortcut.key as key} -

- {key} -

- {/each} -
-

{shortcut.action}

-
- {/each} -
-
- -
-

{$t('actions')}

-
- {#each shortcuts.actions as shortcut} -
-
- {#each shortcut.key as key} -

- {key} -

- {/each} -
-
+ {#if shortcuts.general.length > 0} +
+

{$t('general')}

+
+ {#each shortcuts.general as shortcut} +
+
+ {#each shortcut.key as key} +

+ {key} +

+ {/each} +

{shortcut.action}

- {#if shortcut.info} - - {/if}
-
- {/each} + {/each} +
-
+ {/if} + {#if shortcuts.actions.length > 0} +
+

{$t('actions')}

+
+ {#each shortcuts.actions as shortcut} +
+
+ {#each shortcut.key as key} +

+ {key} +

+ {/each} +
+
+

{shortcut.action}

+ {#if shortcut.info} + + {/if} +
+
+ {/each} +
+
+ {/if}
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.svelte index 03140ecc98afa..c4015b80e5459 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 @@ { + 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.json index 8173324f8eff8..88dc40a3b3bb8 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.svelte index dc614d0f0ec82..35b2d62f29785 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')}
+ (isShowKeyboardShortcut = !isShowKeyboardShortcut)} + />
@@ -153,3 +182,7 @@ {/if}
+ +{#if isShowKeyboardShortcut} + (isShowKeyboardShortcut = false)} /> +{/if}