diff --git a/apps/desktop/src/app/desktop-controller.tsx b/apps/desktop/src/app/desktop-controller.tsx index c6ccce0a46..1425b64526 100644 --- a/apps/desktop/src/app/desktop-controller.tsx +++ b/apps/desktop/src/app/desktop-controller.tsx @@ -78,6 +78,7 @@ import { CommandPalette } from './command-palette' import { useGatewayBoot } from './gateway/hooks/use-gateway-boot' import { useGatewayRequest } from './gateway/hooks/use-gateway-request' import { useKeybinds } from './hooks/use-keybinds' +import { SIDEBAR_COLLAPSE_MEDIA_QUERY } from './layout-constants' import { ModelPickerOverlay } from './model-picker-overlay' import { ModelVisibilityOverlay } from './model-visibility-overlay' import { RightSidebarPane } from './right-sidebar' @@ -167,10 +168,10 @@ export function DesktopController() { const terminalTakeover = useStore($terminalTakeover) const panesFlipped = useStore($panesFlipped) const profileScope = useStore($profileScope) - // Below 600px there's no room for a docked rail — collapse both sidebars - // (without touching their stored open state) so the hover-reveal overlay - // becomes the way in. Restores to the saved layout once it's wide again. - const narrowViewport = useMediaQuery('(max-width: 600px)') + // Below SIDEBAR_COLLAPSE_BREAKPOINT_PX there's no room for a docked rail — + // collapse both sidebars (without touching their stored open state) so the + // hover-reveal overlay becomes the way in. Restores once it's wide again. + const narrowViewport = useMediaQuery(SIDEBAR_COLLAPSE_MEDIA_QUERY) const routedSessionId = routeSessionId(location.pathname) const routeToken = `${location.pathname}:${location.search}:${location.hash}` diff --git a/apps/desktop/src/app/layout-constants.ts b/apps/desktop/src/app/layout-constants.ts index fff56d1e2b..545addee28 100644 --- a/apps/desktop/src/app/layout-constants.ts +++ b/apps/desktop/src/app/layout-constants.ts @@ -11,3 +11,9 @@ export const PAGE_INSET_X = 'px-[clamp(1.25rem,4vw,4rem)]' // Matching negative inline-margin to bleed an element (e.g. a sticky header bar) // out to the gutter edges before re-applying PAGE_INSET_X. export const PAGE_INSET_NEG_X = '-mx-[clamp(1.25rem,4vw,4rem)]' + +// Below this viewport width a docked sidebar leaves no room for content, so both +// rails auto-collapse into the hover-reveal overlay. Single source of truth for +// the responsive collapse point. +export const SIDEBAR_COLLAPSE_BREAKPOINT_PX = 600 +export const SIDEBAR_COLLAPSE_MEDIA_QUERY = `(max-width: ${SIDEBAR_COLLAPSE_BREAKPOINT_PX}px)`