The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(settings): consolidate search engine picker into key editor
Steven Enamakeld65bf04c5fa5
diff --git a/app/src/components/settings/panels/SearchPanelEngineList.tsx b/app/src/components/settings/panels/SearchPanelEngineList.tsxdeleted file mode 100644index 15254cff0f..0000000000--- a/app/src/components/settings/panels/SearchPanelEngineList.tsx+++ /dev/null@@ -1,84 +0,0 @@-import type { SearchEngineId } from '../../../utils/tauriCommands/config';-import Badge from '../../ui/Badge';-import { CheckIcon } from '../../ui/icons';-import { ToggleGroupItem, ToggleGroupRoot } from '../../ui/ToggleGroup';--export interface EngineOption {- id: SearchEngineId;- label: string;- description: string;- requiresKey: boolean;-}--interface SearchPanelEngineListProps {- engines: EngineOption[];- selectedEngine: SearchEngineId;- ariaLabel: string;- isConfigured: (engine: SearchEngineId) => boolean;- onSelect: (engine: SearchEngineId) => void;- t: (key: string) => string;-}--/**- * The search-engine picker. A single-select `ToggleGroup` gives the real- * `role="radiogroup"` / `role="radio"` / `aria-checked` pairing for free- * (Radix sets these itself for `type="single"`), plus roving-focus arrow-key- * navigation — the hand-rolled `<button role="radio">` list this replaced had- * neither.- */-const SearchPanelEngineList = ({- engines,- selectedEngine,- ariaLabel,- isConfigured,- onSelect,- t,-}: SearchPanelEngineListProps) => (- <ToggleGroupRoot- type="single"- orientation="vertical"- aria-label={ariaLabel}- value={selectedEngine}- onValueChange={value => {- if (value) onSelect(value as SearchEngineId);- }}- className="flex w-full flex-col gap-0 divide-y divide-line-subtle rounded-xl border border-line bg-surface overflow-hidden">- {engines.map(opt => {- const selected = opt.id === selectedEngine;- const configured = isConfigured(opt.id);- const blocked = opt.requiresKey && !configured && selected;- return (- <ToggleGroupItem- key={opt.id}- value={opt.id}- data-testid={`search-engine-${opt.id}`}- variant="tertiary"- className="w-full flex items-start justify-start gap-3 rounded-none border-0 px-4 py-3 h-auto text-left data-[state=on]:bg-primary-50 dark:data-[state=on]:bg-primary-500/10">- <span className="flex-1 min-w-0">- <span className="flex items-center gap-2">- <span className="text-sm font-medium text-content">{opt.label}</span>- {opt.requiresKey && (- <Badge variant={configured ? 'success' : 'warning'}>- {configured- ? t('settings.search.statusConfigured')- : t('settings.search.statusNeedsKey')}- </Badge>- )}- </span>- <span className="block mt-0.5 text-xs text-content-muted">{opt.description}</span>- {blocked && (- <span className="block mt-1 text-[11px] text-amber-700 dark:text-amber-300">- {t('settings.search.fallbackToManaged')}- </span>- )}- </span>- {selected && (- <CheckIcon className="w-5 h-5 text-primary-500 shrink-0 mt-0.5" aria-hidden="true" />- )}- </ToggleGroupItem>- );- })}- </ToggleGroupRoot>-);--export default SearchPanelEngineList;diff --git a/app/src/components/settings/panels/SearchPanelKeyEditor.tsx b/app/src/components/settings/panels/SearchPanelKeyEditor.tsxindex 4abf485272..54e01571d6 100644--- a/app/src/components/settings/panels/SearchPanelKeyEditor.tsx+++ b/app/src/components/settings/panels/SearchPanelKeyEditor.tsx@@ -13,11 +13,14 @@ export interface KeyEditorProps {onSave: () => void;onClear: () => void;configured: boolean;- docUrl: string;+ /** Where to get a key; the link is hidden when the provider has none. */+ docUrl?: string | null;+ disabled?: boolean;+ testId?: string;t: (key: string) => string;}-/** One BYOK API-key row: label + doc link, a maskable input, and save/clear actions. */+/** One API-key row: label + doc link, a maskable input, and save/clear actions. */const KeyEditor = ({label,placeholder,@@ -29,6 +32,8 @@ const KeyEditor = ({onClear,configured,docUrl,+ disabled = false,+ testId,t,}: KeyEditorProps) => {const inputId = useId();@@ -37,7 +42,8 @@ const KeyEditor = ({<divrole="group"aria-labelledby={inputId}- className="rounded-xl border border-line bg-surface p-3">+ data-testid={testId}+ className="rounded-lg border border-line-subtle bg-surface-subtle p-3"><div className="flex items-center justify-between mb-2"><labelid={inputId}@@ -45,13 +51,15 @@ const KeyEditor = ({className="text-xs font-semibold text-content">{label}</label>- <a- href={docUrl}- target="_blank"- rel="noopener noreferrer"- className="text-[10px] text-primary-500 hover:underline">- {t('settings.search.getApiKey')} ↗- </a>+ {docUrl && (+ <a+ href={docUrl}+ target="_blank"+ rel="noopener noreferrer"+ className="text-[10px] text-primary-500 hover:underline">+ {t('settings.search.getApiKey')} ↗+ </a>+ )}</div><div className="flex items-center gap-2"><Input@@ -71,11 +79,17 @@ const KeyEditor = ({variant="primary"size="xs"onClick={onSave}- disabled={value.trim().length === 0}>+ disabled={disabled || value.trim().length === 0}>{t('settings.search.save')}</Button>{configured && (- <Button type="button" variant="secondary" tone="danger" size="xs" onClick={onClear}>+ <Button+ type="button"+ variant="secondary"+ tone="danger"+ size="xs"+ onClick={onClear}+ disabled={disabled}>{t('settings.search.clear')}</Button>)}