Browse Source

feat: Fixed view sidebar getting bugged on first loading in mobile

pull/6474/head
Muhammed Mustafa 1 year ago
parent
commit
bec270e35d
  1. 2
      packages/nc-gui/layouts/dashboard.vue
  2. 1
      packages/nc-gui/store/config.ts
  3. 9
      packages/nc-gui/store/sidebar.ts

2
packages/nc-gui/layouts/dashboard.vue

@ -10,7 +10,7 @@ export default {
</script> </script>
<template> <template>
<NuxtLayout class="h-screen"> <NuxtLayout>
<slot v-if="!route.meta.hasSidebar" name="content" /> <slot v-if="!route.meta.hasSidebar" name="content" />
<LazyDashboardView v-else> <LazyDashboardView v-else>

1
packages/nc-gui/store/config.ts

@ -25,5 +25,6 @@ export const useConfigStore = defineStore('configStore', () => {
return { return {
isMobileMode, isMobileMode,
isViewPortMobile,
} }
}) })

9
packages/nc-gui/store/sidebar.ts

@ -1,12 +1,15 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
export const useSidebarStore = defineStore('sidebarStore', () => { export const useSidebarStore = defineStore('sidebarStore', () => {
const isLeftSidebarOpen = ref(true) const { isViewPortMobile } = useConfigStore()
const isLeftSidebarOpen = ref(!isViewPortMobile())
const isRightSidebarOpen = ref(true) const isRightSidebarOpen = ref(true)
const leftSidebarWidthPercent = ref(20)
const leftSidebarWidthPercent = ref(isViewPortMobile() ? 0 : 20)
const leftSideBarSize = ref({ const leftSideBarSize = ref({
old: leftSidebarWidthPercent.value, old: 20,
current: leftSidebarWidthPercent.value, current: leftSidebarWidthPercent.value,
}) })

Loading…
Cancel
Save