diff --git a/src/components/Board/BoardView.tsx b/src/components/Board/BoardView.tsx
index 512025767..ea0596fc2 100644
--- a/src/components/Board/BoardView.tsx
+++ b/src/components/Board/BoardView.tsx
@@ -16,7 +16,6 @@ import { DashboardSidebar } from './Sections/Sidebar/SidebarSection';
import { useGridstackStore } from './gridstack/store';
export const BoardView = () => {
- const board = useRequiredBoard();
const boardName = useRequiredBoard().name;
const stackedSections = useStackedSections();
const sidebarsVisible = useSidebarVisibility();
@@ -96,14 +95,14 @@ const usePrepareGridstack = () => {
};
const useSidebarVisibility = () => {
- const board = useRequiredBoard();
+ const layout = useRequiredBoard().layout;
const screenLargerThanMd = useScreenLargerThan('md'); // For smaller screens mobile ribbons are displayed with drawers
const isScreenSizeUnknown = typeof screenLargerThanMd === 'undefined';
return {
- right: board.showRightSidebar && screenLargerThanMd,
- left: board.showLeftSidebar && screenLargerThanMd,
+ right: layout.showRightSidebar && screenLargerThanMd,
+ left: layout.showLeftSidebar && screenLargerThanMd,
isLoading: isScreenSizeUnknown,
};
};
diff --git a/src/components/Board/Sections/Sidebar/MobileRibbon/MobileRibbon.tsx b/src/components/Board/Sections/Sidebar/MobileRibbon/MobileRibbon.tsx
index 082dbedce..757a8d675 100644
--- a/src/components/Board/Sections/Sidebar/MobileRibbon/MobileRibbon.tsx
+++ b/src/components/Board/Sections/Sidebar/MobileRibbon/MobileRibbon.tsx
@@ -26,7 +26,7 @@ export const MobileRibbons = () => {
return (
- {board.showLeftSidebar && leftSection ? (
+ {board.layout.showLeftSidebar && leftSection ? (
<>
{
)}
- {board.showRightSidebar && rightSection ? (
+ {board.layout.showRightSidebar && rightSection ? (
<>
(
(set, get) => ({
mainAreaWidth: null,
@@ -30,23 +32,9 @@ export const useNamedWrapperColumnCount = (): 'small' | 'medium' | 'large' | nul
};
export const useWrapperColumnCount = () => {
- return 10;
- /*const { config } = useConfigContext();
+ const board = useRequiredBoard();
- if (!config) {
- return null;
- }
-
- switch (useNamedWrapperColumnCount()) {
- case 'large':
- return config.settings.customization.gridstack?.columnCountLarge ?? 12;
- case 'medium':
- return config.settings.customization.gridstack?.columnCountMedium ?? 6;
- case 'small':
- return config.settings.customization.gridstack?.columnCountSmall ?? 3;
- default:
- return null;
- }*/
+ return board.layout.columnCount;
};
function getCurrentShapeSize(size: number) {
diff --git a/src/components/layout/Templates/BoardLayout.tsx b/src/components/layout/Templates/BoardLayout.tsx
index d2bb0fad2..3f1359acd 100644
--- a/src/components/layout/Templates/BoardLayout.tsx
+++ b/src/components/layout/Templates/BoardLayout.tsx
@@ -165,7 +165,11 @@ const ToggleEditModeButton = () => {
const save = async () => {
toggleEditMode();
if (!board || !name) return;
- await saveBoardAsync({ boardId: board.id, sections: board.sections, layoutId: board.layoutId });
+ await saveBoardAsync({
+ boardId: board.id,
+ sections: board.sections,
+ layoutId: board.layout.id,
+ });
utils.boards.byName.invalidate();
Consola.log('Saved config to server', name);
hideNotification(editModeNotificationId);
diff --git a/src/server/api/routers/board.ts b/src/server/api/routers/board.ts
index bfd5241f0..150af05cf 100644
--- a/src/server/api/routers/board.ts
+++ b/src/server/api/routers/board.ts
@@ -208,10 +208,13 @@ export const boardRouter = createTRPCRouter({
const { layouts: _, mediaIntegrations, ...withoutLayouts } = board;
return {
...withoutLayouts,
- layoutName: layout.name,
- layoutId: layout.id,
- showRightSidebar: layout.showRightSidebar,
- showLeftSidebar: layout.showLeftSidebar,
+ layout: {
+ id: layout.id,
+ name: layout.name,
+ showLeftSidebar: layout.showLeftSidebar,
+ showRightSidebar: layout.showRightSidebar,
+ columnCount: layout.columnCount,
+ },
sections: preparedSections,
mediaIntegrations: mediaIntegrations
.map((x) => x.integration)
diff --git a/src/server/api/routers/board/db/board.ts b/src/server/api/routers/board/db/board.ts
index 5d4de6ac6..55a31cb15 100644
--- a/src/server/api/routers/board/db/board.ts
+++ b/src/server/api/routers/board/db/board.ts
@@ -37,6 +37,7 @@ export const getFullBoardWithLayoutSectionsAsync = async (
name: true,
showLeftSidebar: true,
showRightSidebar: true,
+ columnCount: true,
},
with: {
sections: {