mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-06 07:29:42 +02:00
feat(web): optional collapsible left session sidebar
The header tab strip stops working past roughly a dozen sessions: it wraps into two or three rows, eats vertical space and still cannot be scanned. This adds a vertical session list in a left <aside> as an ALTERNATIVE layout — a filter box, a live count, and a 44px collapsed rail that keeps the ambient signal (status dot, task badge) visible. The strip is not removed. Settings -> Display -> Tab Bar -> Session List Layout switches between them and the default stays 'header', so existing users see no change until they opt in. Structure: one #sessionTabs element, two mount points. applySessionListLayout() re-parents the SAME node between #sessionTabsHost and #sessionSidebarList, which is why there is no second renderer and no duplicated wiring — app.$() caches getElementById results and never invalidates them, so a moved node keeps every existing consumer (settings-ui, webview-tabs, the generated gesture bundle, the mobile tests) working untouched. Notable integration points: - Below 1024px the sidebar is an off-canvas drawer overlaying the terminal; closed it gets inert + aria-hidden so it cannot be tabbed into, and touch swipes over it no longer switch sessions. - Subagent and ultracode windows anchor to the right edge of a sidebar row instead of its bottom, connector curves follow. - Alt+B toggles; the chord is gated out of the PTY so xterm cannot also write ESC b into a live session. - Collapse state lives in its own localStorage key (the settings blob is rebuilt from DOM controls on every save) and falls back to in-memory intent where storage throws. Verified: frontend syntax + public asset checks, tsc, eslint, 26 new jsdom tests, and a headless-Chromium harness (scripts/verify-session-sidebar.mts) that renders a synthetic 25-session fleet in both layouts at 1600/1000/393px and asserts mount point, widths, inert/aria state and row count. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -468,6 +468,20 @@ html.mobile-init .file-browser-panel {
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
/* Exception to the 26px shrink above: in sidebar layout this button is the
|
||||
ONLY way to open the session list — the strip it replaced is gone. A 26px
|
||||
target is below --touch-target-min (44px), which the 430-768px block
|
||||
already enforces for every other header button. */
|
||||
html[data-session-list='sidebar'] #sidebarToggleBtn {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
|
||||
html[data-session-list='sidebar'] #sidebarToggleBtn svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
/* Hide header settings gear, lifecycle log, away digest, session manager, and
|
||||
file viewer on mobile - settings moved to toolbar; the others are secondary /
|
||||
desktop-oriented controls that don't belong on the cramped phone header (the
|
||||
@@ -2872,3 +2886,117 @@ html:is([data-skin="paper-gray"], [data-skin="solarized-light"], [data-skin="cat
|
||||
padding: 4px 7px;
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
SESSION SIDEBAR — off-canvas drawer (tablet + phone)
|
||||
============================================================================
|
||||
This whole file is served with media="(max-width: 1023px)", so these
|
||||
top-level rules cover the entire handheld range — deliberately NOT wrapped in
|
||||
a nested @media, because the two compact `.session-tabs` blocks above live in
|
||||
`max-width: 768px` and `max-width: 430px` and would leave 769-1023px
|
||||
unhandled.
|
||||
|
||||
Placement at the END of the file is load-bearing: the compact strip blocks at
|
||||
lines ~117 and ~584 use the deliberate `.session-tabs, .session-tabs.tabs-two-rows`
|
||||
(0,2,0) doubling documented there. The sidebar selectors below are (0,2,1)
|
||||
and up AND come later, so they win on both counts. Move this block and the
|
||||
list collapses to a 36px sliver that looks like an empty list.
|
||||
|
||||
Why an overlay instead of the desktop rail: 44px is 11% of a 393px viewport.
|
||||
Below 1024px the sidebar never occupies layout width — it slides over the
|
||||
terminal, following the .attachment-history-drawer recipe in styles.css.
|
||||
`collapsed` therefore means "drawer closed", and applySessionListLayout()
|
||||
mirrors that into the `.open` class. */
|
||||
|
||||
html[data-session-list="sidebar"] .session-sidebar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: min(280px, 80vw);
|
||||
flex: 0 0 auto;
|
||||
transform: translateX(-100%);
|
||||
/* visibility, not just transform: an off-screen drawer keeps display:flex, so
|
||||
without this its filter box and ~4 tab stops per session stay in the Tab
|
||||
order and in the a11y tree. applySessionListLayout() also sets `inert`; this
|
||||
is the CSS half, and the transition keeps it visible for the slide-out. */
|
||||
visibility: hidden;
|
||||
transition: transform var(--sidebar-transition), visibility var(--sidebar-transition);
|
||||
box-shadow: 10px 0 28px rgba(0, 0, 0, 0.36);
|
||||
z-index: 12;
|
||||
padding-left: var(--safe-area-left);
|
||||
}
|
||||
|
||||
html[data-session-list="sidebar"] .session-sidebar.open {
|
||||
transform: translateX(0);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* Collapsed == closed here, so the desktop icon-rail styling must not apply:
|
||||
the drawer keeps its full width and its head/filter/labels while it is off
|
||||
screen, otherwise opening it would animate in a 44px stub. */
|
||||
html[data-session-list="sidebar"][data-sidebar="collapsed"] .session-sidebar {
|
||||
flex-basis: auto;
|
||||
width: min(280px, 80vw);
|
||||
}
|
||||
|
||||
html[data-session-list="sidebar"][data-sidebar="collapsed"] .session-sidebar-head,
|
||||
html[data-session-list="sidebar"][data-sidebar="collapsed"] .session-sidebar-filter {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
html[data-session-list="sidebar"][data-sidebar="collapsed"] .session-sidebar .session-tab {
|
||||
justify-content: flex-start;
|
||||
flex-wrap: nowrap;
|
||||
padding: 0.4rem 0.5rem;
|
||||
}
|
||||
|
||||
/* Undo the rail's content trimming: these rows are full-width drawer rows, just
|
||||
currently off screen. Same specificity as the styles.css rail rules and later
|
||||
in the cascade, which is why this file must stay loaded after styles.css. */
|
||||
html[data-session-list="sidebar"][data-sidebar="collapsed"] .session-sidebar .tab-info {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
html[data-session-list="sidebar"][data-sidebar="collapsed"] .session-sidebar .tab-number {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
html[data-session-list="sidebar"][data-sidebar="collapsed"] .session-sidebar .tab-subagent-badge {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
/* mobile.css:~604 pins .session-tab to max-height:32px for the horizontal strip,
|
||||
which clips the folder row the sidebar always renders. Rows also need the
|
||||
44px touch target the strip cannot afford. */
|
||||
html[data-session-list="sidebar"] .session-sidebar .session-tab {
|
||||
min-height: 44px;
|
||||
max-height: none;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Touch has no hover: reveal-on-hover row actions would be unreachable.
|
||||
Matches the (hover: none) block above, but has to be repeated here because
|
||||
the phone block hides them on non-active tabs with (0,2,0). */
|
||||
html[data-session-list="sidebar"] .session-sidebar .session-tab .tab-gear,
|
||||
html[data-session-list="sidebar"] .session-sidebar .session-tab .tab-close {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 1;
|
||||
width: auto;
|
||||
min-width: 28px;
|
||||
height: auto;
|
||||
margin-left: 0;
|
||||
padding: 0.15rem 0.25rem;
|
||||
}
|
||||
|
||||
/* (.tab-filtered-out is handled in styles.css — its rule is already scoped to
|
||||
html[data-session-list="sidebar"] and carries !important, so it wins here too;
|
||||
no handheld variant needed.) */
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html[data-session-list="sidebar"] .session-sidebar {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user