Skip to content

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

feat(settings): migrate SettingsPanel from PanelPage to SettingsTabbedPage

Steven Enamakeldc4a4eb8d5d6
diff --git a/app/src/components/settings/layout/SettingsPanel.tsx b/app/src/components/settings/layout/SettingsPanel.tsx
index 229fbea8d0..259256899f 100644
--- a/app/src/components/settings/layout/SettingsPanel.tsx
+++ b/app/src/components/settings/layout/SettingsPanel.tsx
@@ -7,6 +7,7 @@ import { useSettingsNavigation } from '../hooks/useSettingsNavigation';
import { findEntryById } from '../settingsRouteRegistry';
import { useSettingsLayout } from './SettingsLayoutContext';
import SettingsSubNav from './SettingsSubNav';
+import SettingsTabbedPage from './SettingsTabbedPage';
interface SettingsPanelProps<T extends string = string> {
/**
@@ -37,15 +38,27 @@ interface SettingsPanelProps<T extends string = string> {
}
/**
- * The single template for every Settings page. Wraps {@link PanelPage} and bakes
- * in the conventions so panels stop drifting:
+ * The single template for every Settings page. Wraps
+ * {@link SettingsTabbedPage} and bakes in the conventions so panels stop
+ * drifting:
*
* - A consistent visible **title** (auto-derived from the route registry), with
* the optional `action` aligned on the same row and the `description` beneath.
* - The route-aware back button (hidden in the two-pane shell on wide viewports).
* - The sibling **sub-nav** pill row rendered *inside* the header — so the order
- * is always title → description → tabs → body, on every panel.
- * - Canonical full-width body spacing (`p-4 space-y-5`) and `z-10`.
+ * is always title → description → sub-nav → tabs → body, on every panel.
+ * - Canonical body spacing and the page's `p-4` gutter.
+ *
+ * It wrapped `PanelPage` until the settings pages were brought onto the
+ * Connections pages' layout: `PanelPage`'s header is a small title over a
+ * hairline, while `SettingsTabbedPage` gives the page a real 2xl heading and a
+ * full-bleed divider. Both hosts render the same panels, so having two chromes
+ * meant the same panel looked like a different page depending on how it was
+ * reached.
+ *
+ * `headerless` still delegates to `PanelPage`: that mode exists for the
+ * Connections pane, which draws the page header itself, so this must render
+ * body-only chrome and nothing that would double it.
*
* Use it for the routed panel only; embedded sub-panels (tab bodies) keep
* rendering headerless content.
@@ -98,38 +111,49 @@ export default function SettingsPanel<T extends string = string>({
// Family pill row (e.g. Account → Team / Privacy / …). Renders null when the
// active route has no siblings, so it costs nothing on standalone panels.
- // Tucked tight under the title/description to match in-panel chip spacing.
- const subNav = <SettingsSubNav className="flex flex-wrap gap-1.5 pt-2" />;
+ const subNav = <SettingsSubNav className="flex flex-wrap gap-1.5" />;
- if (tabs && tabs.length > 0) {
- return (
- <PanelPage<T>
- className="z-10"
- testId={testId}
+ const tabList = tabs ?? [];
+ const active = tabList.length > 0 ? (tabList.find(tab => tab.id === value) ?? tabList[0]) : null;
+
+ // A tab's `description` was rendered by the scaffold `PanelPage` gave each
+ // body. Nothing renders it here, so keep it above the body rather than
+ // dropping it — a silently unrendered prop is how a page loses its only
+ // explanation of what a tab does.
+ const body = active ? (
+ <div className={active.contentClassName || undefined}>
+ {active.description != null && (
+ <p className="pb-3 text-sm text-content-muted">{active.description}</p>
+ )}
+ {active.content}
+ {children}
+ </div>
+ ) : (
+ <div className="space-y-5">{children}</div>
+ );
+
+ return (
+ // `p-4` is the page gutter the divider's `-mx-4` bleeds through; `z-10`
+ // is carried over from the PanelPage era, where panels stacked over the
+ // shell background.
+ <div className="relative z-10 h-full p-4" data-testid={testId}>
+ <SettingsTabbedPage<T>
title={resolvedTitle}
description={description}
leading={leading}
- action={action}
+ headerAction={action}
headerExtra={subNav}
- tabs={tabs}
- value={value}
+ tabs={
+ active
+ ? tabList.map(tab => ({ id: tab.id, label: tab.label, testId: tab.chipTestId }))
+ : undefined
+ }
+ value={active ? active.id : undefined}
onChange={onChange}
tabsAriaLabel={tabsAriaLabel}
- tabsTestIdPrefix={tabsTestIdPrefix}
- />
- );
- }
-
- return (
- <PanelPage
- className="z-10"
- testId={testId}
- title={resolvedTitle}
- description={description}
- leading={leading}
- action={action}
- headerExtra={subNav}>
- {children}
- </PanelPage>
+ tabsTestIdPrefix={tabsTestIdPrefix}>
+ {body}
+ </SettingsTabbedPage>
+ </div>
);
}