From 292c7f249ade18830b43a63f618b7ea54029b062 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Wed, 11 Oct 2023 09:32:25 +0000 Subject: [PATCH] fix: Fixed mobile view bug --- packages/nc-gui/store/sidebar.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/store/sidebar.ts b/packages/nc-gui/store/sidebar.ts index 0a40451f6a..0603ceb76e 100644 --- a/packages/nc-gui/store/sidebar.ts +++ b/packages/nc-gui/store/sidebar.ts @@ -3,10 +3,22 @@ import { MAX_WIDTH_FOR_MOBILE_MODE } from '~/lib' export const useSidebarStore = defineStore('sidebarStore', () => { const { width } = useWindowSize() - const isViewPortMobile = () => width.value < MAX_WIDTH_FOR_MOBILE_MODE + const isViewPortMobile = () => { + return width.value < MAX_WIDTH_FOR_MOBILE_MODE + } const { isMobileMode } = useGlobal() - const isLeftSidebarOpen = ref(!isViewPortMobile()) + const tablesStore = useTablesStore() + const _isLeftSidebarOpen = ref(!isViewPortMobile()) + const isLeftSidebarOpen = computed({ + get() { + return (isMobileMode && !tablesStore.activeTableId) || _isLeftSidebarOpen.value + }, + set(value) { + _isLeftSidebarOpen.value = value + }, + }) + const isRightSidebarOpen = ref(true) const leftSidebarWidthPercent = ref(isViewPortMobile() ? 0 : 20)