sidebar: + menu always reachable on empty panes, unified default width (content-area half), expand/collapse animation
- An empty pane (fresh split, or last tab dragged out) now keeps the tab strip with its + menu mounted, so a new tab can always be created or dragged in; the placeholder body still explains the state. - Default width unified: new sessions open at half the CONTENT area (viewport minus the left sidebar), so the panel never swallows half the whole window and old/new sessions no longer disagree (previously old persisted widths ~1/4 vs fresh sessions 1/2). Fullscreen restore targets the same content-half width. - Expand/collapse now animates: the panel stays mounted and slides off-screen (translateX + visibility after the slide); fullscreen width changes animate too, and drag-resizing disables the transition.
This commit is contained in:
1 parent
c7a7c7e5af
commit
56a27990d7
4 files changed
+70
-32
No files matched your search
+9
-3
@@ -54,6 +54,8 @@ export interface SidebarState {
|
||||
export const PANEL_MIN = 280
|
||||
export const PANEL_MAX = 640
|
||||
export const PANEL_DEFAULT = 400
|
||||
/** Approximate default width of the host's left sidebar (columns.ts SIDEBAR_DEFAULT). */
|
||||
export const LEFT_SIDEBAR_DEFAULT = 320
|
||||
export const TAB_MAX_WIDTH = 160
|
||||
export const TERMINAL_LIMIT = 3
|
||||
|
||||
@@ -372,9 +374,13 @@ function loadState(sessionId: string): SidebarState {
|
||||
} catch {
|
||||
// Corrupt or unavailable storage: fall through to the default.
|
||||
}
|
||||
// New sessions open at half the viewport (VSCode-like default split).
|
||||
const half = typeof window !== 'undefined' ? Math.max(PANEL_MIN, Math.round(window.innerWidth / 2)) : PANEL_DEFAULT
|
||||
return makeDefaultState(half)
|
||||
// New sessions open at half the CONTENT area (the viewport minus the
|
||||
// left sidebar's default width), so the panel never swallows half the
|
||||
// whole window; the same default applies to every session.
|
||||
const contentHalf = typeof window !== 'undefined'
|
||||
? Math.max(PANEL_MIN, Math.round((window.innerWidth - LEFT_SIDEBAR_DEFAULT) / 2))
|
||||
: PANEL_DEFAULT
|
||||
return makeDefaultState(contentHalf)
|
||||
}
|
||||
|
||||
/** The session-scoped store: one state per conversation, localStorage-backed. */
|
||||
|
||||
Reference in new issue
Block a user