api-client/components/app/Footer.vue

164 lines
4.9 KiB
Vue
Raw Normal View History

<template>
2021-07-24 16:46:48 +00:00
<div>
<div class="flex justify-between">
<div class="flex">
2021-07-24 16:46:48 +00:00
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
2021-08-02 15:27:18 +00:00
:title="LEFT_SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')"
2021-07-24 16:46:48 +00:00
icon="menu_open"
2021-08-11 04:57:36 +00:00
:class="{ 'transform -rotate-180': !LEFT_SIDEBAR }"
2021-08-07 13:12:15 +00:00
@click.native="LEFT_SIDEBAR = !LEFT_SIDEBAR"
2021-07-24 16:46:48 +00:00
/>
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
2021-08-02 15:27:18 +00:00
:title="`${
ZEN_MODE ? $t('action.turn_off') : $t('action.turn_on')
} ${$t('layout.zen_mode')}`"
2021-07-24 16:46:48 +00:00
:icon="ZEN_MODE ? 'fullscreen_exit' : 'fullscreen'"
:class="{
'!text-accent focus:text-accent hover:text-accent': ZEN_MODE,
}"
2021-08-07 13:12:15 +00:00
@click.native="ZEN_MODE = !ZEN_MODE"
2021-07-24 16:46:48 +00:00
/>
</div>
<div class="flex">
<span>
<tippy
ref="options"
interactive
trigger="click"
theme="popover"
arrow
>
<template #trigger>
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
icon="help_center"
:title="$t('app.help')"
/>
</template>
<div class="flex flex-col">
<SmartItem
:label="$t('app.documentation')"
to="https://github.com/hoppscotch/hoppscotch/wiki"
blank
@click.native="$refs.options.tippy().hide()"
/>
<SmartItem
:label="$t('app.keyboard_shortcuts')"
@click.native="
showShortcuts = true
$refs.options.tippy().hide()
"
/>
<SmartItem
:label="$t('app.whats_new')"
to="https://github.com/hoppscotch/hoppscotch/blob/main/CHANGELOG.md"
blank
@click.native="$refs.options.tippy().hide()"
/>
2021-08-09 12:25:30 +00:00
<SmartItem
:label="$t('app.chat_with_us')"
@click.native="
chatWithUs()
$refs.options.tippy().hide()
"
/>
<hr />
<SmartItem
:label="$t('app.twitter')"
to="https://twitter.com/hoppscotch_io"
blank
@click.native="$refs.options.tippy().hide()"
/>
<SmartItem
:label="$t('app.terms_and_privacy')"
to="https://github.com/hoppscotch/hoppscotch/wiki/Privacy-Policy"
blank
@click.native="$refs.options.tippy().hide()"
/>
<!-- <SmartItem :label="$t('app.status')" /> -->
2021-08-05 15:59:05 +00:00
<div class="flex opacity-50 py-2 px-4">
{{ `${$t("app.name")} ${$t("app.version")}` }}
</div>
</div>
</tippy>
</span>
2021-07-24 16:46:48 +00:00
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
icon="keyboard"
:title="$t('shortcuts')"
@click.native="showShortcuts = true"
/>
<ButtonSecondary
v-if="navigatorShare"
v-tippy="{ theme: 'tooltip' }"
icon="share"
2021-08-02 15:27:18 +00:00
:title="$t('request.share')"
2021-07-24 16:46:48 +00:00
@click.native="nativeShare()"
/>
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
2021-08-02 15:27:18 +00:00
:title="RIGHT_SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')"
2021-07-24 16:46:48 +00:00
icon="menu_open"
2021-08-06 16:10:26 +00:00
class="transform rotate-180"
2021-08-11 04:57:36 +00:00
:class="{ 'rotate-360': !RIGHT_SIDEBAR }"
2021-08-07 13:12:15 +00:00
@click.native="RIGHT_SIDEBAR = !RIGHT_SIDEBAR"
2021-07-24 16:46:48 +00:00
/>
</div>
</div>
2021-07-24 16:46:48 +00:00
<AppShortcuts :show="showShortcuts" @close="showShortcuts = false" />
</div>
</template>
<script lang="ts">
2021-08-07 13:12:15 +00:00
import { defineComponent, ref } from "@nuxtjs/composition-api"
import { defineActionHandler } from "~/helpers/actions"
2021-08-09 12:25:30 +00:00
import { showChat } from "~/helpers/support"
2021-08-07 13:12:15 +00:00
import { useSetting } from "~/newstore/settings"
export default defineComponent({
2021-08-07 13:12:15 +00:00
setup() {
const showShortcuts = ref(false)
defineActionHandler("flyouts.keybinds.toggle", () => {
showShortcuts.value = !showShortcuts.value
})
return {
2021-08-07 13:12:15 +00:00
LEFT_SIDEBAR: useSetting("LEFT_SIDEBAR"),
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
ZEN_MODE: useSetting("ZEN_MODE"),
navigatorShare: !!navigator.share,
showShortcuts,
}
},
watch: {
2021-08-07 13:12:15 +00:00
ZEN_MODE() {
this.LEFT_SIDEBAR = !this.ZEN_MODE
},
},
methods: {
nativeShare() {
if (navigator.share) {
navigator
.share({
title: "Hoppscotch",
text: "Hoppscotch • Open source API development ecosystem - Helps you create requests faster, saving precious time on development.",
url: "https://hoppscotch.io",
})
.then(() => {})
.catch(console.error)
} else {
// fallback
}
},
2021-08-09 12:25:30 +00:00
chatWithUs() {
showChat()
},
},
})
</script>