Browse Source

fix(gui-v2): hide sidebar when not signed in

pull/2744/head
braks 2 years ago
parent
commit
9f34821268
  1. 2
      packages/nc-gui-v2/app.vue
  2. 6
      packages/nc-gui-v2/composables/useGlobalState.ts

2
packages/nc-gui-v2/app.vue

@ -87,7 +87,7 @@ const sidebarOpen = computed({
<a-layout>
<a-layout-sider
v-model:collapsed="sidebarOpen"
:width="sidebarOpen ? 300 : 0"
width="300"
collapsed-width="0"
class="bg-white dark:!bg-gray-800 border-r-1 border-gray-200 dark:!border-gray-600 h-full"
:trigger="null"

6
packages/nc-gui-v2/composables/useGlobalState.ts

@ -67,9 +67,6 @@ export const useGlobalState = (): GlobalState => {
/** State */
const initialState: StoredState = { token: null, user: null, lang: preferredLanguage, darkMode: prefersDarkMode }
/** is sidebar open */
const sidebarOpen = ref(breakpoints.greater('md').value)
/** saves a reactive state, any change to these values will write/delete to localStorage */
const storage = $(useStorage<StoredState>(storageKey, initialState))
@ -88,6 +85,9 @@ export const useGlobalState = (): GlobalState => {
() => !!(!!token && token !== '' && payload && payload.exp && payload.exp > timestamp / 1000),
)
/** is sidebar open */
const sidebarOpen = ref(signedIn.value && breakpoints.greater('md').value)
/** Actions */
/** Sign out by deleting the token from localStorage */
const signOut: Actions['signOut'] = () => {

Loading…
Cancel
Save