api-client/packages/hoppscotch-app/components/app/Footer.vue

186 lines
5.5 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-08-28 00:17:33 +00:00
svg="sidebar"
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-08-28 00:17:33 +00:00
:svg="ZEN_MODE ? 'minimize' : 'maximize'"
2021-07-24 16:46:48 +00:00
:class="{
2021-08-17 07:26:36 +00:00
'!text-accent !focus-visible:text-accentDark !hover:text-accentDark':
ZEN_MODE,
2021-07-24 16:46:48 +00:00
}"
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>
2021-08-27 07:08:03 +00:00
<ButtonSecondary
2021-08-28 15:18:13 +00:00
svg="help-circle"
2021-08-28 00:17:33 +00:00
class="!rounded-none"
2021-08-27 07:08:03 +00:00
:label="$t('app.help')"
/>
</template>
<div class="flex flex-col">
<SmartItem
2021-08-28 00:17:33 +00:00
svg="book"
:label="$t('app.documentation')"
2021-08-19 17:08:50 +00:00
to="https://docs.hoppscotch.io"
blank
@click.native="$refs.options.tippy().hide()"
/>
<SmartItem
2021-08-28 00:17:33 +00:00
svg="zap"
:label="$t('app.keyboard_shortcuts')"
@click.native="
showShortcuts = true
$refs.options.tippy().hide()
"
/>
<SmartItem
2021-08-28 00:17:33 +00:00
svg="gift"
:label="$t('app.whats_new')"
2021-08-20 09:38:54 +00:00
to="https://docs.hoppscotch.io/changelog"
blank
@click.native="$refs.options.tippy().hide()"
/>
2021-08-09 12:25:30 +00:00
<SmartItem
2021-08-28 00:17:33 +00:00
svg="message-circle"
2021-08-09 12:25:30 +00:00
:label="$t('app.chat_with_us')"
@click.native="
chatWithUs()
$refs.options.tippy().hide()
"
/>
<hr />
<SmartItem
2021-08-28 00:17:33 +00:00
svg="twitter"
:label="$t('app.twitter')"
2021-08-28 15:18:13 +00:00
to="https://hoppscotch.io/twitter"
blank
@click.native="$refs.options.tippy().hide()"
/>
2021-08-28 15:18:13 +00:00
<SmartItem
svg="user-plus"
:label="$t('app.invite')"
@click.native="
showShare = true
$refs.options.tippy().hide()
"
/>
<SmartItem
2021-08-28 00:17:33 +00:00
svg="lock"
:label="$t('app.terms_and_privacy')"
2021-08-19 17:08:50 +00:00
to="https://docs.hoppscotch.io/privacy"
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' }"
2021-08-28 00:17:33 +00:00
svg="zap"
:title="$t('app.shortcuts')"
2021-07-24 16:46:48 +00:00
@click.native="showShortcuts = true"
/>
<ButtonSecondary
v-if="navigatorShare"
v-tippy="{ theme: 'tooltip' }"
2021-08-28 00:17:33 +00:00
svg="share-2"
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-08-28 00:17:33 +00:00
svg="sidebar"
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" />
2021-08-28 15:18:13 +00:00
<AppShare :show="showShare" @hide-modal="showShare = 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)
2021-08-28 15:18:13 +00:00
const showShare = ref(false)
2021-08-07 13:12:15 +00:00
defineActionHandler("flyouts.keybinds.toggle", () => {
showShortcuts.value = !showShortcuts.value
})
2021-08-28 15:18:13 +00:00
defineActionHandler("modals.share.toggle", () => {
showShare.value = !showShare.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,
2021-08-28 15:18:13 +00:00
showShare,
}
},
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>