From 7468ce06be7d427c293e18131f109ab125b58e8a Mon Sep 17 00:00:00 2001 From: Jiayuan Zhang Date: Wed, 15 Jul 2026 11:51:41 +0800 Subject: [PATCH] fix(desktop): match canvas left margin to right when sidebar is collapsed (#5430) The shell canvas kept its static 2px left margin after the left sidebar collapsed offcanvas, while the right edge uses an 8px margin. Animate the left margin to 8px (same spring as the rest of the shell) whenever the sidebar leaves the main flow, so the floating canvas sits symmetrically. Fixes MUL-4780 Co-authored-by: Lambda Co-authored-by: multica-agent --- .../src/components/desktop-layout.tsx | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/renderer/src/components/desktop-layout.tsx b/apps/desktop/src/renderer/src/components/desktop-layout.tsx index b4b716c11..8d39f99f2 100644 --- a/apps/desktop/src/renderer/src/components/desktop-layout.tsx +++ b/apps/desktop/src/renderer/src/components/desktop-layout.tsx @@ -129,6 +129,25 @@ function MainTopBar() { ); } +// The canvas hugs the expanded sidebar with a hairline gap. When the sidebar +// leaves the main flow, the left margin must grow to mirror the fixed mr-2 so +// the floating canvas sits symmetrically inside the window frame. +function MainCanvas({ children }: { children: React.ReactNode }) { + const { state, isMobile } = useSidebar(); + const sidebarHidden = state === "collapsed" || isMobile; + + return ( + + {children} + + ); +} + function useInternalLinkHandler() { useEffect(() => { const handler = (e: Event) => { @@ -219,10 +238,10 @@ export function DesktopShell() { {/* Right side: header + content container */} -
+ {slug && } -
+