Skip to content

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

refactor(settings): replace inline layout with SettingsTabbedPage component

Steven Enamakel5849c49a984b
diff --git a/app/src/components/settings/layout/SettingsTabbedPage.tsx b/app/src/components/settings/layout/SettingsTabbedPage.tsx
new file mode 100644
index 0000000000..ebb9f43999
--- /dev/null
+++ b/app/src/components/settings/layout/SettingsTabbedPage.tsx
@@ -0,0 +1,50 @@
+import type { ReactNode } from 'react';
+
+import ChipTabs, { type ChipTabItem } from '../../layout/ChipTabs';
+
+export interface SettingsTabbedPageProps<T extends string> {
+ title: ReactNode;
+ description?: ReactNode;
+ tabs: ChipTabItem<T>[];
+ value: T;
+ onChange: (value: T) => void;
+ tabsAriaLabel: string;
+ tabsTestIdPrefix?: string;
+ children: ReactNode;
+}
+
+/**
+ * Reusable settings-detail shell for a titled page with sibling chip views.
+ *
+ * The two-pane Settings navigation replaced breadcrumb trails, so this
+ * primitive deliberately keeps page navigation to the title, description, and
+ * local chip row. Its child owns the active view and its scrolling behavior.
+ */
+export default function SettingsTabbedPage<T extends string>({
+ title,
+ description,
+ tabs,
+ value,
+ onChange,
+ tabsAriaLabel,
+ tabsTestIdPrefix,
+ children,
+}: SettingsTabbedPageProps<T>) {
+ return (
+ <div className="flex h-full flex-col gap-4">
+ <header className="space-y-0.5">
+ <h1 className="text-2xl font-semibold tracking-tight text-content">{title}</h1>
+ {description != null && <p className="text-sm text-content-muted">{description}</p>}
+ </header>
+ <ChipTabs
+ className="flex flex-wrap gap-1.5"
+ ariaLabel={tabsAriaLabel}
+ testIdPrefix={tabsTestIdPrefix}
+ items={tabs}
+ value={value}
+ onChange={onChange}
+ />
+ <div className="min-h-0 flex-1 overflow-hidden">{children}</div>
+ </div>
+ );
+}
diff --git a/app/src/components/settings/panels/LlmConnectionsPanel.tsx b/app/src/components/settings/panels/LlmConnectionsPanel.tsx
index c02ac90486..62c718cbf2 100644
--- a/app/src/components/settings/panels/LlmConnectionsPanel.tsx
+++ b/app/src/components/settings/panels/LlmConnectionsPanel.tsx
@@ -1,7 +1,7 @@
import { useState } from 'react';
import { useT } from '../../../lib/i18n/I18nContext';
-import ChipTabs from '../../layout/ChipTabs';
+import SettingsTabbedPage from '../layout/SettingsTabbedPage';
import AIPanel, { type AIPanelTab } from './AIPanel';
/**
@@ -23,28 +23,19 @@ const LlmConnectionsPanel = () => {
const [tab, setTab] = useState<AIPanelTab>('providers');
return (
- <div className="flex h-full flex-col gap-4">
- <div className="space-y-0.5">
- <h1 className="text-2xl font-semibold tracking-tight text-content">
- {t('pages.settings.ai.llm')}
- </h1>
- <p className="text-sm text-content-muted">{t('connections.header.llm')}</p>
- </div>
- <ChipTabs
- className="flex flex-wrap gap-1.5"
- ariaLabel={t('pages.settings.ai.llm')}
- testIdPrefix="ai-tab"
- items={[
- { id: 'providers', label: t('settings.ai.llmProviders') },
- { id: 'routing', label: t('settings.ai.routing') },
- ]}
- value={tab}
- onChange={setTab}
- />
- <div className="min-h-0 flex-1 overflow-hidden">
- <AIPanel tab={tab} onTabChange={setTab} hideTabChrome />
- </div>
- </div>
+ <SettingsTabbedPage
+ title={t('pages.settings.ai.llm')}
+ description={t('connections.header.llm')}
+ tabs={[
+ { id: 'providers', label: t('settings.ai.llmProviders') },
+ { id: 'routing', label: t('settings.ai.routing') },
+ ]}
+ value={tab}
+ onChange={setTab}
+ tabsAriaLabel={t('pages.settings.ai.llm')}
+ tabsTestIdPrefix="ai-tab">
+ <AIPanel tab={tab} onTabChange={setTab} hideTabChrome />
+ </SettingsTabbedPage>
);
};