Skip to content

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

fix(layout): prevent nav from overlapping content on narrow screens

Steven Enamakel2e7a112bf7a3
diff --git a/app/src/components/layout/TwoPaneNav.tsx b/app/src/components/layout/TwoPaneNav.tsx
index 2ad88772c7..c946c23e7c 100644
--- a/app/src/components/layout/TwoPaneNav.tsx
+++ b/app/src/components/layout/TwoPaneNav.tsx
@@ -6,12 +6,21 @@ interface TwoPaneNavItem {
value: string;
label: string;
icon?: ReactNode;
+ /**
+ * Accent an inactive row (e.g. Billing). Semantic, so it survives on the
+ * label and icon; an active row still renders fully neutral on the fill.
+ */
+ highlight?: boolean;
+ /** Overrides the derived `two-pane-nav-${value}` test id. */
+ testId?: string;
}
interface TwoPaneNavGroup {
/** Optional uppercase sub-header above the group's items. */
label?: string;
items: TwoPaneNavItem[];
+ /** `data-testid` for the group container. */
+ testId?: string;
}
interface TwoPaneNavProps {
@@ -26,6 +35,8 @@ interface TwoPaneNavProps {
*/
footer?: ReactNode;
ariaLabel?: string;
+ /** Walkthrough anchor for the nav element (Joyride target). */
+ walkthroughId?: string;
}
/**
@@ -42,15 +53,19 @@ export default function TwoPaneNav({
header,
footer,
ariaLabel,
+ walkthroughId,
}: TwoPaneNavProps) {
return (
- <nav aria-label={ariaLabel} className="flex h-full flex-col">
+ <nav
+ aria-label={ariaLabel}
+ data-walkthrough={walkthroughId}
+ className="flex h-full flex-col">
{header && <div className="shrink-0 px-3 pb-1 pt-3">{header}</div>}
{/* When there's no header, the list needs its own top padding so the first
item doesn't collide with the pane's top edge. */}
<div className={`min-h-0 flex-1 overflow-y-auto px-3 pb-2 ${header ? '' : 'pt-3'}`}>
{groups.map((group, groupIndex) => (
- <div key={group.label ?? `__group-${groupIndex}`}>
+ <div key={group.label ?? `__group-${groupIndex}`} data-testid={group.testId}>
{group.label && (
<div className="px-2 pb-0.5 pt-2.5">
<span className="text-[10px] font-semibold uppercase tracking-wider text-content-muted">
@@ -65,7 +80,7 @@ export default function TwoPaneNav({
<li key={item.value}>
<Button
variant="tertiary"
- data-testid={`two-pane-nav-${item.value}`}
+ data-testid={item.testId ?? `two-pane-nav-${item.value}`}
aria-current={active ? 'page' : undefined}
onClick={() => onSelect(item.value)}
// Same row spec as SidebarNav / SettingsSidebar /
@@ -75,11 +90,20 @@ export default function TwoPaneNav({
className={`h-auto w-full justify-start rounded-md px-2.5 py-1.5 text-left text-[14px] ${
active
? 'bg-primary-500 font-semibold text-content-inverted hover:bg-primary-500'
- : 'font-normal text-content-muted hover:bg-surface/40 hover:text-content-secondary'
+ : item.highlight
+ ? 'font-normal text-primary-700 hover:bg-surface/40 dark:text-primary-300'
+ : 'font-normal text-content-muted hover:bg-surface/40 hover:text-content-secondary'
}`}>
<span
+ // `active` is tested first so a row that is both active
+ // and highlighted renders fully neutral — otherwise the
+ // label goes neutral while the icon keeps the accent.
className={`shrink-0 ${
- active ? 'text-content-inverted' : 'text-content-faint'
+ active
+ ? 'text-content-inverted'
+ : item.highlight
+ ? 'text-primary-600 dark:text-primary-400'
+ : 'text-content-faint'
}`}>
{item.icon ?? null}
</span>