From 6b554cf90b8c64c23bc4168e1d1becf1c8d6e313 Mon Sep 17 00:00:00 2001 From: ae Date: Mon, 5 May 2025 12:42:09 +0300 Subject: [PATCH] feat: keyboard shortcuts for common actions (closes #2) --- web/src/app.css | 18 +++++--- web/src/lib/components/AuthForm.svelte | 3 +- web/src/lib/components/NoteEditor.svelte | 5 ++- web/src/lib/components/NoteView.svelte | 53 ++++++++++++++++++------ web/src/lib/components/Sidebar.svelte | 8 +++- web/src/lib/icons/editor/ViewEye.svelte | 2 - 6 files changed, 65 insertions(+), 24 deletions(-) diff --git a/web/src/app.css b/web/src/app.css index 24dd470..e9597bd 100644 --- a/web/src/app.css +++ b/web/src/app.css @@ -498,12 +498,12 @@ @apply font-copernicus mb-4 text-center text-4xl; } - .greeting-bottom-link { - @apply cursor-pointer text-[var(--light-accent)]/70 transition-colors duration-200 hover:underline; + .greeting-bottom-highlight { + @apply mx-1 cursor-default rounded-lg border-1 border-[var(--light-text)]/10 p-0.5 text-[var(--light-accent)]/70 transition-colors duration-200 hover:text-[var(--light-highlight-text)]; } - .dark .greeting-bottom-link { - @apply text-[var(--dark-accent)]; + .dark .greeting-bottom-highlight { + @apply border-[var(--dark-text)]/10 text-[var(--dark-accent)] hover:text-[var(--light-highlight-text)]; } /* * * * * * * * * * * * * */ @@ -570,6 +570,14 @@ @apply border-[var(--dark-text)]/10 text-[var(--dark-text)] hover:bg-[var(--dark-foreground)]/80; } + .button-keyboard-shortcut-hint { + @apply ml-2 rounded-lg border-1 border-[var(--light-text)]/10 px-1 text-[var(--light-text)]/50; + } + + .dark .button-keyboard-shortcut-hint { + @apply border-[var(--dark-text)]/10 text-[var(--dark-text)]/50; + } + .note-action-icon-button { @apply flex h-9 w-9 items-center justify-center rounded-lg border border-[var(--light-text)]/10 bg-transparent p-0 text-[var(--light-text)] hover:bg-[var(--light-foreground)]/80; } @@ -700,7 +708,7 @@ @apply list-decimal; } - /* Checkboxes ('todo items') */ + /* Checkboxes */ .markdown-preview input[type="checkbox"] { @apply mr-1 h-4 w-4 appearance-none rounded-md border-[var(--light-text)]/30 bg-[var(--light-foreground)] p-0 align-text-bottom; diff --git a/web/src/lib/components/AuthForm.svelte b/web/src/lib/components/AuthForm.svelte index 8fd9b1e..de40fcb 100644 --- a/web/src/lib/components/AuthForm.svelte +++ b/web/src/lib/components/AuthForm.svelte @@ -18,8 +18,7 @@ let passwordError = "" let isFormValid = false - // TODO (optional feature): - // during `onMount`, check whether user is *already authenticated* (redirect straight to `/` if yes) + // TODO (optional): route already authenticated users straight to "/" // clear any errors when swapping between login/signup views onMount(() => ($cError = null)) diff --git a/web/src/lib/components/NoteEditor.svelte b/web/src/lib/components/NoteEditor.svelte index f09a671..9d5402d 100644 --- a/web/src/lib/components/NoteEditor.svelte +++ b/web/src/lib/components/NoteEditor.svelte @@ -191,19 +191,20 @@ {/if} - +
{#if isLatestVersion(note)} - {:else}