Browse Source

fix(nc-gui): toggle left sidebar state on mount

pull/3801/head
braks 2 years ago
parent
commit
360290a526
  1. 1
      packages/nc-gui/components/tabs/Auth.vue
  2. 2
      packages/nc-gui/layouts/base.vue
  3. 10
      packages/nc-gui/pages/[projectType]/[projectId]/index.vue
  4. 4
      packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue

1
packages/nc-gui/components/tabs/Auth.vue

@ -26,6 +26,7 @@ const tabsInfo: Tab[] = [
]
const selectedTabKey = $ref(0)
const selectedTab = $computed(() => tabsInfo[selectedTabKey])
</script>

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

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { computed, navigateTo, ref, useGlobal, useNuxtApp, useRoute, useSidebar } from '#imports'
import { computed, navigateTo, ref, useGlobal, useNuxtApp, useRoute, useSidebar, useUIPermission } from '#imports'
const { signOut, signedIn, isLoading, user, currentVersion } = useGlobal()

10
packages/nc-gui/pages/[projectType]/[projectId]/index.vue

@ -8,6 +8,7 @@ import {
onBeforeMount,
onBeforeUnmount,
onKeyStroke,
onMounted,
openLink,
projectThemeColors,
provide,
@ -49,7 +50,7 @@ const isLocked = ref(false)
provide('TreeViewIsLockedInj', isLocked)
// create a new sidebar state
const { isOpen, toggle } = useSidebar('nc-left-sidebar', { hasSidebar: true, isOpen: true })
const { isOpen, toggle, toggleHasSidebar } = useSidebar('nc-left-sidebar', { hasSidebar: false, isOpen: false })
const dialogOpen = ref(false)
@ -162,6 +163,11 @@ onBeforeMount(async () => {
}
})
onMounted(() => {
toggle(true)
toggleHasSidebar(true)
})
onBeforeUnmount(reset)
</script>
@ -481,7 +487,7 @@ onBeforeUnmount(reset)
</div>
</div>
<LazyDashboardTreeView v-show="isOpen" />
<LazyDashboardTreeView />
</a-layout-sider>
</template>

4
packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue

@ -1,9 +1,7 @@
<script setup lang="ts">
import type { TabItem } from '~/lib'
import { TabType } from '~/lib'
import { TabMetaInj, iconMap, provide, useGlobal, useProject, useSidebar, useTabs } from '#imports'
const { isLoading: isLoadingProject } = useProject()
import { TabMetaInj, iconMap, provide, useGlobal, useSidebar, useTabs } from '#imports'
const { tabs, activeTabIndex, activeTab, closeTab } = useTabs()

Loading…
Cancel
Save