From 3625d17bfc5bc6c5517d22bbd94dcf50c44d351b Mon Sep 17 00:00:00 2001 From: Wassim SAMAD Date: Tue, 14 Jul 2026 08:48:25 -0400 Subject: [PATCH] fix(editor): default sidebar to build tab, drop to select on panel close (#495) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The AI/chat tab was the default panel when opening a project; build is the expected starting point. Also, collapsing the sidebar (rail click or drag-collapse on desktop, sheet close on mobile) left the last build tool armed — it now resets to select mode. Co-authored-by: Claude Fable 5 --- .../src/components/editor/editor-layout-mobile.tsx | 5 +++++ .../editor/src/components/editor/editor-layout-v2.tsx | 9 +++++++++ packages/editor/src/store/use-editor.tsx | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/components/editor/editor-layout-mobile.tsx b/packages/editor/src/components/editor/editor-layout-mobile.tsx index 3c4bdd83..31d9a6b4 100644 --- a/packages/editor/src/components/editor/editor-layout-mobile.tsx +++ b/packages/editor/src/components/editor/editor-layout-mobile.tsx @@ -159,6 +159,11 @@ export function EditorLayoutMobile({ const expandedThreshold = Math.max(SHEET_HANDLE_PX, defaultPx * 0.5) if (current > expandedThreshold) { sheetRef.current?.snapTo(SHEET_HANDLE_PX) + // Closing the sheet disarms any build tool back to select + const { mode, setMode } = useEditor.getState() + if (mode === 'build') { + setMode('select') + } } else { sheetRef.current?.snapTo(defaultPx) } diff --git a/packages/editor/src/components/editor/editor-layout-v2.tsx b/packages/editor/src/components/editor/editor-layout-v2.tsx index f9099c60..a30602a2 100644 --- a/packages/editor/src/components/editor/editor-layout-v2.tsx +++ b/packages/editor/src/components/editor/editor-layout-v2.tsx @@ -52,6 +52,15 @@ function LeftColumn({ } }, [activePanel]) + // Closing (collapsing) the sidebar disarms any build tool back to select + useEffect(() => { + if (!isCollapsed) return + const { mode, setMode } = useEditor.getState() + if (mode === 'build') { + setMode('select') + } + }, [isCollapsed]) + const handleResizerDown = useCallback( (e: React.PointerEvent) => { e.preventDefault() diff --git a/packages/editor/src/store/use-editor.tsx b/packages/editor/src/store/use-editor.tsx index f2521a2b..b7b4656b 100644 --- a/packages/editor/src/store/use-editor.tsx +++ b/packages/editor/src/store/use-editor.tsx @@ -66,7 +66,7 @@ import { } from '../lib/snapping-mode' import useInteractionScope from './use-interaction-scope' -const DEFAULT_ACTIVE_SIDEBAR_PANEL = 'ai' +const DEFAULT_ACTIVE_SIDEBAR_PANEL = 'build' const DEFAULT_FLOORPLAN_PANE_RATIO = 0.5 const MIN_FLOORPLAN_PANE_RATIO = 0.15 const MAX_FLOORPLAN_PANE_RATIO = 0.85