Footer.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div>
  3. <div class="flex justify-between">
  4. <div class="flex">
  5. <ButtonSecondary
  6. v-tippy="{ theme: 'tooltip' }"
  7. :title="LEFT_SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')"
  8. svg="sidebar"
  9. :class="{ 'transform -rotate-180': !LEFT_SIDEBAR }"
  10. @click.native="LEFT_SIDEBAR = !LEFT_SIDEBAR"
  11. />
  12. <ButtonSecondary
  13. v-tippy="{ theme: 'tooltip' }"
  14. :title="`${
  15. ZEN_MODE ? $t('action.turn_off') : $t('action.turn_on')
  16. } ${$t('layout.zen_mode')}`"
  17. :svg="ZEN_MODE ? 'minimize' : 'maximize'"
  18. :class="{
  19. '!text-accent !focus-visible:text-accentDark !hover:text-accentDark':
  20. ZEN_MODE,
  21. }"
  22. @click.native="ZEN_MODE = !ZEN_MODE"
  23. />
  24. </div>
  25. <div class="flex">
  26. <span>
  27. <tippy
  28. ref="options"
  29. interactive
  30. trigger="click"
  31. theme="popover"
  32. arrow
  33. >
  34. <template #trigger>
  35. <ButtonSecondary
  36. svg="help-circle"
  37. class="!rounded-none"
  38. :label="$t('app.help')"
  39. />
  40. </template>
  41. <div class="flex flex-col">
  42. <SmartItem
  43. svg="book"
  44. :label="$t('app.documentation')"
  45. to="https://docs.hoppscotch.io"
  46. blank
  47. @click.native="$refs.options.tippy().hide()"
  48. />
  49. <SmartItem
  50. svg="zap"
  51. :label="$t('app.keyboard_shortcuts')"
  52. @click.native="
  53. showShortcuts = true
  54. $refs.options.tippy().hide()
  55. "
  56. />
  57. <SmartItem
  58. svg="gift"
  59. :label="$t('app.whats_new')"
  60. to="https://docs.hoppscotch.io/changelog"
  61. blank
  62. @click.native="$refs.options.tippy().hide()"
  63. />
  64. <SmartItem
  65. svg="message-circle"
  66. :label="$t('app.chat_with_us')"
  67. @click.native="
  68. chatWithUs()
  69. $refs.options.tippy().hide()
  70. "
  71. />
  72. <hr />
  73. <SmartItem
  74. svg="twitter"
  75. :label="$t('app.twitter')"
  76. to="https://hoppscotch.io/twitter"
  77. blank
  78. @click.native="$refs.options.tippy().hide()"
  79. />
  80. <SmartItem
  81. svg="user-plus"
  82. :label="$t('app.invite')"
  83. @click.native="
  84. showShare = true
  85. $refs.options.tippy().hide()
  86. "
  87. />
  88. <SmartItem
  89. svg="lock"
  90. :label="$t('app.terms_and_privacy')"
  91. to="https://docs.hoppscotch.io/privacy"
  92. blank
  93. @click.native="$refs.options.tippy().hide()"
  94. />
  95. <!-- <SmartItem :label="$t('app.status')" /> -->
  96. <div class="flex opacity-50 py-2 px-4">
  97. {{ `${$t("app.name")} ${$t("app.version")}` }}
  98. </div>
  99. </div>
  100. </tippy>
  101. </span>
  102. <ButtonSecondary
  103. v-tippy="{ theme: 'tooltip' }"
  104. svg="zap"
  105. :title="$t('app.shortcuts')"
  106. @click.native="showShortcuts = true"
  107. />
  108. <ButtonSecondary
  109. v-if="navigatorShare"
  110. v-tippy="{ theme: 'tooltip' }"
  111. svg="share-2"
  112. :title="$t('request.share')"
  113. @click.native="nativeShare()"
  114. />
  115. <ButtonSecondary
  116. v-tippy="{ theme: 'tooltip' }"
  117. :title="RIGHT_SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')"
  118. svg="sidebar"
  119. class="transform rotate-180"
  120. :class="{ 'rotate-360': !RIGHT_SIDEBAR }"
  121. @click.native="RIGHT_SIDEBAR = !RIGHT_SIDEBAR"
  122. />
  123. </div>
  124. </div>
  125. <AppShortcuts :show="showShortcuts" @close="showShortcuts = false" />
  126. <AppShare :show="showShare" @hide-modal="showShare = false" />
  127. </div>
  128. </template>
  129. <script lang="ts">
  130. import { defineComponent, ref } from "@nuxtjs/composition-api"
  131. import { defineActionHandler } from "~/helpers/actions"
  132. import { showChat } from "~/helpers/support"
  133. import { useSetting } from "~/newstore/settings"
  134. export default defineComponent({
  135. setup() {
  136. const showShortcuts = ref(false)
  137. const showShare = ref(false)
  138. defineActionHandler("flyouts.keybinds.toggle", () => {
  139. showShortcuts.value = !showShortcuts.value
  140. })
  141. defineActionHandler("modals.share.toggle", () => {
  142. showShare.value = !showShare.value
  143. })
  144. return {
  145. LEFT_SIDEBAR: useSetting("LEFT_SIDEBAR"),
  146. RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
  147. ZEN_MODE: useSetting("ZEN_MODE"),
  148. navigatorShare: !!navigator.share,
  149. showShortcuts,
  150. showShare,
  151. }
  152. },
  153. watch: {
  154. ZEN_MODE() {
  155. this.LEFT_SIDEBAR = !this.ZEN_MODE
  156. },
  157. },
  158. methods: {
  159. nativeShare() {
  160. if (navigator.share) {
  161. navigator
  162. .share({
  163. title: "Hoppscotch",
  164. text: "Hoppscotch • Open source API development ecosystem - Helps you create requests faster, saving precious time on development.",
  165. url: "https://hoppscotch.io",
  166. })
  167. .then(() => {})
  168. .catch(console.error)
  169. } else {
  170. // fallback
  171. }
  172. },
  173. chatWithUs() {
  174. showChat()
  175. },
  176. },
  177. })
  178. </script>