Skip to content

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

refactor(settings): replace manual card markup with shared Card component

Steven Enamakel8d9276b017e2
diff --git a/app/src/components/settings/panels/AIPanel.tsx b/app/src/components/settings/panels/AIPanel.tsx
index 2226f30923..7643bc73ef 100644
--- a/app/src/components/settings/panels/AIPanel.tsx
+++ b/app/src/components/settings/panels/AIPanel.tsx
@@ -21,6 +21,7 @@ import { connectOpenRouterViaOAuth } from '../../../utils/openrouterOAuth';
import PanelPage from '../../layout/PanelPage';
import Alert from '../../ui/Alert';
import Button from '../../ui/Button';
+import Card from '../../ui/Card';
import { ModalShell } from '../../ui/ModalShell';
import SettingsBackButton from '../components/SettingsBackButton';
import { useSettingsNavigation } from '../hooks/useSettingsNavigation';
@@ -273,7 +274,7 @@ const AIPanel = ({
<>
<Alert variant="info">{t('settings.ai.routing.customDesc')}</Alert>
- <div className="flex w-full flex-col overflow-hidden rounded-xl border border-line">
+ <Card className="w-full">
<WorkloadTable
title={t('settings.ai.routing.chatAndConversations')}
description={t('settings.ai.routing.chatDesc')}>
@@ -301,7 +302,7 @@ const AIPanel = ({
/>
))}
</WorkloadTable>
- </div>
+ </Card>
</>
) : null}
</div>
diff --git a/app/src/components/settings/panels/ai/GlobalOwnModelSelector.tsx b/app/src/components/settings/panels/ai/GlobalOwnModelSelector.tsx
index 96c004ff55..739db2674d 100644
--- a/app/src/components/settings/panels/ai/GlobalOwnModelSelector.tsx
+++ b/app/src/components/settings/panels/ai/GlobalOwnModelSelector.tsx
@@ -13,6 +13,7 @@ import {
} from '../../../../services/api/aiSettingsApi';
import Alert from '../../../ui/Alert';
import Button from '../../../ui/Button';
+import Card from '../../../ui/Card';
import Checkbox from '../../../ui/Checkbox';
import Label from '../../../ui/Label';
import NativeSelect from '../../../ui/NativeSelect';
@@ -194,13 +195,11 @@ export const GlobalOwnModelSelector = ({
};
return (
- <div className="flex w-full flex-col gap-4 rounded-xl border border-line bg-surface p-4">
- <div className="flex flex-col gap-1">
- <div className="text-sm font-medium text-content">{t('settings.ai.globalModel.title')}</div>
- <p className="text-xs text-amber-700 dark:text-amber-200">
- {t('settings.ai.globalModel.desc')}
- </p>
- </div>
+ <Card
+ title={t('settings.ai.globalModel.title')}
+ description={t('settings.ai.globalModel.desc')}
+ className="w-full">
+ <div className="flex flex-col gap-4 p-4">
{customCloud.length === 0 && !localAvailable && !claudeCodeEnabled ? (
<Alert variant="warning" className="p-3 text-xs">
@@ -322,7 +321,8 @@ export const GlobalOwnModelSelector = ({
</div>
</>
)}
- </div>
+ </div>
+ </Card>
);
};
diff --git a/app/src/components/settings/panels/ai/RoutingModeCards.tsx b/app/src/components/settings/panels/ai/RoutingModeCards.tsx
index dbbbb4e805..aecb10d9c7 100644
--- a/app/src/components/settings/panels/ai/RoutingModeCards.tsx
+++ b/app/src/components/settings/panels/ai/RoutingModeCards.tsx
@@ -1,22 +1,7 @@
/*
- * Top-level routing-mode picker: a segmented radio row (Managed / Use Your Own
- * / Advanced) plus the "managed" confirmation banner.
- *
- * IT IS A REAL RADIO GROUP. These three modes are mutually exclusive and one
- * is always in force, but the old markup was three independent `<button>`s
- * whose selected-ness lived only in a class string: a screen reader was told
- * nothing about the choice, arrow keys did nothing, and there was no way to
- * hear which mode was active. `RadioGroupRoot`/`RadioGroupItem` supply
- * `role="radiogroup"`, roving focus and `aria-checked`. Each cell is a
- * `<label>` wrapping its item, so the whole cell stays clickable and the
- * accessible name is the title plus its description.
- *
- * IT IS SEGMENTED, NOT THREE CARDS. Three 152px-tall cards in a grid took a
- * third of the page to express one choice, and the grid pinned them to equal
- * thirds at exactly one breakpoint. One bordered strip divided into three
- * flex cells says the same thing in a quarter of the height, fills whatever
- * width the pane actually has, and folds to stacked rows on its own — the
- * column is the flex default, not a breakpoint.
+ * Top-level routing-mode picker. These options are a real radio group: one
+ * routing mode is always active, and the primitive supplies its keyboard and
+ * screen-reader behavior.
*/
import { cn } from '../../../../lib/cn';
import { useT } from '../../../../lib/i18n/I18nContext';
@@ -30,14 +15,11 @@ import type { RoutingMode } from './aiPanelTypes';
const ModeOption = ({
value,
selected,
- tone,
title,
description,
}: {
value: RoutingMode;
selected: boolean;
- /** `sage` marks the recommended managed default; the rest read as primary. */
- tone: 'sage' | 'primary';
title: string;
description: string;
}) => (
@@ -45,12 +27,8 @@ const ModeOption = ({
data-slot="routing-mode-option"
data-selected={selected}
className={cn(
- 'flex min-w-0 flex-1 cursor-pointer items-start gap-3 p-3 transition-colors duration-150',
- selected
- ? tone === 'sage'
- ? 'bg-sage-50 dark:bg-sage-500/10'
- : 'bg-primary-50 dark:bg-primary-500/10'
- : 'bg-surface hover:bg-surface-hover'
+ 'flex cursor-pointer items-start gap-3 rounded-lg px-3 py-2.5 transition-colors',
+ selected ? 'bg-surface-muted' : 'hover:bg-surface-hover'
)}>
<RadioGroupItem value={value} size="md" className="mt-0.5" />
<span className="flex min-w-0 flex-col gap-0.5">
@@ -82,28 +60,22 @@ export const RoutingModeCards = ({
else if (next === 'own') onSelectOwn();
else if (next === 'custom') onSelectCustom();
}}
- className={cn(
- 'flex w-full flex-col items-stretch overflow-hidden rounded-xl border border-line',
- 'divide-y divide-line md:flex-row md:divide-x md:divide-y-0'
- )}>
+ className="grid w-full gap-1">
<ModeOption
value="managed"
selected={effectiveRoutingMode === 'managed'}
- tone="sage"
title={t('settings.ai.routing.managed')}
description={t('settings.ai.routing.managedDesc')}
/>
<ModeOption
value="own"
selected={effectiveRoutingMode === 'own'}
- tone="primary"
title={t('settings.ai.routing.useYourOwn')}
description={t('settings.ai.routing.useYourOwnDesc')}
/>
<ModeOption
value="custom"
selected={effectiveRoutingMode === 'custom'}
- tone="primary"
title={t('settings.ai.routing.advanced')}
description={t('settings.ai.routing.advancedDesc')}
/>