From 076fe1d922df2cd51a5d83df359c681623535c49 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 18 Jul 2025 16:48:45 +0100 Subject: [PATCH] fix: use getLayout to persist layout state across pages --- apps/web/src/components/Dashboard.tsx | 16 ++++++++++++++ apps/web/src/components/SideNavigation.tsx | 4 ++-- apps/web/src/pages/_app.tsx | 21 +++++++++++++----- .../src/pages/boards/[...boardId]/index.tsx | 20 +++++++++-------- apps/web/src/pages/boards/index.tsx | 20 +++++++++-------- apps/web/src/pages/cards/[cardId]/index.tsx | 21 ++++++++++-------- apps/web/src/pages/members/index.tsx | 20 +++++++++-------- apps/web/src/pages/settings/index.tsx | 22 ++++++++++--------- .../views/boards/components/BoardsList.tsx | 2 +- apps/web/src/views/boards/index.tsx | 4 ++-- 10 files changed, 94 insertions(+), 56 deletions(-) diff --git a/apps/web/src/components/Dashboard.tsx b/apps/web/src/components/Dashboard.tsx index 185f86dd..4c47b83c 100644 --- a/apps/web/src/components/Dashboard.tsx +++ b/apps/web/src/components/Dashboard.tsx @@ -10,6 +10,7 @@ import { authClient } from "@kan/auth/client"; import { useClickOutside } from "~/hooks/useClickOutside"; import { useTheme } from "~/providers/theme"; +import { WorkspaceProvider } from "~/providers/workspace"; import SideNavigation from "./SideNavigation"; interface DashboardProps { @@ -18,6 +19,20 @@ interface DashboardProps { hasRightPanel?: boolean; } +export function getDashboardLayout( + page: React.ReactElement, + rightPanel?: React.ReactNode, + hasRightPanel = false, +) { + return ( + + + {page} + + + ); +} + export default function Dashboard({ children, rightPanel, @@ -26,6 +41,7 @@ export default function Dashboard({ const theme = useTheme(); const { data: session, isPending: sessionLoading } = authClient.useSession(); + const [isSideNavOpen, setIsSideNavOpen] = useState(false); const [isRightPanelOpen, setIsRightPanelOpen] = useState(false); diff --git a/apps/web/src/components/SideNavigation.tsx b/apps/web/src/components/SideNavigation.tsx index ba184221..eb7ad628 100644 --- a/apps/web/src/components/SideNavigation.tsx +++ b/apps/web/src/components/SideNavigation.tsx @@ -88,7 +88,7 @@ export default function SideNavigation({ <>