LayoutBottomNavigation.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import CommonUserAvatar from '#shared/components/CommonUserAvatar/CommonUserAvatar.vue'
  4. import { useSessionStore } from '#shared/stores/session.ts'
  5. import { storeToRefs } from 'pinia'
  6. import { computed } from 'vue'
  7. import { useOnlineNotificationCount } from '#shared/entities/online-notification/composables/useOnlineNotificationCount.ts'
  8. import { useCustomLayout } from './useCustomLayout.ts'
  9. const { user } = storeToRefs(useSessionStore())
  10. const { isCustomLayout } = useCustomLayout()
  11. const { unseenCount } = useOnlineNotificationCount()
  12. const notificationCount = computed(() => {
  13. if (!unseenCount.value) return ''
  14. if (unseenCount.value > 99) return '99+'
  15. return unseenCount.value.toString()
  16. })
  17. </script>
  18. <template>
  19. <footer
  20. class="bottom-navigation fixed bottom-0 z-10 w-full bg-gray-light backdrop-blur-lg"
  21. :class="{ 'px-4': isCustomLayout }"
  22. data-bottom-navigation
  23. >
  24. <div
  25. v-if="!isCustomLayout"
  26. class="flex h-14 w-full items-center text-center"
  27. >
  28. <CommonLink
  29. link="/"
  30. class="flex flex-1 justify-center"
  31. exact-active-class="text-blue"
  32. >
  33. <CommonIcon name="home" />
  34. </CommonLink>
  35. <CommonLink
  36. link="/notifications"
  37. exact-active-class="text-blue"
  38. class="relative flex flex-1 justify-center"
  39. >
  40. <div
  41. v-if="notificationCount"
  42. role="status"
  43. :aria-label="$t('Unread notifications')"
  44. class="absolute h-4 min-w-[1rem] rounded-full bg-blue px-1 text-center text-xs text-black ltr:ml-4 rtl:mr-4"
  45. >
  46. {{ notificationCount }}
  47. </div>
  48. <CommonIcon name="notification-subscribed" decorative />
  49. </CommonLink>
  50. <CommonLink
  51. link="/account"
  52. class="flex-1 group"
  53. exact-active-class="user-active"
  54. >
  55. <CommonUserAvatar
  56. v-if="user"
  57. :entity="user"
  58. class="group-[.user-active]:ring-2 group-[.user-active]:ring-blue"
  59. size="small"
  60. personal
  61. />
  62. </CommonLink>
  63. </div>
  64. </footer>
  65. </template>
  66. <style scoped>
  67. .bottom-navigation {
  68. padding-bottom: env(safe-area-inset-bottom);
  69. }
  70. </style>