Skip to content

The agent that grows with you

fix(desktop): unify overlay-pane padding and add primary PanelAction

Brooklyn Nicholsona3421aadda03
diff --git a/apps/desktop/src/app/overlays/overlay-split-layout.tsx b/apps/desktop/src/app/overlays/overlay-split-layout.tsx
index cf0200275a6..6ed570f4b99 100644
--- a/apps/desktop/src/app/overlays/overlay-split-layout.tsx
+++ b/apps/desktop/src/app/overlays/overlay-split-layout.tsx
@@ -4,7 +4,9 @@ import { TabDropdown } from '@/components/ui/tab-dropdown'
import type { IconComponent } from '@/lib/icons'
import { cn } from '@/lib/utils'
-import { PAGE_INSET_X, PAGE_MAX_W } from '../layout-constants'
+import { PAGE_MAX_W } from '../layout-constants'
+
+import { OVERLAY_TOP_CLEARANCE } from './overlay-view'
// The wide rail and the narrow dropdown swap at exactly the width where
// OverlaySplitLayout drops to a single column, so the rail never stacks.
@@ -57,10 +59,12 @@ export function OverlaySidebar({ children, className }: OverlaySidebarProps) {
return (
<aside
className={cn(
- // pt clears the in-card close button (the OverlayView now insets the
- // whole card below the OS titlebar); the bg fills from the card's top
- // edge so there's no surface-colored gap above the sidebar.
- 'flex min-h-0 flex-col gap-0.5 overflow-y-auto bg-(--ui-sidebar-surface-background) px-2.5 pb-3 pt-[calc(var(--titlebar-height)/2+1rem)]',
+ // The left links sit beside (not under) the floating close button, so
+ // they ride up via the shorter shared OVERLAY_TOP_CLEARANCE (same line
+ // as a Panel header) instead of main's taller X-clearance. The bg still
+ // fills from the card's top edge, so there's no gap above the sidebar.
+ 'flex min-h-0 flex-col gap-0.5 overflow-y-auto bg-(--ui-sidebar-surface-background) px-2.5 pb-3',
+ OVERLAY_TOP_CLEARANCE,
className
)}
>
@@ -73,11 +77,15 @@ export function OverlayMain({ children, className }: OverlayMainProps) {
return (
<main
className={cn(
- // Narrow: the OverlayNav dropdown bar already clears the titlebar, so
- // drop the tall top pad to a normal gap below it.
- 'mx-auto flex min-h-0 w-full flex-1 flex-col overflow-hidden bg-transparent pb-3 pt-[calc(var(--titlebar-height)/2+1rem)] max-[47.5rem]:pt-2',
+ // Main sits UNDER the floating close button (top-right), so it keeps the
+ // taller top pad to clear the X — unlike the sidebar / Panel header,
+ // which sit to its left and ride up via OVERLAY_TOP_CLEARANCE. All four
+ // paddings are 1/3 tighter than the raw values (×2/3): the wide/narrow
+ // top clearance, the bottom gutter, and the horizontal clamp gutter
+ // (inlined from PAGE_INSET_X so only overlay panes tighten, not the
+ // shared page gutter). Narrow top drops toward the OverlayNav bar.
+ 'mx-auto flex min-h-0 w-full flex-1 flex-col overflow-hidden bg-transparent pb-2 pt-[calc((var(--titlebar-height)/2+1rem)*2/3)] max-[47.5rem]:pt-[calc(0.5rem*2/3)] px-[clamp(0.8333rem,2.6667vw,2.6667rem)]',
PAGE_MAX_W,
- PAGE_INSET_X,
className
)}
>
diff --git a/apps/desktop/src/app/overlays/overlay-view.tsx b/apps/desktop/src/app/overlays/overlay-view.tsx
index 40fce12ec0a..f9c544ee59d 100644
--- a/apps/desktop/src/app/overlays/overlay-view.tsx
+++ b/apps/desktop/src/app/overlays/overlay-view.tsx
@@ -9,6 +9,14 @@ import { ESCAPE_PRIORITY, isTopEscapeLayer, pushEscapeLayer } from '@/lib/escape
import { triggerHaptic } from '@/lib/haptics'
import { cn } from '@/lib/utils'
+// Shared top clearance for overlay content that sits *beside* the floating
+// close button (which is absolute at `0.1875rem + titlebar/2`, -translate-y-1/2,
+// so it costs no layout space): a Panel's header and the split layout's left
+// sidebar links. They ride up next to the X on the same line across every
+// overlay (settings, system, agents, cron, …) — change it here, not per-surface.
+// Main content sits *under* the X (top-right) and keeps its own taller pad.
+export const OVERLAY_TOP_CLEARANCE = 'pt-[calc(var(--titlebar-height)/2-0.4375rem)]'
+
interface OverlayViewProps {
children: ReactNode
onClose: () => void
diff --git a/apps/desktop/src/app/overlays/panel.tsx b/apps/desktop/src/app/overlays/panel.tsx
index d4109a2f221..34a8ead6c54 100644
--- a/apps/desktop/src/app/overlays/panel.tsx
+++ b/apps/desktop/src/app/overlays/panel.tsx
@@ -9,7 +9,7 @@ import { Tip } from '@/components/ui/tooltip'
import { translateNow } from '@/i18n'
import { cn } from '@/lib/utils'
-import { OverlayView } from './overlay-view'
+import { OVERLAY_TOP_CLEARANCE, OverlayView } from './overlay-view'
// Overlay "panel" primitive — the centered, capped card + framed chrome lifted
// straight from the trace / agents overlay so every non-settings overlay (cron,
@@ -47,13 +47,9 @@ export function Panel({
return (
<OverlayView
closeLabel={closeLabel}
- // Top pad aligns the header title's center with the floating close button
- // (which sits at 0.1875rem + titlebar/2, -translate-y-1/2). The X is
- // absolute so it costs no layout space — the header rides up next to it.
- contentClassName={cn(
- 'flex h-full min-h-0 flex-col px-4 pb-4 pt-[calc(var(--titlebar-height)/2-0.4375rem)] sm:px-5',
- contentClassName
- )}
+ // Header title rides up next to the floating close button — see
+ // OVERLAY_TOP_CLEARANCE, the shared clearance every overlay column uses.
+ contentClassName={cn('flex h-full min-h-0 flex-col px-4 pb-4 sm:px-5', OVERLAY_TOP_CLEARANCE, contentClassName)}
onClose={onClose}
rootClassName={cn('flex h-full w-full flex-col', className)}
>
@@ -373,25 +369,31 @@ export function PanelAddButton({
)
}
-// Visible ghost action for a detail header (cron pause/resume/trigger, …).
+// Visible action for a detail header (cron pause/resume/trigger, …). Ghost by
+// default; `primary` promotes the header's main action to a filled button.
export function PanelAction({
children,
disabled,
icon,
- onClick
+ onClick,
+ primary
}: {
children: ReactNode
disabled?: boolean
icon: string
onClick: () => void
+ primary?: boolean
}) {
return (
<Button
- className="gap-1.5 text-muted-foreground hover:bg-(--ui-row-hover-background) hover:text-foreground"
+ className={cn(
+ 'gap-1.5',
+ !primary && 'text-muted-foreground hover:bg-(--ui-row-hover-background) hover:text-foreground'
+ )}
disabled={disabled}
onClick={onClick}
size="sm"
- variant="ghost"
+ variant={primary ? 'default' : 'ghost'}
>
<Codicon name={icon} size="0.875rem" />
{children}
diff --git a/apps/desktop/src/app/settings/index.tsx b/apps/desktop/src/app/settings/index.tsx
index f51cca30f94..b74349cccd8 100644
--- a/apps/desktop/src/app/settings/index.tsx
+++ b/apps/desktop/src/app/settings/index.tsx
@@ -288,7 +288,7 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: Set
<OverlaySplitLayout>
<OverlayNav footer={navFooter} groups={navGroups} />
- <OverlayMain className="px-0 pb-0 pt-[calc(var(--titlebar-height)+1rem)]">
+ <OverlayMain className="px-0 pb-0">
{activeView === 'config:appearance' ? (
<AppearanceSettings />
) : activeView === 'about' ? (