From d937e537b9f6f8912bf8661f0c4fd336578ff2f3 Mon Sep 17 00:00:00 2001 From: tanchekwei Date: Fri, 15 Mar 2024 20:33:52 +0800 Subject: [PATCH] Use modifier + f11 to hide both menu bar and app bar Able to show app bar but hide menu bar via setting --- src/App.vue | 253 ++++++++++-------- src/background.js | 4 + .../BotSettings/CommonBotSettings.vue | 17 +- src/components/BotSettings/settings.const.js | 1 + src/components/SettingsModal.vue | 26 +- .../ShortcutGuide/shortcut.const.js | 11 + src/main.js | 1 + src/store/index.js | 7 + 8 files changed, 205 insertions(+), 115 deletions(-) diff --git a/src/App.vue b/src/App.vue index 4fc29709b3..fcce095d0b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,118 +6,132 @@ v-model:open="isChatDrawerOpen" @focus-textarea="focusPromptTextarea" > - - - -
- - - -
-
- -
-
- - - - -
- - -
+ + - - mdi-arrow-left - - {{ - $t("header.selectedResponsesCount", { - selectedCount: store.state.selectedResponses.length, - }) - }} -
-
- -
- -
+ +
+ + + +
+
+ +
+
+ + + + +
+ + +
+ + mdi-arrow-left + + {{ + $t("header.selectedResponsesCount", { + selectedCount: store.state.selectedResponses.length, + }) + }} +
+
+ +
+ + + @@ -157,6 +171,7 @@ import { SHORTCUT_SHORTCUT_GUIDE, SHORTCUT_CLEAR_MESSAGES, SHORTCUT_CHAT_DRAWER, + SHORTCUT_APP_BAR, } from "./components/ShortcutGuide/shortcut.const"; import i18n from "./i18n"; @@ -208,6 +223,7 @@ const shortcutGuideRef = ref(null); const isShortcutGuideOpen = ref(false); const isSettingsOpen = ref(false); const isChatDrawerOpen = ref(store.state.isChatDrawerOpen); +const isShowAppBar = ref(store.state.general.isShowAppBar); const chatDrawerRef = ref(); const isSelectedResponsesEmpty = ref(true); const isChatActionOpen = ref(false); @@ -236,9 +252,10 @@ function openFind() { } function toggleShortcutGuide() { - if (!isChatDrawerOpen.value) { + if (!isChatDrawerOpen.value || !isShowAppBar.value) { // open chat drawer to show new chat shortcut isChatDrawerOpen.value = true; + isShowAppBar.value = true; setTimeout(() => { shortcutGuideRef.value.toggleShortcutGuide(); }, 200); @@ -281,6 +298,15 @@ watch( }, ); +watch( + () => isShowAppBar.value, + () => + store.commit("setGeneral", { + isShowAppBar: isShowAppBar.value, + isShowMenuBar: isShowAppBar.value, + }), +); + function getColumnImage(columnCount) { return require(`@/assets/column-${columnCount}.svg`); } @@ -391,4 +417,7 @@ img.selected { .no-text-transform { text-transform: none !important; } +.paddingTopZero { + padding-top: 0!important; +} diff --git a/src/background.js b/src/background.js index ef8f5911d4..a8d7c1650e 100644 --- a/src/background.js +++ b/src/background.js @@ -365,6 +365,10 @@ ipcMain.handle("save-proxy-and-restart", async () => { }); // Proxy Setting End +ipcMain.handle("set-is-show-menu-bar", (_, isShowMenuBar) => { + mainWindow.setMenuBarVisibility(isShowMenuBar); +}); + ipcMain.handle("get-cookies", async (event, filter) => { return await getCookies(filter); }); diff --git a/src/components/BotSettings/CommonBotSettings.vue b/src/components/BotSettings/CommonBotSettings.vue index b772e469c1..6a5b7ef01a 100644 --- a/src/components/BotSettings/CommonBotSettings.vue +++ b/src/components/BotSettings/CommonBotSettings.vue @@ -24,7 +24,7 @@ " > + diff --git a/src/components/BotSettings/settings.const.js b/src/components/BotSettings/settings.const.js index 3a9eed47eb..cf04b5c51c 100644 --- a/src/components/BotSettings/settings.const.js +++ b/src/components/BotSettings/settings.const.js @@ -3,4 +3,5 @@ export const Type = { Slider: 1, Select: 2, Combobox: 3, + Checkbox: 4, }; diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue index a15aadbb6a..bf33b53ec8 100644 --- a/src/components/SettingsModal.vue +++ b/src/components/SettingsModal.vue @@ -59,6 +59,11 @@ @update:model-value="setCurrentMode($event)" > +
@@ -84,13 +89,15 @@