diff --git a/web/src/lib/components/photos-page/asset-grid.svelte b/web/src/lib/components/photos-page/asset-grid.svelte index db8f232b57..ae4673e0bd 100644 --- a/web/src/lib/components/photos-page/asset-grid.svelte +++ b/web/src/lib/components/photos-page/asset-grid.svelte @@ -30,6 +30,7 @@ import { goto } from '$app/navigation'; import { browser } from '$app/environment'; import { isSearchEnabled } from '$lib/stores/search.store'; + import ShowShortcuts from '../shared-components/show-shortcuts.svelte'; export let user: UserResponseDto | undefined = undefined; export let isAlbumSelectionMode = false; @@ -39,6 +40,7 @@ let viewportWidth = 0; let assetGridElement: HTMLElement; let bucketInfo: AssetCountByTimeBucketResponseDto; + let showShortcuts = false; const onKeyboardPress = (event: KeyboardEvent) => handleKeyboardPress(event); @@ -93,6 +95,9 @@ if (!$isViewingAssetStoreState) { switch (event.key) { + case '?': + if (event.shiftKey) showShortcuts = !showShortcuts; + return; case '/': goto(AppRoute.EXPLORE); return; @@ -290,6 +295,10 @@ +{#if showShortcuts} + (showShortcuts = !showShortcuts)} /> +{/if} + {#if bucketInfo && viewportHeight && $assetGridState.timelineHeight > viewportHeight} + import Close from 'svelte-material-icons/Close.svelte'; + import CircleIconButton from '../elements/buttons/circle-icon-button.svelte'; + import { createEventDispatcher } from 'svelte'; + + const shortcuts = { + general: [ + { key: ['←', '→'], action: 'Previous or next photo' }, + { key: ['Esc'], action: 'Back, close, or deselect' }, + { key: ['/'], action: 'Search your photos' }, + ], + actions: [ + { key: ['f'], action: 'Favorite or unfavorite photo' }, + { key: ['i'], action: 'Show or hide info' }, + { key: ['⇧', 'a'], action: 'Archive or unarchive photo' }, + { key: ['⇧', 'd'], action: 'Download' }, + { key: ['Space'], action: 'Play or pause video' }, + { key: ['Del'], action: 'Delete Asset' }, + ], + }; + const dispatch = createEventDispatcher(); + + +
+
+
+
+

Keyboard Shortcuts

+
+ dispatch('close')} /> +
+
+ +
+
+

General

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

+ {key} +

+ {/each} +
+

{shortcut.action}

+
+ {/each} +
+
+ +
+

Actions

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

+ {key} +

+ {/each} +
+

{shortcut.action}

+
+ {/each} +
+
+
+
+
+