LayoutPage.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. data-theme="dark"
  35. :style="{ colorScheme: 'dark' }"
  36. :current-width="currentSidebarWidth"
  37. :max-width="maxSidebarWidth"
  38. :min-width="minSidebarWidth"
  39. collapsible
  40. resizable
  41. no-scroll
  42. @collapse="collapseSidebar"
  43. @expand="expandSidebar"
  44. @resize-horizontal="resizeSidebar"
  45. @resize-horizontal-start="noTransition = true"
  46. @resize-horizontal-end="noTransition = false"
  47. @reset-width="resetSidebarWidth"
  48. >
  49. <template #default="{ isCollapsed }">
  50. <PageNavigation :collapsed="isCollapsed" />
  51. <UserTaskbarTabs :collapsed="isCollapsed" />
  52. <LeftSidebarFooterMenu :collapsed="isCollapsed" class="mt-auto" />
  53. </template>
  54. </LayoutSidebar>
  55. <div class="relative">
  56. <slot><RouterView /></slot>
  57. </div>
  58. </div>
  59. </template>