fix(editor): default sidebar to build tab, drop to select on panel close (#495)
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
47313263fb
commit
3625d17bfc
@@ -159,6 +159,11 @@ export function EditorLayoutMobile({
|
|||||||
const expandedThreshold = Math.max(SHEET_HANDLE_PX, defaultPx * 0.5)
|
const expandedThreshold = Math.max(SHEET_HANDLE_PX, defaultPx * 0.5)
|
||||||
if (current > expandedThreshold) {
|
if (current > expandedThreshold) {
|
||||||
sheetRef.current?.snapTo(SHEET_HANDLE_PX)
|
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 {
|
} else {
|
||||||
sheetRef.current?.snapTo(defaultPx)
|
sheetRef.current?.snapTo(defaultPx)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,15 @@ function LeftColumn({
|
|||||||
}
|
}
|
||||||
}, [activePanel])
|
}, [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(
|
const handleResizerDown = useCallback(
|
||||||
(e: React.PointerEvent) => {
|
(e: React.PointerEvent) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ import {
|
|||||||
} from '../lib/snapping-mode'
|
} from '../lib/snapping-mode'
|
||||||
import useInteractionScope from './use-interaction-scope'
|
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 DEFAULT_FLOORPLAN_PANE_RATIO = 0.5
|
||||||
const MIN_FLOORPLAN_PANE_RATIO = 0.15
|
const MIN_FLOORPLAN_PANE_RATIO = 0.15
|
||||||
const MAX_FLOORPLAN_PANE_RATIO = 0.85
|
const MAX_FLOORPLAN_PANE_RATIO = 0.85
|
||||||
|
|||||||
Reference in New Issue
Block a user