From 1f5bfe67a12e7fb34da2a835bb6bb00fd919fe57 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 28 Dec 2023 02:46:57 -0800 Subject: [PATCH] feat: keyboard shortcuts --- src/lib/components/chat/Messages.svelte | 3 +- src/lib/components/chat/ShortcutsModal.svelte | 216 ++++++++++++++++++ src/lib/components/layout/Sidebar.svelte | 9 + src/routes/(app)/+layout.svelte | 76 ++++++ 4 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 src/lib/components/chat/ShortcutsModal.svelte diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index 8516dc40..df8a72b8 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -119,6 +119,7 @@ langDiv.style.fontSize = '0.75rem'; let button = document.createElement('button'); + button.className = 'copy-code-button'; button.textContent = 'Copy Code'; button.style.background = 'none'; button.style.fontSize = '0.75rem'; @@ -832,7 +833,7 @@ + +
+ +
+
+
+
+
Open new chat
+ +
+
+ Ctrl/⌘ +
+ +
+ Shift +
+ +
+ O +
+
+
+ +
+
Focus chat input
+ +
+
+ Shift +
+ +
+ Esc +
+
+
+ +
+
Copy last code block
+ +
+
+ Ctrl/⌘ +
+ +
+ Shift +
+ +
+ ; +
+
+
+ +
+
Copy last response
+ +
+
+ Ctrl/⌘ +
+ +
+ Shift +
+ +
+ C +
+
+
+
+ +
+
+
Toggle sidebar
+ +
+
+ Ctrl/⌘ +
+ +
+ Shift +
+ +
+ S +
+
+
+ +
+
Delete chat
+ +
+
+ Ctrl/⌘ +
+
+ Shift +
+ +
+ ⌫ +
+
+
+ +
+
Show shortcuts
+ +
+
+ Ctrl/⌘ +
+ +
+ / +
+
+
+
+
+
+ + + + diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index ceb7ec82..18b4f5fb 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -61,6 +61,7 @@
{:else}
+ +
+ + +
{#if !['user', 'admin'].includes($user.role)}