Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: make search and support available in zen mode

liyasthomasf53f0467665c
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')} <xmp>/</xmp>`"
svg="search"
class="rounded hover:bg-primaryDark focus-visible:bg-primaryDark"
- @click.native="showSearch = true"
+ @click.native="invokeAction('modals.search.toggle')"
/>
<ButtonSecondary
v-tippy="{ theme: 'tooltip', allowHTML: true }"
@@ -34,7 +34,7 @@
} <xmp>?</xmp>`"
svg="life-buoy"
class="rounded hover:bg-primaryDark focus-visible:bg-primaryDark"
- @click.native="showSupport = true"
+ @click.native="invokeAction('modals.support.toggle')"
/>
<ButtonSecondary
v-if="currentUser === null"
@@ -139,14 +139,7 @@
</header>
<AppAnnouncement v-if="!network.isOnline" />
<FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" />
- <AppSupport
- v-if="mdAndLarger"
- :show="showSupport"
- @hide-modal="showSupport = false"
- />
- <AppOptions v-else :show="showSupport" @hide-modal="showSupport = false" />
<TeamsModal :show="showTeamsModal" @hide-modal="showTeamsModal = false" />
- <AppPowerSearch :show="showSearch" @hide-modal="showSearch = false" />
</div>
</template>
@@ -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 @@
<AppSidenav />
</Pane>
</Splitpanes>
+ <AppPowerSearch :show="showSearch" @hide-modal="showSearch = false" />
+ <AppSupport
+ v-if="mdAndLarger"
+ :show="showSupport"
+ @hide-modal="showSupport = false"
+ />
+ <AppOptions v-else :show="showSupport" @hide-modal="showSupport = false" />
</div>
</template>
@@ -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() {