From dd93b0dd2477af21ac93d8bf8fcf913e8bf8fbc3 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 3 Jun 2024 15:45:33 -0700 Subject: [PATCH] feat: documentation button --- src/lib/components/icons/Keyboard.svelte | 19 ++++++ src/lib/components/icons/Lifebuoy.svelte | 19 ++++++ .../icons/QuestionMarkCircle.svelte | 19 ++++++ src/lib/components/layout/Help.svelte | 40 +++++++++++++ .../components/layout/Help/HelpMenu.svelte | 60 +++++++++++++++++++ src/routes/(app)/+layout.svelte | 20 +------ 6 files changed, 160 insertions(+), 17 deletions(-) create mode 100644 src/lib/components/icons/Keyboard.svelte create mode 100644 src/lib/components/icons/Lifebuoy.svelte create mode 100644 src/lib/components/icons/QuestionMarkCircle.svelte create mode 100644 src/lib/components/layout/Help.svelte create mode 100644 src/lib/components/layout/Help/HelpMenu.svelte diff --git a/src/lib/components/icons/Keyboard.svelte b/src/lib/components/icons/Keyboard.svelte new file mode 100644 index 000000000..baf633c0d --- /dev/null +++ b/src/lib/components/icons/Keyboard.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/icons/Lifebuoy.svelte b/src/lib/components/icons/Lifebuoy.svelte new file mode 100644 index 000000000..d8c49b0ae --- /dev/null +++ b/src/lib/components/icons/Lifebuoy.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/src/lib/components/icons/QuestionMarkCircle.svelte b/src/lib/components/icons/QuestionMarkCircle.svelte new file mode 100644 index 000000000..79c2e7d84 --- /dev/null +++ b/src/lib/components/icons/QuestionMarkCircle.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/src/lib/components/layout/Help.svelte b/src/lib/components/layout/Help.svelte new file mode 100644 index 000000000..2dbc26d98 --- /dev/null +++ b/src/lib/components/layout/Help.svelte @@ -0,0 +1,40 @@ + + + + + diff --git a/src/lib/components/layout/Help/HelpMenu.svelte b/src/lib/components/layout/Help/HelpMenu.svelte new file mode 100644 index 000000000..7371f629c --- /dev/null +++ b/src/lib/components/layout/Help/HelpMenu.svelte @@ -0,0 +1,60 @@ + + + { + if (e.detail === false) { + onClose(); + } + }} +> + + +
+ + { + window.open('https://docs.openwebui.com', '_blank'); + }} + > + +
{$i18n.t('Documentation')}
+
+ + { + showShortcutsHandler(); + }} + > + +
{$i18n.t('Keyboard shortcuts')}
+
+
+
+
diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index fe960f44f..8f0efe95e 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -36,6 +36,7 @@ import Tooltip from '$lib/components/common/Tooltip.svelte'; import { getBanners } from '$lib/apis/configs'; import { getUserSettings } from '$lib/apis/users'; + import Help from '$lib/components/layout/Help.svelte'; const i18n = getContext('i18n'); @@ -160,7 +161,7 @@ if (isCtrlPressed && event.key === '/') { event.preventDefault(); console.log('showShortcuts'); - showShortcutsButtonElement.click(); + document.getElementById('show-shortcuts-button')?.click(); } }); @@ -175,22 +176,7 @@ }); - - - +