2019-08-24 03:06:57 +00:00
|
|
|
<template>
|
2021-07-01 16:39:11 +00:00
|
|
|
<div class="flex h-screen w-screen">
|
2021-07-25 20:03:32 +00:00
|
|
|
<Splitpanes :dbl-click-splitter="false" horizontal>
|
2021-08-05 17:22:02 +00:00
|
|
|
<Pane class="flex flex-1 hide-scrollbar !overflow-auto">
|
2021-08-05 15:59:05 +00:00
|
|
|
<Splitpanes
|
|
|
|
|
:dbl-click-splitter="false"
|
|
|
|
|
:horizontal="!(windowInnerWidth >= 768)"
|
|
|
|
|
>
|
2021-07-01 16:39:11 +00:00
|
|
|
<Pane
|
2021-07-21 09:55:46 +00:00
|
|
|
v-if="LEFT_SIDEBAR"
|
2021-08-05 15:59:05 +00:00
|
|
|
style="width: auto; height: auto"
|
|
|
|
|
class="hide-scrollbar !overflow-auto"
|
2021-07-01 16:39:11 +00:00
|
|
|
>
|
|
|
|
|
<AppSidenav />
|
|
|
|
|
</Pane>
|
2021-08-05 17:22:02 +00:00
|
|
|
<Pane class="flex flex-1 hide-scrollbar !overflow-auto">
|
2021-07-25 20:03:32 +00:00
|
|
|
<Splitpanes :dbl-click-splitter="false" horizontal>
|
2021-07-21 09:55:46 +00:00
|
|
|
<Pane v-if="!ZEN_MODE" style="height: auto">
|
2021-07-01 16:39:11 +00:00
|
|
|
<AppHeader />
|
|
|
|
|
</Pane>
|
2021-08-05 17:22:02 +00:00
|
|
|
<Pane class="flex flex-1 hide-scrollbar !overflow-auto">
|
2021-08-14 18:16:03 +00:00
|
|
|
<main class="flex flex-1 w-full">
|
2021-08-05 17:22:02 +00:00
|
|
|
<nuxt class="flex flex-1" />
|
|
|
|
|
</main>
|
2021-07-01 16:39:11 +00:00
|
|
|
</Pane>
|
|
|
|
|
</Splitpanes>
|
|
|
|
|
</Pane>
|
|
|
|
|
</Splitpanes>
|
|
|
|
|
</Pane>
|
2021-07-07 23:28:42 +00:00
|
|
|
<Pane style="height: auto">
|
2021-07-23 18:28:07 +00:00
|
|
|
<AppFooter />
|
2021-07-01 16:39:11 +00:00
|
|
|
</Pane>
|
|
|
|
|
</Splitpanes>
|
2019-09-02 04:48:01 +00:00
|
|
|
</div>
|
2019-08-24 03:06:57 +00:00
|
|
|
</template>
|
2019-10-25 08:14:34 +00:00
|
|
|
|
2021-07-21 09:55:46 +00:00
|
|
|
<script lang="ts">
|
2021-08-12 08:14:10 +00:00
|
|
|
import {
|
|
|
|
|
defineComponent,
|
2021-08-13 02:40:47 +00:00
|
|
|
onBeforeMount,
|
2021-08-12 08:14:10 +00:00
|
|
|
useContext,
|
|
|
|
|
useRouter,
|
|
|
|
|
watch,
|
|
|
|
|
} from "@nuxtjs/composition-api"
|
2021-07-01 16:39:11 +00:00
|
|
|
import { Splitpanes, Pane } from "splitpanes"
|
|
|
|
|
import "splitpanes/dist/splitpanes.css"
|
2021-07-06 12:20:37 +00:00
|
|
|
import { setupLocalPersistence } from "~/newstore/localpersistence"
|
2021-03-23 15:18:14 +00:00
|
|
|
import { performMigrations } from "~/helpers/migrations"
|
2021-05-14 00:16:10 +00:00
|
|
|
import { initUserInfo } from "~/helpers/teams/BackendUserInfo"
|
2021-05-14 03:40:53 +00:00
|
|
|
import { registerApolloAuthUpdate } from "~/helpers/apollo"
|
2021-06-14 04:07:30 +00:00
|
|
|
import { initializeFirebase } from "~/helpers/fb"
|
2021-08-12 08:14:10 +00:00
|
|
|
import { useSetting } from "~/newstore/settings"
|
2021-07-09 03:39:07 +00:00
|
|
|
import { logPageView } from "~/helpers/fb/analytics"
|
2021-07-30 02:13:06 +00:00
|
|
|
import { hookKeybindingsListener } from "~/helpers/keybindings"
|
2021-08-10 08:16:42 +00:00
|
|
|
import { defineActionHandler } from "~/helpers/actions"
|
2021-07-21 09:55:46 +00:00
|
|
|
|
2021-08-13 02:40:47 +00:00
|
|
|
function updateThemes() {
|
|
|
|
|
const { $colorMode } = useContext() as any
|
|
|
|
|
|
|
|
|
|
// Apply theme updates
|
|
|
|
|
const themeColor = useSetting("THEME_COLOR")
|
|
|
|
|
const bgColor = useSetting("BG_COLOR")
|
|
|
|
|
const fontSize = useSetting("FONT_SIZE")
|
|
|
|
|
|
|
|
|
|
// Initially apply
|
|
|
|
|
onBeforeMount(() => {
|
|
|
|
|
document.documentElement.setAttribute("data-accent", themeColor.value)
|
|
|
|
|
$colorMode.preference = bgColor.value
|
2021-08-14 16:10:56 +00:00
|
|
|
document.documentElement.setAttribute("data-font-size", fontSize.value)
|
2021-08-13 02:40:47 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Listen for updates
|
|
|
|
|
watch(themeColor, () =>
|
|
|
|
|
document.documentElement.setAttribute("data-accent", themeColor.value)
|
|
|
|
|
)
|
|
|
|
|
watch(bgColor, () => ($colorMode.preference = bgColor.value))
|
|
|
|
|
watch(fontSize, () =>
|
2021-08-14 16:10:56 +00:00
|
|
|
document.documentElement.setAttribute("data-font-size", fontSize.value)
|
2021-08-13 02:40:47 +00:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function defineJumpActions() {
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
|
|
defineActionHandler("navigation.jump.rest", () => {
|
|
|
|
|
router.push({ path: "/" })
|
|
|
|
|
})
|
|
|
|
|
defineActionHandler("navigation.jump.graphql", () => {
|
|
|
|
|
router.push({ path: "/graphql" })
|
|
|
|
|
})
|
|
|
|
|
defineActionHandler("navigation.jump.realtime", () => {
|
|
|
|
|
router.push({ path: "/realtime" })
|
|
|
|
|
})
|
|
|
|
|
defineActionHandler("navigation.jump.documentation", () => {
|
|
|
|
|
router.push({ path: "/documentation" })
|
|
|
|
|
})
|
|
|
|
|
defineActionHandler("navigation.jump.settings", () => {
|
|
|
|
|
router.push({ path: "/settings" })
|
|
|
|
|
})
|
|
|
|
|
defineActionHandler("navigation.jump.back", () => {
|
|
|
|
|
router.go(-1)
|
|
|
|
|
})
|
|
|
|
|
defineActionHandler("navigation.jump.forward", () => {
|
|
|
|
|
router.go(1)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-21 09:55:46 +00:00
|
|
|
export default defineComponent({
|
2021-07-01 16:39:11 +00:00
|
|
|
components: { Splitpanes, Pane },
|
2021-07-30 02:13:06 +00:00
|
|
|
setup() {
|
|
|
|
|
hookKeybindingsListener()
|
2021-08-12 08:14:10 +00:00
|
|
|
|
2021-08-13 02:40:47 +00:00
|
|
|
defineJumpActions()
|
2021-08-12 08:14:10 +00:00
|
|
|
|
2021-08-13 02:40:47 +00:00
|
|
|
updateThemes()
|
2021-08-12 08:14:10 +00:00
|
|
|
|
2021-07-01 16:39:11 +00:00
|
|
|
return {
|
2021-08-12 08:14:10 +00:00
|
|
|
LEFT_SIDEBAR: useSetting("LEFT_SIDEBAR"),
|
|
|
|
|
ZEN_MODE: useSetting("ZEN_MODE"),
|
2021-07-21 05:20:20 +00:00
|
|
|
}
|
|
|
|
|
},
|
2021-08-12 08:14:10 +00:00
|
|
|
data() {
|
2021-07-21 05:20:20 +00:00
|
|
|
return {
|
2021-08-12 08:14:10 +00:00
|
|
|
windowInnerWidth: 0,
|
2021-07-01 16:39:11 +00:00
|
|
|
}
|
|
|
|
|
},
|
2021-07-05 12:56:00 +00:00
|
|
|
watch: {
|
2021-07-09 03:39:07 +00:00
|
|
|
$route(to) {
|
|
|
|
|
logPageView(to.fullPath)
|
|
|
|
|
},
|
2021-07-05 12:56:00 +00:00
|
|
|
},
|
2019-11-12 04:18:57 +00:00
|
|
|
beforeMount() {
|
2021-07-15 02:29:11 +00:00
|
|
|
setupLocalPersistence()
|
|
|
|
|
|
2021-05-14 03:40:53 +00:00
|
|
|
registerApolloAuthUpdate()
|
2019-11-12 04:18:57 +00:00
|
|
|
},
|
2021-01-23 11:52:54 +00:00
|
|
|
async mounted() {
|
2021-08-05 15:59:05 +00:00
|
|
|
window.addEventListener("resize", this.handleResize)
|
|
|
|
|
this.handleResize()
|
2021-03-23 15:18:14 +00:00
|
|
|
performMigrations()
|
2020-01-09 00:31:31 +00:00
|
|
|
console.log(
|
2020-02-25 02:06:23 +00:00
|
|
|
"%cWe ❤︎ open source!",
|
|
|
|
|
"background-color:white;padding:8px 16px;border-radius:8px;font-size:32px;color:red;"
|
2020-02-24 18:44:50 +00:00
|
|
|
)
|
2020-01-09 00:31:31 +00:00
|
|
|
console.log(
|
2020-08-13 11:20:02 +00:00
|
|
|
"%cContribute: https://github.com/hoppscotch/hoppscotch",
|
2020-02-25 02:06:23 +00:00
|
|
|
"background-color:black;padding:4px 8px;border-radius:8px;font-size:16px;color:white;"
|
2020-02-24 18:44:50 +00:00
|
|
|
)
|
2021-04-26 09:37:18 +00:00
|
|
|
|
2021-07-24 21:45:48 +00:00
|
|
|
const workbox = await (window as any).$workbox
|
2021-01-23 11:52:54 +00:00
|
|
|
if (workbox) {
|
2021-07-24 10:58:32 +00:00
|
|
|
workbox.addEventListener("installed", (event: any) => {
|
2021-01-23 11:52:54 +00:00
|
|
|
if (event.isUpdate) {
|
2021-08-02 15:27:18 +00:00
|
|
|
this.$toast.show(this.$t("app.new_version_found").toString(), {
|
2021-01-23 11:52:54 +00:00
|
|
|
icon: "info",
|
|
|
|
|
duration: 0,
|
|
|
|
|
action: [
|
|
|
|
|
{
|
2021-07-06 12:20:37 +00:00
|
|
|
text: this.$t("reload").toString(),
|
2021-05-18 06:26:59 +00:00
|
|
|
onClick: (_, toastObject) => {
|
2021-01-23 11:52:54 +00:00
|
|
|
toastObject.goAway(0)
|
2021-05-18 16:09:55 +00:00
|
|
|
window.location.reload()
|
2021-01-23 11:52:54 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2021-03-23 15:18:14 +00:00
|
|
|
|
2021-06-14 04:07:30 +00:00
|
|
|
initializeFirebase()
|
2021-05-14 00:16:10 +00:00
|
|
|
initUserInfo()
|
2021-07-09 03:39:07 +00:00
|
|
|
|
|
|
|
|
logPageView(this.$router.currentRoute.fullPath)
|
2019-11-12 04:18:57 +00:00
|
|
|
},
|
2021-08-05 15:59:05 +00:00
|
|
|
destroyed() {
|
|
|
|
|
window.removeEventListener("resize", this.handleResize)
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleResize() {
|
|
|
|
|
this.windowInnerWidth = window.innerWidth
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-07-21 09:55:46 +00:00
|
|
|
})
|
2019-08-24 03:06:57 +00:00
|
|
|
</script>
|