Footer.vue 6.3 KB

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