LayoutPage.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 LeftSidebarFooterMenu from '#desktop/components/layout/LayoutSidebar/LeftSidebar/LeftSidebarFooterMenu.vue'
  6. import LayoutSidebar from '#desktop/components/layout/LayoutSidebar.vue'
  7. import PageNavigation from '#desktop/components/PageNavigation/PageNavigation.vue'
  8. import UserTaskbarTabs from '#desktop/components/UserTaskbarTabs/UserTaskbarTabs.vue'
  9. import { useResizeGridColumns } from '#desktop/composables/useResizeGridColumns.ts'
  10. const noTransition = ref(false)
  11. const { userId } = useSessionStore()
  12. const storageKeyId = `${userId}-left`
  13. const {
  14. currentSidebarWidth,
  15. maxSidebarWidth,
  16. minSidebarWidth,
  17. gridColumns,
  18. collapseSidebar,
  19. resizeSidebar,
  20. expandSidebar,
  21. resetSidebarWidth,
  22. } = useResizeGridColumns(storageKeyId)
  23. </script>
  24. <template>
  25. <div
  26. class="grid h-full max-h-full overflow-y-clip duration-100"
  27. :class="{ 'transition-none': noTransition }"
  28. :style="gridColumns"
  29. >
  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. no-scroll
  40. @collapse="collapseSidebar"
  41. @expand="expandSidebar"
  42. @resize-horizontal="resizeSidebar"
  43. @resize-horizontal-start="noTransition = true"
  44. @resize-horizontal-end="noTransition = false"
  45. @reset-width="resetSidebarWidth"
  46. >
  47. <template #default="{ isCollapsed }">
  48. <PageNavigation :collapsed="isCollapsed" />
  49. <UserTaskbarTabs :collapsed="isCollapsed" />
  50. <LeftSidebarFooterMenu :collapsed="isCollapsed" class="mt-auto" />
  51. </template>
  52. </LayoutSidebar>
  53. <div class="relative">
  54. <slot><RouterView /></slot>
  55. </div>
  56. </div>
  57. </template>