AppSidebar.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <aside
  3. class="
  4. fixed
  5. flex flex-col
  6. items-center
  7. h-screen
  8. left-0
  9. top-0
  10. w-16
  11. py-6
  12. bg-white
  13. z-50
  14. "
  15. >
  16. <img src="@/assets/svg/logo.svg" class="w-10 mb-4 mx-auto" />
  17. <div
  18. class="space-y-2 w-full relative text-center"
  19. @mouseleave="showHoverIndicator = false"
  20. >
  21. <div
  22. v-show="showHoverIndicator"
  23. ref="hoverIndicator"
  24. class="
  25. rounded-lg
  26. h-10
  27. w-10
  28. absolute
  29. left-1/2
  30. bg-box-transparent
  31. transition-transform
  32. duration-200
  33. "
  34. style="transform: translate(-50%, 0)"
  35. ></div>
  36. <router-link
  37. v-for="tab in tabs"
  38. v-slot="{ href, navigate, isActive }"
  39. :key="tab.id"
  40. :to="tab.path"
  41. custom
  42. >
  43. <a
  44. v-tooltip:right.group="t(`common.${tab.id}`, 2)"
  45. :class="{ 'is-active': isActive }"
  46. :href="href"
  47. class="
  48. z-10
  49. relative
  50. w-full
  51. flex
  52. items-center
  53. justify-center
  54. tab
  55. relative
  56. "
  57. @click="navigate"
  58. @mouseenter="hoverHandler"
  59. >
  60. <div class="p-2 rounded-lg transition-colors inline-block">
  61. <v-remixicon :name="tab.icon" />
  62. </div>
  63. </a>
  64. </router-link>
  65. </div>
  66. <div class="flex-grow"></div>
  67. <ui-popover placement="right" trigger="mouseenter click">
  68. <template #trigger>
  69. <v-remixicon class="cursor-pointer" name="riInformationLine" />
  70. </template>
  71. <ui-list class="space-y-1">
  72. <ui-list-item
  73. v-for="item in links"
  74. :key="item.name"
  75. :href="item.url"
  76. tag="a"
  77. rel="noopener"
  78. target="_blank"
  79. >
  80. <v-remixicon :name="item.icon" class="-ml-1 mr-2" />
  81. <span>{{ item.name }}</span>
  82. </ui-list-item>
  83. </ui-list>
  84. </ui-popover>
  85. </aside>
  86. </template>
  87. <script setup>
  88. import { ref } from 'vue';
  89. import { useI18n } from 'vue-i18n';
  90. import { useGroupTooltip } from '@/composable/groupTooltip';
  91. useGroupTooltip();
  92. const { t } = useI18n();
  93. const links = [
  94. {
  95. name: 'Donate',
  96. icon: 'riHandHeartLine',
  97. url: 'https://paypal.me/akholid060',
  98. },
  99. {
  100. name: t('common.docs', 2),
  101. icon: 'riBookOpenLine',
  102. url: 'https://github.com/kholid060/automa/wiki',
  103. },
  104. {
  105. name: 'GitHub',
  106. icon: 'riGithubFill',
  107. url: 'https://github.com/kholid060/automa',
  108. },
  109. ];
  110. const tabs = [
  111. {
  112. id: 'dashboard',
  113. icon: 'riHome5Line',
  114. path: '/',
  115. },
  116. {
  117. id: 'workflow',
  118. icon: 'riFlowChart',
  119. path: '/workflows',
  120. },
  121. {
  122. id: 'collection',
  123. icon: 'riFolderLine',
  124. path: '/collections',
  125. },
  126. {
  127. id: 'log',
  128. icon: 'riHistoryLine',
  129. path: '/logs',
  130. },
  131. {
  132. id: 'settings',
  133. icon: 'riSettings3Line',
  134. path: '/settings',
  135. },
  136. ];
  137. const hoverIndicator = ref(null);
  138. const showHoverIndicator = ref(false);
  139. function hoverHandler({ target }) {
  140. showHoverIndicator.value = true;
  141. hoverIndicator.value.style.transform = `translate(-50%, ${target.offsetTop}px)`;
  142. }
  143. </script>
  144. <style scoped>
  145. .tab.is-active:after {
  146. content: '';
  147. position: absolute;
  148. right: 0;
  149. top: 0;
  150. height: 100%;
  151. width: 4px;
  152. @apply bg-accent;
  153. }
  154. </style>