LayoutPage.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { ref } from 'vue'
  4. import { useSessionStore } from '#shared/stores/session.ts'
  5. import LayoutSidebarFooterMenu from '#desktop/components/layout/LayoutSidebar/LayoutSidebarFooterMenu.vue'
  6. import LayoutSidebar from '#desktop/components/layout/LayoutSidebar.vue'
  7. import PageNavigation from '#desktop/components/PageNavigation/PageNavigation.vue'
  8. import { useResizeGridColumns } from '#desktop/composables/useResizeGridColumns.ts'
  9. const noTransition = ref(false)
  10. const { userId } = useSessionStore()
  11. const storageKeyId = `${userId}-left`
  12. const {
  13. currentSidebarWidth,
  14. maxSidebarWidth,
  15. minSidebarWidth,
  16. gridColumns,
  17. collapseSidebar,
  18. resizeSidebar,
  19. expandSidebar,
  20. resetSidebarWidth,
  21. } = useResizeGridColumns(storageKeyId)
  22. </script>
  23. <template>
  24. <div
  25. class="grid h-full duration-100"
  26. :class="{ 'transition-none': noTransition }"
  27. :style="gridColumns"
  28. >
  29. <!-- :TODO fix est-lint ltr/rtl right rule to avoid complaining about left id -->
  30. <LayoutSidebar
  31. id="main-sidebar"
  32. :name="storageKeyId"
  33. :aria-label="$t('Main sidebar')"
  34. :current-width="currentSidebarWidth"
  35. :max-width="maxSidebarWidth"
  36. :min-width="minSidebarWidth"
  37. collapsible
  38. resizable
  39. @collapse="collapseSidebar"
  40. @expand="expandSidebar"
  41. @resize-horizontal="resizeSidebar"
  42. @resize-horizontal-start="noTransition = true"
  43. @resize-horizontal-end="noTransition = false"
  44. @reset-width="resetSidebarWidth"
  45. >
  46. <template #default="{ isCollapsed }">
  47. <PageNavigation :icon-only="isCollapsed" />
  48. <LayoutSidebarFooterMenu :collapsed="isCollapsed" class="mt-auto" />
  49. </template>
  50. </LayoutSidebar>
  51. <div id="page-main-content" class="relative">
  52. <RouterView />
  53. </div>
  54. </div>
  55. </template>