Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(shell): float sidebar above full-window content surface

Steven Enamakel68ccd3c30174
diff --git a/app/src/components/layout/shell/AppSidebar.tsx b/app/src/components/layout/shell/AppSidebar.tsx
index 9993a54207..582785e276 100644
--- a/app/src/components/layout/shell/AppSidebar.tsx
+++ b/app/src/components/layout/shell/AppSidebar.tsx
@@ -63,7 +63,8 @@ function hidesSidebarSeparator(pathname: string): boolean {
* └──────────────┘
*
* Pages project content into the slot region with {@link SidebarContent}.
- * Background matches the previous in-page sidebar pane (white / neutral-900).
+ * Its material, border, blur, radius, and shadow are owned by the root
+ * `Sidebar` layer so the same floating treatment also wraps collapsed mode.
*
* **Collapsed**: a draggable strip (clears the macOS traffic lights), a
* reopen trigger, and {@link CollapsedNavRail}'s icon-only nav — formerly a
@@ -137,14 +138,9 @@ export default function AppSidebar() {
}
return (
- // Sits directly on the window chrome with no fill of its own, so the
- // sidebar and the frame around the content card are one continuous surface.
- // The legibility scrim lives on the shell root ({@link RootShellLayout}) and
- // deliberately NOT here — scrimming only this column would tint it
- // differently from the chrome beside the card, which is the seam the
- // two-layer look exists to remove. Regions below are separated by spacing
- // alone; the hairline seams the old opaque panel needed would draw lines
- // across the chrome.
+ // The floating material belongs to the outer Sidebar primitive so it wraps
+ // both expanded and collapsed modes consistently. This component owns only
+ // the sidebar's internal bands and navigation.
<div className="flex h-full min-h-0 flex-col">
<SidebarHeader />
<SidebarNav />
diff --git a/app/src/components/layout/shell/ContentSurface.test.tsx b/app/src/components/layout/shell/ContentSurface.test.tsx
index 19bb98e1aa..38440a04cc 100644
--- a/app/src/components/layout/shell/ContentSurface.test.tsx
+++ b/app/src/components/layout/shell/ContentSurface.test.tsx
@@ -20,11 +20,9 @@ describe('ContentSurface', () => {
const surface = screen.getByTestId('app-content-surface');
expect(surface.className).toContain('rounded-2xl');
expect(surface.className).toContain('shadow-content-edge');
- // Inset on three sides. The left edge is deliberately flush: the card butts
- // against the sidebar column, so the shell's gutter is top/right/bottom.
- expect(surface.className).toContain('my-3');
- expect(surface.className).toContain('mr-3');
- expect(surface.className).not.toContain('ml-3');
+ // The content is now the full-window layer beneath the floating sidebar,
+ // so its card has the same inset on all four edges.
+ expect(surface.className).toContain('m-3');
expect(surface.dataset.unframed).toBeUndefined();
});
diff --git a/app/src/components/layout/shell/ContentSurface.tsx b/app/src/components/layout/shell/ContentSurface.tsx
index 6d8d82cfd6..46f2c0f799 100644
--- a/app/src/components/layout/shell/ContentSurface.tsx
+++ b/app/src/components/layout/shell/ContentSurface.tsx
@@ -33,10 +33,9 @@ interface ContentSurfaceProps {
* theme's hue; this surface stays neutral so page content reads against a
* consistent background across every theme.
*
- * The geometry is the `SidebarInset` primitive: the framed default is the same
- * even 12px inset, 2xl radius and `content-edge` inset-shadow-sm this file used to
- * spell out, and `unframed` maps onto the primitive's own flag. The primitive
- * reads no sidebar context, so this stays renderable outside a
+ * The geometry is the `SidebarInset` primitive: the framed default is an even
+ * 12px inset on every window edge, a 2xl radius, and a `content-edge` hairline.
+ * The primitive reads no sidebar context, so this stays renderable outside a
* `SidebarProvider` — several page-level tests mount it on its own.
*/
export default function ContentSurface({ children, unframed = false }: ContentSurfaceProps) {
diff --git a/app/src/components/layout/shell/RootShellLayout.test.tsx b/app/src/components/layout/shell/RootShellLayout.test.tsx
index 7c9fdcabb6..fe39b4d831 100644
--- a/app/src/components/layout/shell/RootShellLayout.test.tsx
+++ b/app/src/components/layout/shell/RootShellLayout.test.tsx
@@ -50,7 +50,28 @@ describe('RootShellLayout', () => {
it('frames the content surface as a card by default', () => {
renderShell();
- expect(screen.getByTestId('app-content-surface').dataset.unframed).toBeUndefined();
+ const surface = screen.getByTestId('app-content-surface');
+ expect(surface.dataset.unframed).toBeUndefined();
+ expect(surface.className).toContain('m-3');
+ });
+
+ it('floats the sidebar above the full-window content surface', () => {
+ renderShell({}, withLayout(true, 300));
+
+ const sidebar = screen.getByTestId('root-shell-sidebar');
+ expect(sidebar.className).toContain('absolute');
+ expect(sidebar.className).toContain('inset-y-3');
+ expect(sidebar.className).toContain('left-3');
+ expect(sidebar.className).toContain('h-auto');
+ expect(sidebar.className).toContain('rounded-2xl');
+
+ const content = screen.getByTestId('root-shell-content');
+ expect(content.className).toContain('w-full');
+ });
+
+ it('pads routed content past the overlaid sidebar', () => {
+ renderShell({}, withLayout(true, 300));
+ expect(screen.getByTestId('root-shell-routed-content').style.paddingInlineStart).toBe('312px');
});
it('forwards unframed so a live CEF webview gets a square, edge-to-edge pane', () => {
@@ -120,6 +141,7 @@ describe('RootShellLayout — redux-controlled geometry', () => {
// Live geometry is on screen…
expect(screen.getByTestId('root-shell-sidebar').style.width).toBe('340px');
+ expect(screen.getByTestId('root-shell-routed-content').style.paddingInlineStart).toBe('352px');
// …but nothing has been persisted yet: a drag writes one value, not sixty.
expect(panel(store).sidebarWidth).toBe(300);
@@ -150,6 +172,9 @@ describe('RootShellLayout — redux-controlled geometry', () => {
const sidebar = screen.getByTestId('root-shell-sidebar');
expect(sidebar).toHaveAttribute('data-state', 'collapsed');
expect(sidebar.style.width).toBe(`${SIDEBAR_ICON_WIDTH}px`);
+ expect(screen.getByTestId('root-shell-routed-content').style.paddingInlineStart).toBe(
+ `${SIDEBAR_ICON_WIDTH + 12}px`
+ );
expect(screen.getByText('sidebar body')).toBeTruthy();
// The resize rail is hidden while collapsed — a fixed icon width isn't
// draggable.
diff --git a/app/src/components/layout/shell/RootShellLayout.tsx b/app/src/components/layout/shell/RootShellLayout.tsx
index af2c3d4144..4b43fe28df 100644
--- a/app/src/components/layout/shell/RootShellLayout.tsx
+++ b/app/src/components/layout/shell/RootShellLayout.tsx
@@ -14,6 +14,7 @@ import { isTauri, safeInvoke } from '../../../utils/tauriCommands/common';
import {
Sidebar,
SIDEBAR_DEFAULT_WIDTH,
+ SIDEBAR_ICON_WIDTH,
SIDEBAR_MAX_WIDTH,
SIDEBAR_MIN_WIDTH,
SidebarProvider,
@@ -33,6 +34,8 @@ const LAYOUT_ID = APP_SHELL_LAYOUT_ID;
// here — they were byte-identical, and two copies of a clamp is one copy too
// many once the primitive is the thing doing the clamping.
const LAYOUT_DEFAULTS = { sidebarVisible: true, sidebarWidth: SIDEBAR_DEFAULT_WIDTH };
+/** Matches Tailwind's `3` spacing used for the floating shell inset. */
+const SHELL_GUTTER = 12;
function clamp(width: number): number {
return Math.min(Math.max(width, SIDEBAR_MIN_WIDTH), SIDEBAR_MAX_WIDTH);
@@ -74,19 +77,21 @@ interface RootShellLayoutProps {
}
/**
- * Viewport-filling two-pane shell for the app root, built as two layers rather
- * than two opaque panes:
+ * Viewport-filling shell for the app root, built as stacked layers rather than
+ * two opaque side-by-side panes:
*
* - **Chrome** — this component paints nothing of its own. The themed
* {@link AppBackground} behind it shows through here and behind the
* sidebar, so the frame carries the theme's hue as one continuous surface.
- * - **Card** — the routed content sits on a single inset, rounded
- * {@link ContentSurface}, the only opaque sheet in the shell.
+ * - **Card** — the routed content sits on a full-window inset, rounded
+ * {@link ContentSurface}, the opaque sheet beneath the sidebar.
+ * - **Sidebar** — an inset material floats above that sheet. The routed
+ * content receives an equal inline inset, so it never sits under the
+ * floating navigation even though its background continues behind it.
*
- * The two separate by fill contrast — the canvas/chrome neutrals sit below the
- * card's surface — which is why the sidebar needs no border and the panes need
- * no divider fill. The dragged sidebar width persists per
- * user via the `layout` slice (id `app-shell`).
+ * The layers separate by material, border, and elevation rather than a hard
+ * pane split. The resize seam remains transparent at rest. The dragged sidebar
+ * width persists per user via the `layout` slice (id `app-shell`).
*
* ## Redux stays the source of truth
*
@@ -143,6 +148,8 @@ export default function RootShellLayout({ sidebar, children, unframed }: RootShe
const dragWidthRef = useRef<number | null>(null);
const dragCleanupRef = useRef<(() => void) | null>(null);
const width = dragWidth ?? persistedWidth;
+ const renderedSidebarWidth = isOpen ? width : SIDEBAR_ICON_WIDTH;
+ const routedContentInset = renderedSidebarWidth + SHELL_GUTTER;
const commitWidth = useCallback(
(next: number) => dispatch(setSidebarWidth({ id: LAYOUT_ID, width: clamp(Math.round(next)) })),
@@ -253,7 +260,10 @@ export default function RootShellLayout({ sidebar, children, unframed }: RootShe
longer exists. `AppSidebar` reads {@link useSidebar}'s `state` to
render its own compact, icon-only body while collapsed (formerly
the sibling `<div>` here). */}
- <Sidebar collapsible="icon" data-testid="root-shell-sidebar">
+ <Sidebar
+ collapsible="icon"
+ data-testid="root-shell-sidebar"
+ className="absolute inset-y-3 left-3 z-30 h-auto rounded-2xl border border-sidebar-border bg-sidebar/85 shadow-large backdrop-blur-2xl">
{sidebar}
</Sidebar>
@@ -269,17 +279,26 @@ export default function RootShellLayout({ sidebar, children, unframed }: RootShe
data-testid="root-shell-divider"
data-analytics-id="root-shell-resize-divider"
onPointerDown={handleRailPointerDown}
+ className="absolute inset-y-3 z-40"
+ style={{ left: width + SHELL_GUTTER }}
/>
)}
<div
- className="relative flex min-w-0 flex-1 flex-col overflow-hidden"
+ className="relative flex w-full min-w-0 flex-1 flex-col overflow-hidden"
data-testid="root-shell-content">
{/* macOS overlay-title-bar drag region. It is absolutely positioned, so
the routed surface keeps its full height. No-op off macOS / outside
Tauri, where the native title bar already owns this area. */}
<WindowDragBar />
- <ContentSurface unframed={unframed}>{children}</ContentSurface>
+ <ContentSurface unframed={unframed}>
+ <div
+ data-testid="root-shell-routed-content"
+ className="flex min-h-0 min-w-0 flex-1 flex-col"
+ style={{ paddingInlineStart: routedContentInset }}>
+ {children}
+ </div>
+ </ContentSurface>
</div>
</SidebarProvider>
);
diff --git a/app/src/components/layout/shell/SidebarHeader.tsx b/app/src/components/layout/shell/SidebarHeader.tsx
index 4aca673a64..0677c21795 100644
--- a/app/src/components/layout/shell/SidebarHeader.tsx
+++ b/app/src/components/layout/shell/SidebarHeader.tsx
@@ -46,8 +46,10 @@ export default function SidebarHeader() {
// beside the row it has to agree with.
//
// The target is fixed and computable: this row's centre is pt-3 (12px) plus
- // half of ICON_BTN's h-7 (14px) = 26px from the window top, and the sidebar
- // starts flush at that top — `SidebarProvider`/`Sidebar` add no inset.
+ // half of ICON_BTN's h-7 (14px) = 26px from the sidebar top. The floating
+ // sidebar starts 12px from the window edges, so both traffic-light
+ // coordinates preserve their old position relative to the sidebar by
+ // adding that inset: x 20 -> 32 and y 28 -> 40.
//
// `y` is NOT that centre, and is not a simple gap either. tao positions the
// lights by resizing the title-bar container: `inset_traffic_lights`
@@ -57,9 +59,10 @@ export default function SidebarHeader() {
// works out as `y − b`, where `b` is whatever offset the button already had
// inside that container. `b` is AppKit's and is not knowable from here,
// which is why `y` is tuned by looking at the window rather than solved:
- // 20 sat visibly high, 28 is the correction.
+ // 20 sat visibly high, 28 was the correction before the 12px shell inset.
//
- // `x: 20` is the conventional macOS left inset. Supplying it is unavoidable
+ // `x: 32` is the conventional 20px macOS left inset plus the sidebar's 12px
+ // shell inset. Supplying it is unavoidable
// — the config takes a position, so `y` cannot be set alone without moving
// this into Rust and reading the existing frame.
//
diff --git a/app/src/components/ui/Sidebar.tsx b/app/src/components/ui/Sidebar.tsx
index 4a300cc161..1dee010c5c 100644
--- a/app/src/components/ui/Sidebar.tsx
+++ b/app/src/components/ui/Sidebar.tsx
@@ -455,8 +455,10 @@ export const SidebarTrigger = forwardRef<HTMLButtonElement, SidebarTriggerProps>
SidebarTrigger.displayName = 'SidebarTrigger';
/**
- * The routed content beside the column. `unframed` renders it edge-to-edge —
- * the framed default is an inset, rounded card on the chrome.
+ * The routed content layer beneath the column. `unframed` renders it
+ * edge-to-edge; the framed default is an evenly inset rounded card on the
+ * chrome. The root shell pads the card's children past its overlaid sidebar,
+ * while the card background continues beneath that material.
*
* The card's hairline is painted by an `::after` overlay rather than by the
* element's own `box-shadow`. An inset shadow renders above the element's
@@ -479,13 +481,13 @@ export const SidebarInset = forwardRef<HTMLDivElement, SidebarInsetProps>(
data-unframed={unframed ? 'true' : undefined}
className={cn(
'relative z-10 flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-surface',
- // `my-3 mr-3`, with NO left margin: the card butts against the sidebar
- // column so the two read as one continuous surface, and the gutter the
- // shell shows is the three outer edges. A left margin here put a strip
- // of chrome between the nav and the content that nothing else lined up
- // with.
+ // The content sheet spans beneath the floating sidebar, Apple-style,
+ // so the outer card keeps one even gutter on all four window edges.
+ // Avoid putting sidebar compensation here: the primitive does not know
+ // whether a caller overlays a sidebar, and RootShellLayout owns that
+ // routed-content inset explicitly.
!unframed &&
- 'my-3 mr-3 rounded-2xl after:pointer-events-none after:absolute after:inset-0 after:z-20 after:rounded-[inherit] after:shadow-content-edge',
+ 'm-3 rounded-2xl after:pointer-events-none after:absolute after:inset-0 after:z-20 after:rounded-[inherit] after:shadow-content-edge',
className
)}
{...rest}
diff --git a/crates/openhuman-app/tauri.conf.json b/crates/openhuman-app/tauri.conf.json
index 8297938bc7..617ef14b3d 100644
--- a/crates/openhuman-app/tauri.conf.json
+++ b/crates/openhuman-app/tauri.conf.json
@@ -21,8 +21,8 @@
"titleBarStyle": "Overlay",
"hiddenTitle": true,
"trafficLightPosition": {
- "x": 20,
- "y": 28
+ "x": 32,
+ "y": 40
},
"resizable": true,
"center": false,