show-shortcuts.svelte 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <script lang="ts">
  2. import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
  3. import { createEventDispatcher } from 'svelte';
  4. import FullScreenModal from './full-screen-modal.svelte';
  5. import { mdiClose } from '@mdi/js';
  6. const shortcuts = {
  7. general: [
  8. { key: ['←', '→'], action: 'Previous or next photo' },
  9. { key: ['Esc'], action: 'Back, close, or deselect' },
  10. { key: ['/'], action: 'Search your photos' },
  11. ],
  12. actions: [
  13. { key: ['f'], action: 'Favorite or unfavorite photo' },
  14. { key: ['i'], action: 'Show or hide info' },
  15. { key: ['⇧', 'a'], action: 'Archive or unarchive photo' },
  16. { key: ['⇧', 'd'], action: 'Download' },
  17. { key: ['⇧', 'r'], action: 'Rotate' },
  18. { key: ['Space'], action: 'Play or pause video' },
  19. { key: ['Del'], action: 'Delete Asset' },
  20. ],
  21. };
  22. const dispatch = createEventDispatcher();
  23. </script>
  24. <FullScreenModal on:clickOutside={() => dispatch('close')} on:escape={() => dispatch('close')}>
  25. <div class="flex h-full w-full place-content-center place-items-center overflow-hidden">
  26. <div
  27. class="w-[400px] max-w-[125vw] rounded-3xl border bg-immich-bg shadow-sm dark:border-immich-dark-gray dark:bg-immich-dark-gray dark:text-immich-dark-fg md:w-[650px]"
  28. >
  29. <div class="relative px-4 pt-4">
  30. <h1 class="px-4 py-4 font-medium text-immich-primary dark:text-immich-dark-primary">Keyboard Shortcuts</h1>
  31. <div class="absolute inset-y-0 right-0 px-4 py-4">
  32. <CircleIconButton icon={mdiClose} on:click={() => dispatch('close')} />
  33. </div>
  34. </div>
  35. <div class="grid grid-cols-1 gap-4 px-4 pb-4 md:grid-cols-2">
  36. <div class="px-4 py-4">
  37. <h2>General</h2>
  38. <div class="text-sm">
  39. {#each shortcuts.general as shortcut}
  40. <div class="grid grid-cols-[20%_80%] items-center gap-4 pt-4 text-sm">
  41. <div class="flex justify-self-end">
  42. {#each shortcut.key as key}
  43. <p
  44. class="mr-1 flex items-center justify-center justify-self-end rounded-lg bg-immich-primary/25 p-2"
  45. >
  46. {key}
  47. </p>
  48. {/each}
  49. </div>
  50. <p class="mb-1 mt-1 flex">{shortcut.action}</p>
  51. </div>
  52. {/each}
  53. </div>
  54. </div>
  55. <div class="px-4 py-4">
  56. <h2>Actions</h2>
  57. <div class="text-sm">
  58. {#each shortcuts.actions as shortcut}
  59. <div class="grid grid-cols-[20%_80%] items-center gap-4 pt-4 text-sm">
  60. <div class="flex justify-self-end">
  61. {#each shortcut.key as key}
  62. <p
  63. class="mr-1 flex items-center justify-center justify-self-end rounded-lg bg-immich-primary/25 p-2"
  64. >
  65. {key}
  66. </p>
  67. {/each}
  68. </div>
  69. <p class="mb-1 mt-1 flex">{shortcut.action}</p>
  70. </div>
  71. {/each}
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </FullScreenModal>