From e8554890e0fdc690bba1b91b3d9e235b655c4262 Mon Sep 17 00:00:00 2001 From: ajnart Date: Fri, 13 Jan 2023 10:57:57 +0900 Subject: [PATCH] Make column size dependant on number of sidebars --- src/components/Dashboard/Wrappers/gridstack/store.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/Dashboard/Wrappers/gridstack/store.tsx b/src/components/Dashboard/Wrappers/gridstack/store.tsx index 6df8c2f75..81c32514f 100644 --- a/src/components/Dashboard/Wrappers/gridstack/store.tsx +++ b/src/components/Dashboard/Wrappers/gridstack/store.tsx @@ -1,5 +1,6 @@ import { useMantineTheme } from '@mantine/core'; import create from 'zustand'; +import { useConfigContext } from '../../../../config/provider'; export const useGridstackStore = create((set, get) => ({ mainAreaWidth: null, @@ -27,11 +28,16 @@ export const useNamedWrapperColumnCount = (): 'small' | 'medium' | 'large' | nul }; export const useWrapperColumnCount = () => { + const { config } = useConfigContext(); + const numberOfSidebars = + (config?.settings.customization.layout.enabledLeftSidebar ? 1 : 0) + + (config?.settings.customization.layout.enabledRightSidebar ? 1 : 0); + switch (useNamedWrapperColumnCount()) { case 'large': - return 12; + return 15 - numberOfSidebars * 2; case 'medium': - return 6; + return 9 - numberOfSidebars * 2; case 'small': return 3; default: