From f53f0467665cb9a9dd3dd93d2e819c831bd4fcc6 Mon Sep 17 00:00:00 2001 From: liyasthomas Date: Tue, 29 Mar 2022 20:38:29 +0530 Subject: [PATCH] fix: make search and support available in zen mode --- .../hoppscotch-app/components/app/Header.vue | 23 +++---------------- packages/hoppscotch-app/layouts/default.vue | 21 +++++++++++++++++ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/packages/hoppscotch-app/components/app/Header.vue b/packages/hoppscotch-app/components/app/Header.vue index 98aac7e70..897fe59ae 100644 --- a/packages/hoppscotch-app/components/app/Header.vue +++ b/packages/hoppscotch-app/components/app/Header.vue @@ -25,7 +25,7 @@ :title="`${t('app.search')} /`" svg="search" class="rounded hover:bg-primaryDark focus-visible:bg-primaryDark" - @click.native="showSearch = true" + @click.native="invokeAction('modals.search.toggle')" /> ?`" svg="life-buoy" class="rounded hover:bg-primaryDark focus-visible:bg-primaryDark" - @click.native="showSupport = true" + @click.native="invokeAction('modals.support.toggle')" /> - - - @@ -161,7 +154,7 @@ import { useI18n, useToast, } from "~/helpers/utils/composables" -import { defineActionHandler } from "~/helpers/actions" +import { invokeAction } from "~/helpers/actions" const t = useI18n() @@ -174,10 +167,8 @@ const toast = useToast() */ const showInstallPrompt = ref(() => Promise.resolve()) // Async no-op till it is initialized -const showSupport = ref(false) const showLogin = ref(false) const showTeamsModal = ref(false) -const showSearch = ref(false) const breakpoints = useBreakpoints(breakpointsTailwind) const mdAndLarger = breakpoints.greater("md") @@ -186,14 +177,6 @@ const network = reactive(useNetwork()) const currentUser = useReadonlyStream(probableUser$, null) -defineActionHandler("modals.support.toggle", () => { - showSupport.value = !showSupport.value -}) - -defineActionHandler("modals.search.toggle", () => { - showSearch.value = !showSearch.value -}) - onMounted(() => { // Initializes the PWA code - checks if the app is installed, // etc. diff --git a/packages/hoppscotch-app/layouts/default.vue b/packages/hoppscotch-app/layouts/default.vue index c8f8d9aca..6c8129fdf 100644 --- a/packages/hoppscotch-app/layouts/default.vue +++ b/packages/hoppscotch-app/layouts/default.vue @@ -45,6 +45,13 @@ + + + @@ -56,6 +63,7 @@ import { useContext, useRouter, watch, + ref, } from "@nuxtjs/composition-api" import { Splitpanes, Pane } from "splitpanes" import "splitpanes/dist/splitpanes.css" @@ -209,10 +217,23 @@ export default defineComponent({ const breakpoints = useBreakpoints(breakpointsTailwind) const mdAndLarger = breakpoints.greater("md") + const showSearch = ref(false) + const showSupport = ref(false) + + defineActionHandler("modals.search.toggle", () => { + showSearch.value = !showSearch.value + }) + + defineActionHandler("modals.support.toggle", () => { + showSupport.value = !showSupport.value + }) + return { mdAndLarger, spacerClass, ZEN_MODE: useSetting("ZEN_MODE"), + showSearch, + showSupport, } }, head() {