Skip to content

The agent that grows with you

fix(desktop): every settings row renders through one ListRow/ToggleRow/Slider/SearchField

brooklyn!1b7e8c45d62f
diff --git a/apps/desktop/src/app/settings/appearance-settings.tsx b/apps/desktop/src/app/settings/appearance-settings.tsx
index 9d38106a30e..837cc46b544 100644
--- a/apps/desktop/src/app/settings/appearance-settings.tsx
+++ b/apps/desktop/src/app/settings/appearance-settings.tsx
@@ -4,8 +4,9 @@ import { useEffect, useState } from 'react'
import { useDebounced } from '@/app/hooks/use-debounced'
import { LanguageSwitcher } from '@/components/language-switcher'
-import { Button } from '@/components/ui/button'
+import { SearchField } from '@/components/ui/search-field'
import { SegmentedControl } from '@/components/ui/segmented-control'
+import { Slider } from '@/components/ui/slider'
import type { DesktopMarketplaceSearchItem } from '@/global'
import { saveHermesConfig } from '@/hermes'
import { useI18n } from '@/i18n'
@@ -72,14 +73,13 @@ import { $marketplaceInstalls, isUserTheme, removeUserTheme } from '@/themes/use
import { setHermesConfigCache, useHermesConfigRecord } from '../hooks/use-config-record'
-import { appearanceSubpageForSetting, type AppearanceSubpageId } from './appearance-subpages'
+import { APPEARANCE_SETTING_IDS, appearanceSubpageForSetting, type AppearanceSubpageId } from './appearance-subpages'
import { ChatFontSetting } from './chat-font-setting'
import { MODE_OPTIONS } from './constants'
import { setNested } from './helpers'
import { MinimizeToTraySetting } from './minimize-to-tray-setting'
import { PetSettings } from './pet-settings'
-import { ListRow, SectionHeading, SettingsContent, ToggleRow } from './primitives'
-import { APPEARANCE_SETTING_IDS } from './settings-search'
+import { ListRow, RowFootnoteAction, SectionHeading, SettingsContent, ToggleRow } from './primitives'
import { TerminalFontSetting } from './terminal-font-setting'
import { useDeepLinkHighlight } from './use-deep-link-highlight'
@@ -121,6 +121,7 @@ function ResumeLastSessionSetting() {
checked={checked}
description={a.resumeLastSessionDesc}
disabled={!config}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.resumeLastSession)}
label={a.resumeLastSessionTitle}
onChange={update}
/>
@@ -362,9 +363,8 @@ interface TranslucencySliderProps {
function TranslucencySlider({ label, onChange, value }: TranslucencySliderProps) {
return (
<>
- <input
+ <Slider
aria-label={label}
- className="h-1 w-40 cursor-pointer appearance-none rounded-full bg-(--ui-stroke-tertiary)"
max={TRANSLUCENCY_MAX}
min={TRANSLUCENCY_MIN}
onBlur={endTranslucencyPeek}
@@ -381,8 +381,6 @@ function TranslucencySlider({ label, onChange, value }: TranslucencySliderProps)
onPointerDown={beginTranslucencyPeek}
onPointerUp={endTranslucencyPeek}
step={TRANSLUCENCY_STEP}
- style={{ accentColor: 'var(--dt-primary)' }}
- type="range"
value={value}
/>
<span className="w-9 text-right text-[length:var(--conversation-caption-font-size)] tabular-nums text-(--ui-text-tertiary)">
@@ -579,19 +577,27 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
{show('theme') && (
<ListRow
+ action={
+ <SegmentedControl
+ onChange={id => {
+ triggerHaptic('crisp')
+ setMode(id)
+ }}
+ options={modeOptions}
+ value={mode}
+ />
+ }
below={
<>
{/* One search box: filters your installed themes (the grid)
and live-searches the VS Code Marketplace below. */}
- <div className="mt-3">
- <input
- className="w-full rounded-lg border border-(--ui-stroke-tertiary) bg-(--ui-bg-quinary) px-3 py-1.5 text-[length:var(--conversation-caption-font-size)] outline-none placeholder:text-(--ui-text-tertiary) focus:border-(--ui-stroke-secondary)"
- onChange={event => setQuery(event.target.value)}
- placeholder={a.themeSearchPlaceholder}
- spellCheck={false}
- value={query}
- />
- </div>
+ <SearchField
+ containerClassName="mt-3 w-full"
+ inputClassName="flex-1"
+ onChange={setQuery}
+ placeholder={a.themeSearchPlaceholder}
+ value={query}
+ />
{/* The dedicated theme page uses the page scroller rather
than clipping its gallery inside another scroll area. */}
@@ -662,19 +668,7 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
}
description={a.themeDesc}
id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.theme)}
- title={
- <div className="flex items-center justify-between gap-3">
- <span>{a.themeTitle}</span>
- <SegmentedControl
- onChange={id => {
- triggerHaptic('crisp')
- setMode(id)
- }}
- options={modeOptions}
- value={mode}
- />
- </div>
- }
+ title={a.themeTitle}
wide
/>
)}
@@ -738,6 +732,7 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
/>
}
description={a.sessionDensityDesc}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.sessionDensity)}
title={a.sessionDensityTitle}
/>
)}
@@ -755,6 +750,7 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
/>
}
description={a.tabStripDesc}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.tabStrip)}
title={a.tabStripTitle}
/>
)}
@@ -906,65 +902,32 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
)}
{show('window-layout') && (
- <ListRow
- action={
- <SegmentedControl
- onChange={id => {
- triggerHaptic('selection')
- setBackdrop(id === 'on')
- }}
- options={[
- { id: 'off', label: t.common.off },
- { id: 'on', label: t.common.on }
- ]}
- value={backdrop ? 'on' : 'off'}
- />
- }
+ <ToggleRow
+ checked={backdrop}
description={a.backdropDesc}
id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.backdrop)}
- title={a.backdropTitle}
+ label={a.backdropTitle}
+ onChange={setBackdrop}
/>
)}
{show('chat-display') && (
- <ListRow
- action={
- <SegmentedControl
- onChange={id => {
- triggerHaptic('selection')
- setHideThreadTimeline(id === 'on')
- }}
- options={[
- { id: 'off', label: t.common.off },
- { id: 'on', label: t.common.on }
- ]}
- value={hideThreadTimeline ? 'on' : 'off'}
- />
- }
+ <ToggleRow
+ checked={hideThreadTimeline}
description={a.hideThreadTimelineDesc}
id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.hideThreadTimeline)}
- title={a.hideThreadTimelineTitle}
+ label={a.hideThreadTimelineTitle}
+ onChange={setHideThreadTimeline}
/>
)}
{show('general') && (
- <ListRow
- action={
- <SegmentedControl
- onChange={id => {
- triggerHaptic('selection')
- setIntroSplash(id === 'on')
- }}
- options={[
- { id: 'off', label: t.common.off },
- { id: 'on', label: t.common.on }
- ]}
- value={introSplash ? 'on' : 'off'}
- />
- }
+ <ToggleRow
+ checked={introSplash}
description={a.introSplashDesc}
id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.introSplash)}
- title={a.introSplashTitle}
+ label={a.introSplashTitle}
+ onChange={setIntroSplash}
/>
)}
@@ -972,6 +935,7 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
<ToggleRow
checked={composerPopoutGesturesEnabled}
description={a.composerPopoutDesc}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.composerPopout)}
label={a.composerPopoutTitle}
onChange={setComposerPopoutGesturesEnabled}
/>
@@ -980,98 +944,47 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
{show('general') && <ResumeLastSessionSetting />}
{show('chat-display') && (
- <ListRow
- action={
- <SegmentedControl
- onChange={id => {
- triggerHaptic('selection')
- setReactionsEnabled(id === 'on')
- }}
- options={[
- { id: 'off', label: t.common.off },
- { id: 'on', label: t.common.on }
- ]}
- value={reactionsEnabled ? 'on' : 'off'}
- />
- }
+ <ToggleRow
+ checked={reactionsEnabled}
description={a.reactionsDesc}
- title={a.reactionsTitle}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.reactions)}
+ label={a.reactionsTitle}
+ onChange={setReactionsEnabled}
/>
)}
{show('general') && (
- <ListRow
- action={
- <div className="flex flex-col items-end gap-1.5">
- <SegmentedControl
- onChange={id => {
- triggerHaptic('selection')
- setTipsEnabled(id === 'on')
- }}
- options={[
- { id: 'off', label: t.common.off },
- { id: 'on', label: t.common.on }
- ]}
- value={tipsEnabled ? 'on' : 'off'}
- />
- {/* A tip shows once (✕ or timer), so this is the only way to a
- second lap. It appears once there is something to bring back. */}
- {spentTips > 0 && (
- <Button
- onClick={() => {
- triggerHaptic('selection')
- resetTips()
- }}
- size="inline"
- variant="text"
- >
- {a.tipsReset(spentTips)}
- </Button>
- )}
- </div>
+ <ToggleRow
+ below={
+ // A tip shows once (✕ or timer), so this is the only way to a
+ // second lap. It appears once there is something to bring back.
+ spentTips > 0 && <RowFootnoteAction onClick={resetTips}>{a.tipsReset(spentTips)}</RowFootnoteAction>
}
+ checked={tipsEnabled}
description={a.tipsDesc}
- title={a.tipsTitle}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.tips)}
+ label={a.tipsTitle}
+ onChange={setTipsEnabled}
/>
)}
{show('general') && (
- <ListRow
- action={
- <SegmentedControl
- onChange={id => {
- triggerHaptic('selection')
- setToursEnabled(id === 'on')
- }}
- options={[
- { id: 'off', label: t.common.off },
- { id: 'on', label: t.common.on }
- ]}
- value={toursEnabled ? 'on' : 'off'}
- />
- }
+ <ToggleRow
+ checked={toursEnabled}
description={a.toursDesc}
- title={a.toursTitle}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.tours)}
+ label={a.toursTitle}
+ onChange={setToursEnabled}
/>
)}
{show('chat-display') && (
- <ListRow
- action={
- <SegmentedControl
- onChange={id => {
- triggerHaptic('selection')
- setVibeHeartsEnabled(id === 'on')
- }}
- options={[
- { id: 'off', label: t.common.off },
- { id: 'on', label: t.common.on }
- ]}
- value={vibeHeartsEnabled ? 'on' : 'off'}
- />
- }
+ <ToggleRow
+ checked={vibeHeartsEnabled}
description={a.vibeHeartsDesc}
- title={a.vibeHeartsTitle}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.vibeHearts)}
+ label={a.vibeHeartsTitle}
+ onChange={setVibeHeartsEnabled}
/>
)}
@@ -1094,23 +1007,22 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
)}
{show('chat-display') && (
- <ListRow
- action={
- <SegmentedControl
- onChange={id => {
- triggerHaptic('selection')
- setHideCodeDiffs(id === 'on')
- }}
- options={[
- { id: 'off', label: t.common.off },
- { id: 'on', label: t.common.on }
- ]}
- value={hideCodeDiffs ? 'on' : 'off'}
- />
- }
+ <ToggleRow
+ checked={hideCodeDiffs}
description={withModeNote(a.hideCodeDiffsDesc, hideCodeDiffsShadowed)}
id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.hideCodeDiffs)}
- title={a.hideCodeDiffsTitle}
+ label={a.hideCodeDiffsTitle}
+ onChange={setHideCodeDiffs}
+ />
+ )}
+
+ {show('chat-display') && (
+ <ToggleRow
+ checked={reasoningCollapsedByDefault}
+ description={withModeNote(a.reasoningCollapsedDesc, reasoningCollapsedShadowed)}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.reasoningCollapsed)}
+ label={a.reasoningCollapsedTitle}
+ onChange={setReasoningCollapsedByDefault}
/>
)}
@@ -1120,45 +1032,18 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
<SegmentedControl
onChange={id => {
triggerHaptic('selection')
- setReasoningCollapsedByDefault(id === 'on')
+ setEmbedMode(id)
}}
- options={[
- { id: 'off', label: t.common.off },
- { id: 'on', label: t.common.on }
- ]}
- value={reasoningCollapsedByDefault ? 'on' : 'off'}
+ options={embedOptions}
+ value={embedMode}
/>
}
- description={withModeNote(a.reasoningCollapsedDesc, reasoningCollapsedShadowed)}
- title={a.reasoningCollapsedTitle}
- />
- )}
-
- {show('chat-display') && (
- <ListRow
- action={
- <div className="flex flex-col items-end gap-1.5">
- <SegmentedControl
- onChange={id => {
- triggerHaptic('selection')
- setEmbedMode(id)
- }}
- options={embedOptions}
- value={embedMode}
- />
- {embedAllowed.length > 0 && (
- <Button
- onClick={() => {
- triggerHaptic('selection')
- clearEmbedAllowed()
- }}
- size="inline"
- variant="text"
- >
- {a.embedsReset(embedAllowed.length)}
- </Button>
- )}
- </div>
+ below={
+ embedAllowed.length > 0 && (
+ <RowFootnoteAction onClick={clearEmbedAllowed}>
+ {a.embedsReset(embedAllowed.length)}
+ </RowFootnoteAction>
+ )
}
description={a.embedsDesc}
id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.embeds)}
@@ -1169,7 +1054,10 @@ export function AppearanceSettings({ subpage }: AppearanceSettingsProps = {}) {
</div>
{show('pet') && (
- <div className={subpage === undefined ? 'mt-6' : undefined} id={appearanceSettingElementId('appearance.pet')}>
+ <div
+ className={subpage === undefined ? 'mt-6' : undefined}
+ id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.pet)}
+ >
<PetSettings />
</div>
)}
diff --git a/apps/desktop/src/app/settings/billing/account-row-value.tsx b/apps/desktop/src/app/settings/billing/account-row-value.tsx
index 4c54e4cbac7..9ab65424fb6 100644
--- a/apps/desktop/src/app/settings/billing/account-row-value.tsx
+++ b/apps/desktop/src/app/settings/billing/account-row-value.tsx
@@ -10,8 +10,9 @@ export function RowValue({ onAction, row }: { onAction?: () => void; row: Billin
// Destructure to a const so narrowing survives into the onClick closure below.
const { action } = row
+ // Rendered as a ListRow `action`; the row owns wrapping and alignment.
return (
- <div className="flex min-w-0 flex-wrap items-center justify-start gap-2 @2xl:justify-end">
+ <>
{row.value && (
<span className="min-w-0 truncate text-[length:var(--conversation-text-font-size)] font-medium text-foreground">
{row.value}
@@ -43,6 +44,6 @@ export function RowValue({ onAction, row }: { onAction?: () => void; row: Billin
{!action.disabled && action.url && <ExternalLink className="size-3.5" />}
</Button>
)}
- </div>
+ </>
)
}
diff --git a/apps/desktop/src/app/settings/billing/auto-reload-row.tsx b/apps/desktop/src/app/settings/billing/auto-reload-row.tsx
index d430945d1a4..4b75a4d99f7 100644
--- a/apps/desktop/src/app/settings/billing/auto-reload-row.tsx
+++ b/apps/desktop/src/app/settings/billing/auto-reload-row.tsx
@@ -6,7 +6,7 @@ import { Input } from '@/components/ui/input'
import { useI18n } from '@/i18n'
import { cn } from '@/lib/utils'
-import { ListRow, Pill } from '../primitives'
+import { LIST_ROW_COLUMNS, ListRow, Pill } from '../primitives'
import { RowValue } from './account-row-value'
import type { BillingRefusal } from './api'
@@ -168,7 +168,7 @@ export function AutoReloadRow({
// panes. The form is `invisible` + `aria-hidden` when not editing.
return (
<div className="@container">
- <div className="grid gap-3 py-3 @2xl:grid-cols-[minmax(0,1fr)_minmax(15rem,22rem)] @2xl:items-start">
+ <div className={cn('grid gap-3 py-3 @2xl:items-start', LIST_ROW_COLUMNS)}>
<div className="min-w-0">
<div className="text-[length:var(--conversation-text-font-size)] font-medium text-foreground">
{row.title}
diff --git a/apps/desktop/src/app/settings/billing/current-plan-card.tsx b/apps/desktop/src/app/settings/billing/current-plan-card.tsx
index 638aae97480..997adcffe3c 100644
--- a/apps/desktop/src/app/settings/billing/current-plan-card.tsx
+++ b/apps/desktop/src/app/settings/billing/current-plan-card.tsx
@@ -1,6 +1,9 @@
import { Button } from '@/components/ui/button'
import { useI18n } from '@/i18n'
import { ExternalLink } from '@/lib/icons'
+import { cn } from '@/lib/utils'
+
+import { LIST_ROW_COLUMNS } from '../primitives'
import { BillingRefusalInline } from './inline-feedback'
import { openExternal } from './open-external'
@@ -15,7 +18,7 @@ export function CurrentPlanCard({ onViewPlans, plan }: { onViewPlans: () => void
return (
<div className="@container">
- <div className="grid gap-3 py-3 @2xl:grid-cols-[minmax(0,1fr)_minmax(15rem,22rem)] @2xl:items-center">
+ <div className={cn('grid gap-3 py-3 @2xl:items-center', LIST_ROW_COLUMNS)}>
<div className="flex min-w-0 items-center gap-3">
<TierArt name={plan.tierName} />
<div className="min-w-0">
diff --git a/apps/desktop/src/app/settings/billing/index.tsx b/apps/desktop/src/app/settings/billing/index.tsx
index c97130dd438..2fe4760f649 100644
--- a/apps/desktop/src/app/settings/billing/index.tsx
+++ b/apps/desktop/src/app/settings/billing/index.tsx
@@ -195,7 +195,7 @@ function BuyCreditsRow({ billing, row }: { billing: BillingStateResponse; row: B
return (
<ListRow
action={
- <div className="flex min-w-0 flex-wrap items-center justify-start gap-2 @2xl:justify-end">
+ <>
<SegmentedControl
disabled={controlsDisabled}
onChange={value => setAmount(value)}
@@ -224,7 +224,7 @@ function BuyCreditsRow({ billing, row }: { billing: BillingStateResponse; row: B
<Button disabled={!canBuy} onClick={startBuy} size="xs" type="button" variant="secondary">
{b.buyCredits.buyButton}
</Button>
- </div>
+ </>
}
below={
<BuyCreditsOutcome
diff --git a/apps/desktop/src/app/settings/config-field.tsx b/apps/desktop/src/app/settings/config-field.tsx
index 08126bebf89..66818117068 100644
--- a/apps/desktop/src/app/settings/config-field.tsx
+++ b/apps/desktop/src/app/settings/config-field.tsx
@@ -2,7 +2,6 @@ import type { ReactNode } from 'react'
import { Input } from '@/components/ui/input'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
-import { Switch } from '@/components/ui/switch'
import { Textarea } from '@/components/ui/textarea'
import { useI18n } from '@/i18n'
import { prettyName } from '@/lib/text'
@@ -13,7 +12,7 @@ import { ComboboxInput } from './combobox-input'
import { CONTROL_TEXT, EMPTY_SELECT_VALUE, FIELD_DESCRIPTIONS, FIELD_LABELS, FREE_INPUT_KEYS } from './constants'
import { FallbackModelsField } from './fallback-models-field'
import { fieldCopyForSchemaKey } from './field-copy'
-import { ListRow } from './primitives'
+import { ListRow, ToggleRow } from './primitives'
import { SearchableSelect } from './searchable-select'
/**
@@ -81,22 +80,40 @@ export function ConfigField({
// Every config row is addressable by its canonical schema key, so a tour can
// point at one setting (`[data-tour="field-model"]`) without hunting through
// the section for an nth-child path. See lib/tour.
- const row = (action: ReactNode, wide = false) => (
- <ListRow action={action} data-tour={`field-${schemaKey}`} description={descriptionNode} title={label} wide={wide} />
+ const dataTour = `field-${schemaKey}`
+
+ const row = (action: ReactNode) => (
+ <ListRow action={action} data-tour={dataTour} description={descriptionNode} title={label} />
+ )
+
+ // Editors too big for the control column (textareas, structured lists) take
+ // the full width under the description.
+ const wideRow = (editor: ReactNode) => (
+ <ListRow
+ below={<div className="mt-3">{editor}</div>}
+ data-tour={dataTour}
+ description={descriptionNode}
+ title={label}
+ wide
+ />
)
// `fallback_providers` is a list of {provider, model} objects; the generic
// `list` branch below would stringify them to "[object Object]". Render the
// dedicated structured editor instead.
if (schemaKey === 'fallback_providers') {
- return row(<FallbackModelsField onChange={onChange} value={value} />, true)
+ return wideRow(<FallbackModelsField onChange={onChange} value={value} />)
}
if (schema.type === 'boolean') {
- return row(
- <div className="flex items-center justify-end">
- <Switch checked={Boolean(value)} onCheckedChange={onChange} />
- </div>
+ return (
+ <ToggleRow
+ checked={Boolean(value)}
+ data-tour={dataTour}
+ description={descriptionNode}
+ label={label}
+ onChange={onChange}
+ />
)
}
@@ -201,7 +218,7 @@ export function ConfigField({
}
if (typeof value === 'object' && value !== null) {
- return row(
+ return wideRow(
<Textarea
className={cn('min-h-28 resize-y bg-background font-mono', CONTROL_TEXT)}
onChange={e => {
@@ -214,29 +231,27 @@ export function ConfigField({
placeholder={c.notSet}
spellCheck={false}
value={JSON.stringify(value, null, 2)}
- />,
- true
+ />
)
}
const isLong = schema.type === 'text' || String(value ?? '').length > 100
- return row(
- isLong ? (
- <Textarea
- className={cn('min-h-24 resize-y bg-background', CONTROL_TEXT)}
- onChange={e => onChange(e.target.value)}
- placeholder={c.notSet}
- value={String(value ?? '')}
- />
- ) : (
- <Input
- className={CONTROL_TEXT}
- onChange={e => onChange(e.target.value)}
- placeholder={c.notSet}
- value={String(value ?? '')}
- />
- ),
- isLong
- )
+ return isLong
+ ? wideRow(
+ <Textarea
+ className={cn('min-h-24 resize-y bg-background', CONTROL_TEXT)}
+ onChange={e => onChange(e.target.value)}
+ placeholder={c.notSet}
+ value={String(value ?? '')}
+ />
+ )
+ : row(
+ <Input
+ className={CONTROL_TEXT}
+ onChange={e => onChange(e.target.value)}
+ placeholder={c.notSet}
+ value={String(value ?? '')}
+ />
+ )
}
diff --git a/apps/desktop/src/app/settings/credential-key-ui.tsx b/apps/desktop/src/app/settings/credential-key-ui.tsx
index cd22aed4748..ff017bde489 100644
--- a/apps/desktop/src/app/settings/credential-key-ui.tsx
+++ b/apps/desktop/src/app/settings/credential-key-ui.tsx
@@ -10,7 +10,7 @@ import type { EnvVarInfo } from '@/types/hermes'
import { CONTROL_TEXT } from './constants'
import { prettyName, withoutKey } from './helpers'
-import { ListRow } from './primitives'
+import { LIST_ROW_COLUMNS, ListRow } from './primitives'
import type { EnvRowProps } from './types'
export type KeyRowProps = Omit<EnvRowProps, 'info' | 'varKey'>
@@ -204,7 +204,7 @@ export function CredentialKeyCard({
{/* One CSS grid: 1 col stacked, 2 cols at @2xl. p-3 card padding = gap-3
row/col gaps, everything top-left aligned (items-start), no indents.
The label row is h-8 to line up with the input row beside it. */}
- <div className="grid grid-cols-1 items-start gap-x-3 gap-y-1.5 @2xl:grid-cols-[minmax(0,1fr)_minmax(15rem,22rem)] @2xl:gap-y-3">
+ <div className={cn('grid grid-cols-1 items-start gap-x-3 gap-y-1.5 @2xl:gap-y-3', LIST_ROW_COLUMNS)}>
<div className="flex h-8 min-w-0 items-center gap-2">
<span
className={cn('size-2 shrink-0 rounded-full', info.is_set ? 'bg-primary' : 'bg-(--ui-stroke-secondary)')}
@@ -290,7 +290,7 @@ export function ProviderKeyRows({ expanded, group, onExpand, onToggle, rowProps
>
{/* Same grid as CredentialKeyCard: 1 col stacked, 2 cols at @2xl, p-3 =
gap-3, items-start, label row h-8 to line up with the input row. */}
- <div className="grid grid-cols-1 items-start gap-x-3 gap-y-1.5 @2xl:grid-cols-[minmax(0,1fr)_minmax(15rem,22rem)] @2xl:gap-y-3">
+ <div className={cn('grid grid-cols-1 items-start gap-x-3 gap-y-1.5 @2xl:gap-y-3', LIST_ROW_COLUMNS)}>
<div className="flex h-8 min-w-0 items-center gap-2">
<span
className={cn(
diff --git a/apps/desktop/src/app/settings/local-models-settings.tsx b/apps/desktop/src/app/settings/local-models-settings.tsx
index b5ac9ffa005..c68babdb5ec 100644
--- a/apps/desktop/src/app/settings/local-models-settings.tsx
+++ b/apps/desktop/src/app/settings/local-models-settings.tsx
@@ -4,6 +4,7 @@ import { useNavigate } from 'react-router'
import { NEW_CHAT_ROUTE } from '@/app/routes'
import { Button } from '@/components/ui/button'
+import { SearchField } from '@/components/ui/search-field'
import { Tip } from '@/components/ui/tooltip'
import {
activateLocalModel,
@@ -1003,15 +1004,13 @@ function BrowseSection({ onChanged }: { onChanged: () => void }) {
<div id="local-model-browse">
<p className="text-[0.75rem] text-muted-foreground">{copy.browseHint}</p>
- <div className="relative">
- <Search className="pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" />
- <input
- className="w-full rounded-md border border-(--ui-border) bg-transparent py-1.5 pl-8 pr-3 text-[0.8rem] outline-none placeholder:text-muted-foreground focus:border-primary"
- onChange={e => setQuery(e.target.value)}
- placeholder={copy.browsePlaceholder}
- value={query}
- />
- </div>
+ <SearchField
+ containerClassName="w-full"
+ inputClassName="flex-1"
+ onChange={setQuery}
+ placeholder={copy.browsePlaceholder}
+ value={query}
+ />
{searching && (
<p className="flex items-center gap-2 text-[0.75rem] text-muted-foreground">
diff --git a/apps/desktop/src/app/settings/model-settings.tsx b/apps/desktop/src/app/settings/model-settings.tsx
index d1dc4d49745..c984f0a9115 100644
--- a/apps/desktop/src/app/settings/model-settings.tsx
+++ b/apps/desktop/src/app/settings/model-settings.tsx
@@ -43,7 +43,7 @@ import { PanelEmpty } from '../overlays/panel'
import { CONTROL_TEXT } from './constants'
import { getNested, setNested } from './helpers'
import { ModelSelect, withActive } from './model-select'
-import { ListRow, Pill, SectionHeading } from './primitives'
+import { ListRow, ListRowSkeleton, Pill, SectionHeading, SectionHeadingSkeleton } from './primitives'
import { useDeepLinkHighlight } from './use-deep-link-highlight'
// Skeleton mirror of the Model settings DOM so the page keeps its shape while
@@ -70,22 +70,10 @@ export function ModelSettingsSkeleton({ subpage }: Pick<ModelSettingsProps, 'sub
{(subpage === undefined || subpage === 'auxiliary' || subpage === 'moa') && (
<section>
- <div className="mb-2.5 flex items-center gap-2 pt-2">
- <Skeleton className="size-4" />
- <Skeleton className="h-4 w-36" />
- </div>
+ <SectionHeadingSkeleton />
<div className="grid gap-1">
{[0, 1, 2, 3].map(row => (
- <div
- className="grid gap-3 py-3 @2xl:grid-cols-[minmax(0,1fr)_minmax(15rem,22rem)] @2xl:items-center"
- key={row}
- >
- <div className="min-w-0 space-y-1.5">
- <Skeleton className="h-3.5 w-32" />
- <Skeleton className="h-3 w-52 max-w-full" />
- </div>
- <Skeleton className="h-8 w-full @2xl:justify-self-end @2xl:w-56" />
- </div>
+ <ListRowSkeleton key={row} />
))}
</div>
</section>
diff --git a/apps/desktop/src/app/settings/notifications-settings.tsx b/apps/desktop/src/app/settings/notifications-settings.tsx
index 86a24d4e8b6..6e6a0fefe3d 100644
--- a/apps/desktop/src/app/settings/notifications-settings.tsx
+++ b/apps/desktop/src/app/settings/notifications-settings.tsx
@@ -75,7 +75,7 @@ export function NotificationsSettings({ subpage }: NotificationsSettingsProps =
{showSounds && (
<ListRow
action={
- <div className="flex flex-wrap items-center justify-end gap-2">
+ <>
<Select
onValueChange={value => {
const variantId = Number.parseInt(value, 10)
@@ -112,7 +112,7 @@ export function NotificationsSettings({ subpage }: NotificationsSettingsProps =
<Play className="size-3.5" />
{copy.completionSoundPreview}
</Button>
- </div>
+ </>
}
description={copy.completionSoundDesc}
title={copy.completionSoundTitle}
diff --git a/apps/desktop/src/app/settings/pet-settings.tsx b/apps/desktop/src/app/settings/pet-settings.tsx
index 376af5e89fb..dd0615ee123 100644
--- a/apps/desktop/src/app/settings/pet-settings.tsx
+++ b/apps/desktop/src/app/settings/pet-settings.tsx
@@ -7,8 +7,9 @@ import { Button } from '@/components/ui/button'
import { ConfirmDialog } from '@/components/ui/confirm-dialog'
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { Input } from '@/components/ui/input'
-import { SegmentedControl } from '@/components/ui/segmented-control'
+import { SearchField } from '@/components/ui/search-field'
import { Skeleton } from '@/components/ui/skeleton'
+import { Slider } from '@/components/ui/slider'
import { Tip } from '@/components/ui/tooltip'
import { useI18n } from '@/i18n'
import { triggerHaptic } from '@/lib/haptics'
@@ -38,7 +39,7 @@ import {
} from '@/store/pet-gallery'
import { $gatewayState } from '@/store/session'
-import { ListRow, SectionHeading } from './primitives'
+import { ListRow, SectionHeading, ToggleRow } from './primitives'
/**
* Appearance opt-in for the floating petdex mascot. A thin view over the shared
@@ -128,14 +129,14 @@ export function PetSettings() {
)}
<div className="mt-2">
- <ListRow
+ <ToggleRow
below={
<>
- <input
- className="mt-3 w-full rounded-lg border border-(--ui-stroke-tertiary) bg-(--ui-bg-quinary) px-3 py-1.5 text-[length:var(--conversation-caption-font-size)] outline-none placeholder:text-(--ui-text-tertiary) focus:border-(--ui-stroke-secondary)"
- onChange={event => setQuery(event.target.value)}
+ <SearchField
+ containerClassName="mt-3 w-full"
+ inputClassName="flex-1"
+ onChange={setQuery}
placeholder={copy.searchPlaceholder}
- spellCheck={false}
value={query}
/>
{/* Fixed-height scroll area so filtering never grows/shrinks the
@@ -253,20 +254,10 @@ export function PetSettings() {
</p>
</>
}
+ checked={enabled}
description={copy.chooseDesc}
- title={
- <div className="flex items-center justify-between gap-3">
- <span>{copy.chooseTitle}</span>
- <SegmentedControl
- onChange={id => void toggle(id === 'on')}
- options={[
- { id: 'off', label: copy.off },
- { id: 'on', label: copy.on }
- ]}
- value={enabled ? 'on' : 'off'}
- />
- </div>
- }
+ label={copy.chooseTitle}
+ onChange={toggle}
wide
/>
@@ -274,9 +265,8 @@ export function PetSettings() {
<ListRow
action={
<div className="flex items-center gap-3">
- <input
+ <Slider
aria-label={copy.scaleTitle}
- className="h-1 w-40 cursor-pointer appearance-none rounded-full bg-(--ui-stroke-tertiary)"
max={PET_SCALE_MAX}
min={PET_SCALE_MIN}
onChange={event => {
@@ -284,8 +274,6 @@ export function PetSettings() {
setPetScale(requestGateway, Number(event.target.value))
}}
step={0.05}
- style={{ accentColor: 'var(--dt-primary)' }}
- type="range"
value={scale}
/>
<span className="w-9 text-right text-[length:var(--conversation-caption-font-size)] tabular-nums text-(--ui-text-tertiary)">
@@ -299,23 +287,7 @@ export function PetSettings() {
)}
{enabled && (
- <ListRow
- action={
- <SegmentedControl
- onChange={id => {
- setPetRoam(id === 'on')
- triggerHaptic('crisp')
- }}
- options={[
- { id: 'off', label: copy.off },
- { id: 'on', label: copy.on }
- ]}
- value={roam ? 'on' : 'off'}
- />
- }
- description={copy.roamDesc}
- title={copy.roamTitle}
- />
+ <ToggleRow checked={roam} description={copy.roamDesc} label={copy.roamTitle} onChange={setPetRoam} />
)}
</div>
diff --git a/apps/desktop/src/app/settings/primitives.tsx b/apps/desktop/src/app/settings/primitives.tsx
index 1bbe1f03af2..72edda00a02 100644
--- a/apps/desktop/src/app/settings/primitives.tsx
+++ b/apps/desktop/src/app/settings/primitives.tsx
@@ -140,6 +140,16 @@ export function NavLink({
)
}
+// The label/control split every settings-style row keys on. Rows that cannot
+// be a ListRow (expandable credential cards, the billing plan card with its
+// tier art) still lay out on these exact columns so their controls line up.
+export const LIST_ROW_COLUMNS = '@2xl:grid-cols-[minmax(0,1fr)_minmax(15rem,22rem)]'
+
+// The one settings row. `action` is the row's control: beside the label on a
+// wide pane, under the description on a narrow one — the row owns that
+// alignment, so callers never wrap a control in `justify-end`/`items-end`.
+// `wide` rows (galleries, editors) keep the control on the title line and give
+// the full width to `below`.
export function ListRow({
title,
description,
@@ -167,14 +177,12 @@ export function ListRow({
// the row's own pane width, so a narrow detail column (messaging, split
// views) stacks instead of squishing the label against minmax(15rem,…).
<div className={cn('@container', className)} data-tour={dataTour} id={id}>
- <div
- className={cn(
- 'grid gap-3 py-3',
- !wide && '@2xl:grid-cols-[minmax(0,1fr)_minmax(15rem,22rem)] @2xl:items-center'
- )}
- >
+ <div className={cn('grid gap-3 py-3', !wide && [LIST_ROW_COLUMNS, '@2xl:items-center'])}>
<div className="min-w-0">
- <div className="text-[length:var(--conversation-text-font-size)] font-medium text-foreground">{title}</div>
+ <div className="flex items-center justify-between gap-3 text-[length:var(--conversation-text-font-size)] font-medium text-foreground">
+ <span className="min-w-0">{title}</span>
+ {wide && action && <div className="flex shrink-0 items-center gap-2">{action}</div>}
+ </div>
{description && (
<div className="mt-1 text-[length:var(--conversation-caption-font-size)] leading-(--conversation-caption-line-height) text-(--ui-text-tertiary)">
{description}
@@ -183,25 +191,40 @@ export function ListRow({
{hint && <div className="mt-1 block font-mono text-[0.68rem] text-muted-foreground/45">{hint}</div>}
{below}
</div>
- {action && <div className={cn('min-w-0', !wide && '@2xl:justify-self-end')}>{action}</div>}
+ {!wide && action && (
+ <div className="flex min-w-0 flex-wrap items-center gap-2 @2xl:justify-self-end @2xl:justify-end">
+ {action}
+ </div>
+ )}
</div>
</div>
)
}
-// A labelled on/off row — the canonical device-pref switch (haptic baked in).
+// The one boolean row: every on/off setting is a Switch in a ListRow (haptic
+// baked in). Never a two-option SegmentedControl — that is for choices.
export function ToggleRow({
checked,
+ below,
+ 'data-tour': dataTour,
description,
disabled,
+ hint,
+ id,
label,
- onChange
+ onChange,
+ wide
}: {
checked: boolean
- description?: string
+ below?: ReactNode
+ 'data-tour'?: string
+ description?: ReactNode
disabled?: boolean
+ hint?: ReactNode
+ id?: string
label: string
onChange: (on: boolean) => void
+ wide?: boolean
}) {
return (
<ListRow
@@ -216,12 +239,37 @@ export function ToggleRow({
}}
/>
}
+ below={below}
+ data-tour={dataTour}
description={description}
+ hint={hint}
+ id={id}
title={label}
+ wide={wide}
/>
)
}
+// A quiet follow-up under a row's description ("Show 9 tips again", "Reset")
+// — the one place a row's secondary action lives, so it never floats beside
+// or under the control.
+export function RowFootnoteAction({ children, onClick }: { children: ReactNode; onClick: () => void }) {
+ return (
+ <div className="mt-1.5">
+ <Button
+ onClick={() => {
+ triggerHaptic('selection')
+ onClick()
+ }}
+ size="inline"
+ variant="text"
+ >
+ {children}
+ </Button>
+ </div>
+ )
+}
+
// Skeleton primitives mirroring the settings layout rhythm — a loading page keeps
// its shape (like ModelSettings) instead of collapsing to a centered spinner.
export function SectionHeadingSkeleton() {
@@ -236,12 +284,7 @@ export function SectionHeadingSkeleton() {
export function ListRowSkeleton({ wide = false }: { wide?: boolean }) {
return (
<div className="@container">
- <div
- className={cn(
- 'grid gap-3 py-3',
- !wide && '@2xl:grid-cols-[minmax(0,1fr)_minmax(15rem,22rem)] @2xl:items-center'
- )}
- >
+ <div className={cn('grid gap-3 py-3', !wide && [LIST_ROW_COLUMNS, '@2xl:items-center'])}>
<div className="min-w-0 space-y-1.5">
<Skeleton className="h-3.5 w-40 max-w-full" />
<Skeleton className="h-3 w-64 max-w-full" />
diff --git a/apps/desktop/src/components/ui/slider.tsx b/apps/desktop/src/components/ui/slider.tsx
new file mode 100644
index 00000000000..4fc313ec74d
--- /dev/null
+++ b/apps/desktop/src/components/ui/slider.tsx
@@ -0,0 +1,18 @@
+import type { ComponentProps } from 'react'
+
+import { cn } from '@/lib/utils'
+
+// The one range control: a hairline track in the app's stroke tint with the
+// native thumb in the primary accent. Settings rows compose it beside a
+// readout or inside a labelled group; nothing hand-rolls `type="range"`.
+export function Slider({ className, style, ...props }: Omit<ComponentProps<'input'>, 'type'>) {
+ return (
+ <input
+ className={cn('h-1 w-40 cursor-pointer appearance-none rounded-full bg-(--ui-stroke-tertiary)', className)}
+ data-slot="slider"
+ style={{ accentColor: 'var(--dt-primary)', ...style }}
+ type="range"
+ {...props}
+ />
+ )
+}
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index fb1b022ab7c..ba97c4976f7 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -692,8 +692,6 @@ export const ar = defineLocale({
'تبنَّ تعويذة petdex متحركة تطفو فوق التطبيق وتتفاعل مع ما يفعله Hermes — تجري أثناء تنفيذ الأدوات، وتحتفل عند النجاح، وتعبس عند الأخطاء.',
restartHint:
'تحتاج الحيوانات الأليفة إلى إعادة تشغيل سريعة — بدأ التطبيق العامل قبل إضافة هذه الميزة. أغلق Hermes وأعد فتحه، ثم ارجع إلى هنا.',
- on: 'تشغيل',
- off: 'إيقاف',
scaleTitle: 'الحجم',
scaleDesc: 'غيّر حجم التعويذة الطافية. يُطبّق في كل مكان فورا.',
chooseTitle: 'اختر حيوانا أليفا',
diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.ts
index 537a81dee47..90bb35927e3 100644
--- a/apps/desktop/src/i18n/de.ts
+++ b/apps/desktop/src/i18n/de.ts
@@ -1206,8 +1206,6 @@ export const de = defineLocale({
'Adoptieren Sie ein animiertes Petdex-Maskottchen, das über der App schwebt und darauf reagiert, was Hermes gerade tut – es rennt, während Tools laufen, feiert bei Erfolg und schmollt bei Fehlern.',
restartHint:
'Haustiere erfordern einen kurzen Neustart – die laufende App wurde gestartet, bevor diese Funktion hinzugefügt wurde. Schließen Sie Hermes, öffnen Sie es erneut und kehren Sie dann hierher zurück.',
- on: 'An',
- off: 'Aus',
scaleTitle: 'Größe',
scaleDesc: 'Ändert die Größe des schwebenden Maskottchens. Wirkt überall sofort.',
roamTitle: 'Herumstreifen',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 4a0b524887f..f3b10134d2c 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -1153,8 +1153,6 @@ export const en: Translations = {
'Adopt an animated petdex mascot that floats over the app and reacts to what Hermes is doing — running while tools execute, celebrating on success, sulking on errors.',
restartHint:
'Pets need a quick restart — the running app started before this feature was added. Quit and reopen Hermes, then come back here.',
- on: 'On',
- off: 'Off',
scaleTitle: 'Size',
scaleDesc: 'Resize the floating mascot. Applies everywhere instantly.',
roamTitle: 'Roam',
diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.ts
index 29c8c17bf60..6ba0efbcfe8 100644
--- a/apps/desktop/src/i18n/es.ts
+++ b/apps/desktop/src/i18n/es.ts
@@ -1204,8 +1204,6 @@ export const es = defineLocale({
'Adopta una mascota animada de petdex que flota sobre la app y reacciona a lo que hace Hermes: corre mientras se ejecutan herramientas, celebra los éxitos y se entristece con los errores.',
restartHint:
'Las mascotas necesitan un reinicio rápido: la aplicación en ejecución se inició antes de que se añadiera esta función. Cierra y vuelve a abrir Hermes y luego vuelve aquí.',
- on: 'Activada',
- off: 'Desactivada',
scaleTitle: 'Tamaño',
scaleDesc: 'Cambia el tamaño de la mascota flotante. Se aplica al instante en todas partes.',
roamTitle: 'Moverse libremente',
diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.ts
index 9304114b88a..c98390403bf 100644
--- a/apps/desktop/src/i18n/fr.ts
+++ b/apps/desktop/src/i18n/fr.ts
@@ -1208,8 +1208,6 @@ export const fr = defineLocale({
"Adoptez une mascotte petdex animée qui flotte au-dessus de l'application et réagit aux actions de Hermes — court pendant l'exécution des outils, fête les réussites, boude les erreurs.",
restartHint:
"Les animaux de compagnie nécessitent un redémarrage rapide — l'application en cours a démarré avant l'ajout de cette fonctionnalité. Fermez et rouvrez Hermes, puis revenez ici.",
- on: 'Activé',
- off: 'Désactivé',
scaleTitle: 'Taille',
scaleDesc: "Redimensionnez la mascotte flottante. S'applique partout instantanément.",
roamTitle: 'Errer',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 43fe2f80964..c8473aad89d 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -702,8 +702,6 @@ export const ja = defineLocale({
scaleDesc: '浮遊マスコットの大きさを変更します。すべての画面に即時反映されます。',
roamTitle: '散歩',
roamDesc: 'アイドル中にペットがウィンドウ内を自由に歩き回ります。',
- on: 'オン',
- off: 'オフ',
chooseTitle: 'ペットを選ぶ',
chooseDesc: '選ぶと(必要に応じて)インストールされ、アクティブになります。',
searchPlaceholder: 'ペットを検索…',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index 1d02c774512..a51e5925af7 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -724,8 +724,6 @@ export const ru = defineLocale({
'Заберите анимированного питомца из petdex, который парит над приложением и реагирует на действия Hermes — «бегает», пока выполняются инструменты, радуется успеху и хмурится при ошибках.',
restartHint:
'Питомцам нужен быстрый перезапуск — текущее приложение запустилось до появления этой функции. Выйдите из Hermes и откройте снова, затем вернитесь сюда.',
- on: 'Вкл',
- off: 'Выкл',
scaleTitle: 'Размер',
scaleDesc: 'Меняет размер парящего питомца. Применяется мгновенно везде.',
roamTitle: 'Блуждание',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 3ba61920765..6232a0187e9 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -952,8 +952,6 @@ export interface Translations {
title: string
intro: string
restartHint: string
- on: string
- off: string
scaleTitle: string
scaleDesc: string
roamTitle: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index 3e0194cf50b..bd728a4162e 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -643,8 +643,6 @@ export const zhHant = defineLocale({
scaleDesc: '調整懸浮寵物的大小,所有介面即時生效。',
roamTitle: '漫遊',
roamDesc: '閒置時讓寵物自己在視窗內四處走動。',
- on: '開啟',
- off: '關閉',
chooseTitle: '選擇寵物',
chooseDesc: '選擇後會自動安裝(如需)並設為目前寵物。',
searchPlaceholder: '搜尋寵物…',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 41eb6100dc8..163b2aae553 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -853,8 +853,6 @@ export const zh = defineLocale({
scaleDesc: '调整悬浮宠物的大小,所有界面即时生效。',
roamTitle: '漫游',
roamDesc: '空闲时让宠物自己在窗口内四处走动。',
- on: '开启',
- off: '关闭',
chooseTitle: '选择宠物',
chooseDesc: '选择后会自动安装(如需)并设为当前宠物。',
searchPlaceholder: '搜索宠物…',