Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(settings): rebuild the General settings page as one grouped reading column

rubenluetke10-beepbc4ec632682f
diff --git a/jarvis/ui/web/frontend/src/components/ui/switch.test.tsx b/jarvis/ui/web/frontend/src/components/ui/switch.test.tsx
index ce9289b759..ad39745821 100644
--- a/jarvis/ui/web/frontend/src/components/ui/switch.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/ui/switch.test.tsx
@@ -37,15 +37,15 @@ describe("Switch state legibility", () => {
expect(root.className).not.toContain("bg-card");
});
- it("rests OFF on the lift surface and ON on the life colour", () => {
+ it("rests OFF on the lift surface and ON on the accent", () => {
const { root } = renderSwitch(false);
expect(root.className).toContain("data-[state=unchecked]:bg-secondary");
- expect(root.className).toContain("data-[state=checked]:bg-success");
+ expect(root.className).toContain("data-[state=checked]:bg-accent");
});
it("keeps the thumb readable on both tracks without outshining the row", () => {
const { thumb } = renderSwitch(true);
- expect(thumb.className).toContain("data-[state=checked]:bg-primary-foreground");
+ expect(thumb.className).toContain("data-[state=checked]:bg-accent-foreground");
expect(thumb.className).toContain("data-[state=unchecked]:bg-muted-foreground");
// The brightest pixel in the row must never be an OFF switch.
expect(thumb.className).not.toContain("data-[state=unchecked]:bg-foreground");
diff --git a/jarvis/ui/web/frontend/src/components/ui/switch.tsx b/jarvis/ui/web/frontend/src/components/ui/switch.tsx
index 3f841c8d6f..a2e73bbe80 100644
--- a/jarvis/ui/web/frontend/src/components/ui/switch.tsx
+++ b/jarvis/ui/web/frontend/src/components/ui/switch.tsx
@@ -12,11 +12,11 @@ import { cn } from "@/lib/utils";
* painting the track --input over a near-identical ground.
*
* The states now sit on opposite sides of the system's own vocabulary: ON
- * takes --success, because "on" is the same fact as "running" and colour has
- * exactly three jobs; OFF takes --secondary, the lift surface, which is a
- * clear step above both the page and a card in either theme. The thumb is the
- * ink of whichever track it rides on, so the knob is always the readable part
- * and never the loudest.
+ * takes --accent, the one signal hue that already marks "selected" and
+ * "active" everywhere; OFF takes --secondary, the lift surface, which is a
+ * clear step above both the page and a card in either theme. ON carries a
+ * white thumb, OFF a meta-ink one, so the knob is always the readable part
+ * and an OFF switch is never the loudest mark in its row.
*/
const Switch = React.forwardRef<
React.ElementRef<typeof SwitchPrimitives.Root>,
@@ -25,7 +25,7 @@ const Switch = React.forwardRef<
<SwitchPrimitives.Root
className={cn(
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-strong focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
- "data-[state=checked]:bg-success data-[state=unchecked]:bg-secondary",
+ "data-[state=checked]:bg-accent data-[state=unchecked]:bg-secondary",
className,
)}
{...props}
@@ -35,9 +35,9 @@ const Switch = React.forwardRef<
className={cn(
"pointer-events-none block h-4 w-4 rounded-full ring-0 transition-transform duration-150",
"data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",
- // On the green track the thumb is the ink that sits on a fill; on the
- // grey track it is meta ink, visible without outshining the label.
- "data-[state=checked]:bg-primary-foreground data-[state=unchecked]:bg-muted-foreground",
+ // On the accent track the thumb is the ink that sits on the accent; on
+ // the grey track it is meta ink, visible without outshining the label.
+ "data-[state=checked]:bg-accent-foreground data-[state=unchecked]:bg-muted-foreground",
)}
/>
</SwitchPrimitives.Root>
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index b4b690120d..f1be04787f 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -2637,7 +2637,8 @@
"clear_search": "Suche löschen",
"group_general": "Allgemein",
"group_system": "System",
- "group_activity": "Aktivität"
+ "group_activity": "Aktivität",
+ "general": "Allgemein"
},
"settings_view": {
"silence_window": {
@@ -2707,6 +2708,7 @@
"overlay_taskbar": "Overlay & Taskleiste"
},
"languages_group_title": "Sprachen",
+ "sections": { "voice": "Stimme" },
"music_group_title": "Musik",
"music": {
"service_section": "Bevorzugter Dienst",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index a358caf0d2..04268fe7b1 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -2670,7 +2670,8 @@
"clear_search": "Clear search",
"group_general": "General",
"group_system": "System",
- "group_activity": "Activity"
+ "group_activity": "Activity",
+ "general": "General"
},
"settings_view": {
"silence_window": {
@@ -2740,6 +2741,7 @@
"overlay_taskbar": "Overlay & taskbar"
},
"languages_group_title": "Languages",
+ "sections": { "voice": "Voice" },
"music_group_title": "Music",
"music": {
"service_section": "Preferred service",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 1c439776c2..6a112c697e 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -2637,7 +2637,8 @@
"clear_search": "Borrar búsqueda",
"group_general": "General",
"group_system": "Sistema",
- "group_activity": "Actividad"
+ "group_activity": "Actividad",
+ "general": "General"
},
"settings_view": {
"silence_window": {
@@ -2707,6 +2708,7 @@
"overlay_taskbar": "Overlay y barra de tareas"
},
"languages_group_title": "Idiomas",
+ "sections": { "voice": "Voz" },
"music_group_title": "Música",
"music": {
"service_section": "Servicio preferido",
diff --git a/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx b/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx
index 4d3665ed97..d43583c45b 100644
--- a/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx
+++ b/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx
@@ -23,7 +23,7 @@ import { cn } from "@/lib/utils";
* page over the user's current section, with a searchable left navigation
* (General · System · Activity) and the selected section on the right:
*
- * General: Settings, Keyboard shortcuts, Appshots, My Pets, Profile,
+ * General: General, Keyboard shortcuts, Appshots, My Pets, Profile,
* {name} (the assistant), Contacts, Socials
* System: API Keys, Jarvis actions
* Activity: Spend, Feedback
@@ -37,6 +37,8 @@ import { cn } from "@/lib/utils";
*
* Labels, icons and grouping resolve from `NAV_GROUPS` (via `resolveNavLabel`,
* so all three locales behave exactly like the sidebar rows did) — no second hand-written list to drift (AP-4).
+ * One exception: inside the hub the "settings" entry reads "General", because
+ * the whole page already is Settings.
*
* Tab contents stay code-split one `lazy` boundary per view, so opening the
* hub still only pays for the shell plus the visible tab.
@@ -234,9 +236,11 @@ export function SettingsHubView({ onClose }: { onClose: () => void }) {
const { content, highlight } = resolveHubTab(active);
const Content = TAB_CONTENT[content];
+ const labelOf = (item: NavItem) =>
+ item.id === "settings" ? t("settings_hub.general") : resolveNavLabel(t, item);
const needle = query.trim().toLowerCase();
const matches = (item: NavItem) =>
- needle === "" || resolveNavLabel(t, item).toLowerCase().includes(needle);
+ needle === "" || labelOf(item).toLowerCase().includes(needle);
// Twelve entries — filtered inline; no memo needed at this size.
const visibleGroups = HUB_NAV_GROUPS.map((group) => ({
@@ -247,7 +251,7 @@ export function SettingsHubView({ onClose }: { onClose: () => void }) {
const pageMatches = searchSettingsPages(language, query, t)
.filter((match) => !visibleGroups.some((group) =>
group.items.some((item) => item.id === match.id)))
- .map((match) => ({ ...match, label: resolveNavLabel(t, findNavItem(match.id)) }));
+ .map((match) => ({ ...match, label: labelOf(findNavItem(match.id)) }));
// The health signal the sidebar row used to carry, now on the hub's own
// nav: a hard provider error on API Keys. Badge only, never a toast.
@@ -271,21 +275,21 @@ export function SettingsHubView({ onClose }: { onClose: () => void }) {
title={hint}
aria-current={isActive ? "page" : undefined}
className={cn(
- "group flex h-9 w-full items-center gap-2.5 rounded-md px-3 text-base font-medium transition-colors",
+ "group flex h-8 w-full items-center gap-2.5 rounded-md px-2.5 text-sm transition-colors",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
isActive
- ? "jarvis-nav-active bg-secondary text-foreground"
- : "text-muted-foreground hover:bg-secondary hover:text-foreground",
+ ? "bg-secondary font-medium text-foreground-strong"
+ : "text-foreground-secondary hover:bg-secondary hover:text-foreground",
)}
>
<Icon
aria-hidden
className={cn(
"h-4 w-4 shrink-0 transition-colors",
- isActive ? "text-foreground" : "text-muted-foreground group-hover:text-foreground",
+ isActive ? "text-foreground-strong" : "text-muted-foreground group-hover:text-foreground",
)}
/>
- <span className="min-w-0 flex-1 truncate text-left">{resolveNavLabel(t, item)}</span>
+ <span className="min-w-0 flex-1 truncate text-left">{labelOf(item)}</span>
{showAlert && (
<span
data-testid="settings-hub-alert-apikeys"
@@ -303,37 +307,40 @@ export function SettingsHubView({ onClose }: { onClose: () => void }) {
<div data-testid="settings-hub" className="flex h-full min-h-0 flex-col md:flex-row">
<aside
data-testid="settings-hub-sidebar"
- className="jarvis-nav-surface flex max-h-72 w-full shrink-0 flex-col border-b border-border md:max-h-none md:w-64 md:border-b-0"
+ className="jarvis-nav-surface flex max-h-72 w-full shrink-0 flex-col border-b border-border md:max-h-none md:w-60 md:border-b-0"
>
- <div className="px-3 pb-2 pt-3">
+ <div className="px-3 pb-1 pt-3">
{/* The page covers the whole window, so its way out sits where a
full-page settings screen keeps it: first in its own nav. */}
<button type="button" onClick={onClose} data-testid="settings-hub-close"
- className="mb-2 flex h-9 w-full items-center gap-2.5 rounded-md px-3 text-base font-medium text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
+ className="flex h-8 w-full items-center gap-2 rounded-md px-2.5 text-sm text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<ArrowLeft className="h-4 w-4 shrink-0" aria-hidden />
<span className="min-w-0 flex-1 truncate text-left">{t("settings_hub.back_to_app")}</span>
</button>
+ <p className="px-2.5 pb-3 pt-4 font-display text-lg font-semibold text-foreground-strong">
+ {t("nav.settings")}
+ </p>
<div className="relative">
- <Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden />
+ <Search className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" aria-hidden />
<input type="text" role="searchbox" data-testid="settings-hub-search" value={query} onChange={(event) => setQuery(event.target.value)}
onKeyDown={(event) => { if (event.key === "Escape") setQuery(""); }}
placeholder={t("settings_hub.search_placeholder")}
aria-label={t("settings_hub.search_placeholder")}
- className="h-9 w-full rounded-md border border-border bg-input pl-9 pr-9 text-base text-foreground placeholder:text-foreground-faint focus:border-accent focus:outline-none focus:ring-2 focus:ring-ring"
+ className="h-8 w-full rounded-md border border-transparent bg-secondary pl-8 pr-8 text-sm text-foreground placeholder:text-foreground-faint focus:border-accent focus:outline-none focus:ring-2 focus:ring-ring"
/>
{query && <button type="button" onClick={() => setQuery("")}
aria-label={t("settings_hub.clear_search")}
- className="absolute right-1 top-1/2 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
- <X className="h-4 w-4" aria-hidden />
+ className="absolute right-1 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
+ <X className="h-3.5 w-3.5" aria-hidden />
</button>}
</div>
</div>
<nav aria-label={t("nav.settings")}
className="min-h-0 flex-1 overflow-y-auto px-3 pb-5 scrollbar-jarvis">
- <ul className="space-y-1">
+ <ul>
{visibleGroups.map((group) => (
<li key={group.labelKey}>
- <p className="px-3 pb-1 pt-4 text-sm font-medium uppercase tracking-wide text-foreground-faint">
+ <p className="px-2.5 pb-1.5 pt-5 text-xs font-medium text-muted-foreground">
{t(group.labelKey)}
</p>
<ul className="space-y-0.5">{group.items.map(renderNavItem)}</ul>
@@ -342,7 +349,7 @@ export function SettingsHubView({ onClose }: { onClose: () => void }) {
</ul>
{pageMatches.length > 0 && (
<div data-testid="settings-hub-page-results">
- <p className="px-3 pb-1 pt-5 text-sm font-medium uppercase tracking-wide text-foreground-faint">
+ <p className="px-2.5 pb-1.5 pt-5 text-xs font-medium text-muted-foreground">
{t("settings_hub.search_pages")}
</p>
<ul className="space-y-0.5">
@@ -354,9 +361,9 @@ export function SettingsHubView({ onClose }: { onClose: () => void }) {
setQuery("");
setActive(match.id);
}}
- className="flex w-full flex-col rounded-md px-3 py-2 text-left transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
- <span className="text-base font-medium text-foreground">{match.label}</span>
- {match.detail && <span className="w-full truncate text-sm text-muted-foreground" title={match.detail}>{match.detail}</span>}
+ className="flex w-full flex-col rounded-md px-2.5 py-1.5 text-left transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
+ <span className="text-sm font-medium text-foreground">{match.label}</span>
+ {match.detail && <span className="w-full truncate text-xs text-muted-foreground" title={match.detail}>{match.detail}</span>}
</button>
</li>
))}
@@ -365,7 +372,7 @@ export function SettingsHubView({ onClose }: { onClose: () => void }) {
)}
{optionMatches.length > 0 && (
<div data-testid="settings-hub-option-results">
- <p className="px-3 pb-1 pt-5 text-sm font-medium uppercase tracking-wide text-foreground-faint">
+ <p className="px-2.5 pb-1.5 pt-5 text-xs font-medium text-muted-foreground">
{t("settings_hub.search_results")}
</p>
<ul className="space-y-0.5">
@@ -377,9 +384,9 @@ export function SettingsHubView({ onClose }: { onClose: () => void }) {
setQuery("");
setActive("settings");
}}
- className="flex w-full flex-col rounded-md px-3 py-2 text-left transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
- <span className="text-base font-medium text-foreground">{match.label}</span>
- {match.detail && <span className="w-full truncate text-sm text-muted-foreground" title={match.detail}>{match.detail}</span>}
+ className="flex w-full flex-col rounded-md px-2.5 py-1.5 text-left transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
+ <span className="text-sm font-medium text-foreground">{match.label}</span>
+ {match.detail && <span className="w-full truncate text-xs text-muted-foreground" title={match.detail}>{match.detail}</span>}
</button>
</li>
))}
@@ -387,7 +394,7 @@ export function SettingsHubView({ onClose }: { onClose: () => void }) {
</div>
)}
{needle && visibleGroups.length === 0 && pageMatches.length === 0 && optionMatches.length === 0 && (
- <p role="status" className="px-3 py-5 text-base text-muted-foreground">
+ <p role="status" className="px-2.5 py-5 text-sm text-muted-foreground">
{t("settings_hub.no_results")}
</p>
)}
diff --git a/jarvis/ui/web/frontend/src/views/SettingsView.tsx b/jarvis/ui/web/frontend/src/views/SettingsView.tsx
index 329eb038ea..fae6d6028c 100644
--- a/jarvis/ui/web/frontend/src/views/SettingsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/SettingsView.tsx
@@ -1,15 +1,7 @@
-import { useCallback, useEffect, useRef, useState } from "react";
-import {
- Settings,
- Mic,
- Loader2,
- Languages,
-} from "lucide-react";
-import { PageHeader } from "@/components/layout/PageHeader";
-import { cn } from "@/lib/utils";
+import { useEffect, useState } from "react";
+import { Loader2 } from "lucide-react";
import { Switch } from "@/components/ui/switch";
import { Button } from "@/components/ui/button";
-import { BrandedSelect } from "@/components/ui/select";
import { OverlayTaskbarGroup } from "@/views/settings/OverlayTaskbarGroup";
import { LanguagesGroup } from "@/views/settings/LanguagesGroup";
import { MusicGroup } from "@/views/settings/MusicGroup";
@@ -22,6 +14,14 @@ import { AudioDevicesGroup } from "@/views/settings/AudioDevicesGroup";
import { SystemPromptGroup } from "@/views/settings/SystemPromptGroup";
import { SettingsGroupBoundary } from "@/views/settings/SettingsGroupBoundary";
import { settingsInputCls } from "@/views/settings/SettingsBlock";
+import {
+ SettingsCard,
+ SettingsNote,
+ SettingsPage,
+ SettingsRow,
+ SettingsSection,
+ SettingsSelect,
+} from "@/views/settings/SettingsLayout";
import {
useWakeWord,
useLocalSpeechInstall,
@@ -60,49 +60,17 @@ interface WakeSelfTestResult {
hint: string;
}
-interface SettingRow {
- icon: React.ComponentType<{ className?: string }>;
- title: string;
- description: string;
- control?: React.ReactNode;
- value?: string;
-}
-
+/**
+ * The General settings page: one reading column of sections, each a heading
+ * over a grouped card. Every group is fault-isolated — one panel throwing
+ * costs that one panel, never the whole page. Section and row anchors keep the
+ * `settings-<id>` ids the hub search and the first-run guide scroll to.
+ */
export function SettingsView({ searchTarget, onSearchTargetHandled }: {
searchTarget?: string | null;
onSearchTargetHandled?: () => void;
} = {}) {
const t = useT();
- const scrollRef = useRef<HTMLDivElement>(null);
- const [activeSection, setActiveSection] = useState<string>(SECTIONS[0].id);
-
- // The nav follows the scroll: the topmost group intersecting the upper
- // third of the column is the active one.
- useEffect(() => {
- const root = scrollRef.current;
- if (!root || typeof IntersectionObserver === "undefined") return;
- const visible = new Map<string, number>();
- const observer = new IntersectionObserver(
- (entries) => {
- for (const entry of entries) {
- const id = (entry.target as HTMLElement).dataset.settingsSection ?? "";
- if (entry.isIntersecting) visible.set(id, entry.boundingClientRect.top);
- else visible.delete(id);
- }
- if (visible.size === 0) return;
- const [top] = [...visible.entries()].sort((a, b) => a[1] - b[1]);
- setActiveSection(top[0]);
- },
- { root, rootMargin: "0px 0px -66% 0px", threshold: 0 },
- );
- root.querySelectorAll<HTMLElement>("[data-settings-section]").forEach((el) => observer.observe(el));
- return () => observer.disconnect();
- }, []);
-
- const jumpTo = useCallback((id: string) => {
- setActiveSection(id);
- document.getElementById(`settings-${id}`)?.scrollIntoView({ block: "start", behavior: "smooth" });
- }, []);
useEffect(() => {
if (!searchTarget) return;
@@ -113,114 +81,74 @@ export function SettingsView({ searchTarget, onSearchTargetHandled }: {
}, [searchTarget, onSearchTargetHandled]);
return (
- <div className="flex h-full min-h-0 flex-col">
- <div className="px-8">
- <PageHeader
- icon={<Settings />}
- title={t("settings_view.title")}
- description={t("settings_view.subtitle")}
- className="pb-2"
- />
- </div>
- {/* Two columns (v4): a sticky section nav on the left, the groups as
- cards stretching across the remaining width on the right. Each group is fault-isolated:
- one panel throwing costs that one panel, never the whole page. */}
- <div
- data-testid="settings-scroll"
- className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis"
- ref={scrollRef}
- >
- <div className="flex gap-10 px-8 pb-12 pt-4">
- <SettingsSectionNav sections={SECTIONS} active={activeSection} onPick={jumpTo} />
- <div className="min-w-0 flex-1 space-y-10">
- {SECTIONS.map((section) => (
- <section
- key={section.id}
- id={`settings-${section.id}`}
- data-settings-section={section.id}
- data-tour={`settings-${section.id}`}
- className="scroll-mt-4"
- >
- <SettingsGroupBoundary group={section.id}>
- {section.render()}
- </SettingsGroupBoundary>
- </section>
- ))}
+ <div data-testid="settings-scroll" className="h-full min-h-0">
+ <SettingsPage title={t("settings_hub.general")}>
+ {SECTIONS.map((section) => (
+ <div
+ key={section.id}
+ id={`settings-${section.id}`}
+ data-settings-section={section.id}
+ data-tour={`settings-${section.id}`}
+ className="scroll-mt-6"
+ >
+ <SettingsGroupBoundary group={section.id}>
+ {section.render()}
+ </SettingsGroupBoundary>
</div>
- </div>
- </div>
+ ))}
+ </SettingsPage>
</div>
);
}
-/** The groups in page order; the nav on the left reads the same list. */
-const SECTIONS: readonly { id: string; labelKey: string; render: () => React.ReactNode }[] = [
- { id: "languages", labelKey: "settings_view.nav.languages", render: () => <LanguagesGroup /> },
- { id: "app", labelKey: "settings_view.nav.app", render: () => <AppSettingsGroup /> },
- { id: "permissions", labelKey: "settings_view.nav.permissions", render: () => <PermissionsPanel /> },
- { id: "realtime-voice", labelKey: "settings_view.nav.realtime_voice", render: () => <RealtimeVoiceGroup /> },
- { id: "system-prompt", labelKey: "settings_view.nav.system_prompt", render: () => <SystemPromptGroup /> },
- { id: "wake-word", labelKey: "settings_view.nav.wake_word", render: () => <WakeWordPanel /> },
- { id: "silence-window", labelKey: "settings_view.nav.silence_window", render: () => <SilenceWindowGroup /> },
- { id: "volume", labelKey: "settings_view.nav.volume", render: () => <VolumeGroup /> },
- { id: "audio-devices", labelKey: "settings_view.nav.audio_devices", render: () => <AudioDevicesGroup /> },
- { id: "music", labelKey: "settings_view.nav.music", render: () => <MusicGroup /> },
- { id: "more", labelKey: "settings_view.nav.more", render: () => <MoreSettings /> },
- { id: "overlay-taskbar", labelKey: "settings_view.nav.overlay_taskbar", render: () => <OverlayTaskbarGroup /> },
-];
-
-function SettingsSectionNav({
- sections,
- active,
- onPick,
-}: {
- sections: readonly { id: string; labelKey: string }[];
- active: string;
- onPick: (id: string) => void;
-}) {
+/**
+ * The voice rows share one card. Each keeps its own boundary and its own
+ * `settings-<id>` anchor, so search still lands on the exact row.
+ */
+function VoiceSettingsGroup() {
const t = useT();
return (
- <nav
- aria-label={t("settings_view.title")}
- data-testid="settings-section-nav"
- className="sticky top-0 hidden w-60 shrink-0 self-start lg:block"
- >
- <ul className="space-y-0.5">
- {sections.map((s) => {
- const isActive = s.id === active;
- return (
- <li key={s.id}>
- <button
- type="button"
- onClick={() => onPick(s.id)}
- aria-current={isActive ? "true" : undefined}
- className={cn(
- "flex h-8 w-full items-center rounded-md px-3 text-left text-base transition-colors",
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- isActive
- ? "jarvis-nav-active bg-secondary font-medium text-foreground"
- : "text-muted-foreground hover:bg-secondary hover:text-foreground",
- )}
- >
- {t(s.labelKey)}
- </button>
- </li>
- );
- })}
- </ul>
- </nav>
+ <SettingsSection title={t("settings_view.sections.voice")}>
+ <SettingsCard>
+ <SettingsGroupBoundary group="realtime-voice" inline>
+ <RealtimeVoiceGroup />
+ </SettingsGroupBoundary>
+ <SettingsGroupBoundary group="silence-window" inline>
+ <SilenceWindowGroup />
+ </SettingsGroupBoundary>
+ <SettingsGroupBoundary group="volume" inline>
+ <VolumeGroup />
+ </SettingsGroupBoundary>
+ <SettingsGroupBoundary group="audio-devices" inline>
+ <AudioDevicesGroup />
+ </SettingsGroupBoundary>
+ </SettingsCard>
+ </SettingsSection>
);
}
-function useMoreSettingRows(): SettingRow[] {
+/** The groups in page order. */
+const SECTIONS: readonly { id: string; render: () => React.ReactNode }[] = [
+ { id: "languages", render: () => <LanguagesGroup /> },
+ { id: "app", render: () => <AppSettingsGroup><AutopilotToastsRow /></AppSettingsGroup> },
+ { id: "voice", render: () => <VoiceSettingsGroup /> },
+ { id: "wake-word", render: () => <WakeWordPanel /> },
+ { id: "system-prompt", render: () => <SystemPromptGroup /> },
+ { id: "music", render: () => <MusicGroup /> },
+ { id: "overlay-taskbar", render: () => <OverlayTaskbarGroup /> },
+ { id: "permissions", render: () => <PermissionsPanel /> },
+];
+
+/** "Autopilot toasts" — the one row of the former "More" group. */
+function AutopilotToastsRow() {
const t = useT();
const [autopilotToasts, setAutopilotToasts] = useState(isAutopilotToastsEnabled);
- return [
- {
- icon: Settings,
- title: t("settings_view.rows.toasts_title"),
- description: t("settings_view.rows.toasts_description"),
- control: (
+ return (
+ <SettingsRow
+ id="settings-more"
+ title={t("settings_view.rows.toasts_title")}
+ description={t("settings_view.rows.toasts_description")}
+ control={
<Switch
checked={autopilotToasts}
aria-label={t("settings_view.rows.toasts_title")}
@@ -229,42 +157,8 @@ function useMoreSettingRows(): SettingRow[] {
setAutopilotToastsEnabled(next);
}}
/>
- ),
- },
- ];
-}
-
-function MoreSettings() {
- const rows = useMoreSettingRows();
- return (
- <ul className="space-y-3">
- {rows.map((r) => (
- <SettingRow key={r.title} row={r} />
- ))}
- </ul>
- );
-}
-
-function SettingRow({ row }: { row: SettingRow }) {
- const Icon = row.icon;
- return (
- <li className="flex items-center gap-3 rounded-lg border border-border bg-card p-block">
- {/* Secondary ink, never --primary: an icon that is brighter than the
- heading it labels inverts the ramp (rule 8). */}
- <Icon className="h-5 w-5 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="text-title font-semibold text-foreground-strong">
- {row.title}
- </div>
- <p className="mt-1 text-meta text-muted-foreground">{row.description}</p>
- </div>
- {row.value && (
- <span className="font-mono text-meta tabular-nums text-muted-foreground">
- {row.value}
- </span>
- )}
- {row.control}
- </li>
+ }
+ />
);
}
@@ -305,7 +199,7 @@ function LanguageDropdown({
disabled?: boolean;
}) {
return (
- <BrandedSelect
+ <SettingsSelect
value={value}
onValueChange={(code) => onChange(code as WakeLanguage)}
ariaLabel={placeholder}
@@ -510,142 +404,117 @@ function WakeWordPanel() {
}
}
- return (
- <div className="rounded-lg border border-border bg-card p-block">
- <div className="flex items-start gap-3">
- <Mic className="mt-0.5 h-5 w-5 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <h4 className="text-title font-semibold text-foreground-strong">
- {t("settings_view.wake_word.title")}
- </h4>
- <p className="mt-1 text-meta text-muted-foreground">
- {t("settings_view.wake_word.description")}
- </p>
+ const showResultNote = selfTest.state === "done" && selfTest.data;
- <div className="mt-block flex items-center justify-between gap-4">
- <span className="text-body text-foreground">
- {t("settings_view.wake_word.activation_title")}
- </span>
+ return (
+ <SettingsSection
+ title={t("settings_view.wake_word.title")}
+ description={t("settings_view.wake_word.description")}
+ >
+ <SettingsCard>
+ <SettingsRow
+ title={t("settings_view.wake_word.activation_title")}
+ description={t("settings_view.wake_word.activation_hint")}
+ control={
<Switch
checked={enabled}
disabled={loading || togglingActivation}
aria-label={t("settings_view.wake_word.activation_title")}
onCheckedChange={onToggleActivation}
/>
- </div>
- <p className="mt-1 text-meta text-muted-foreground">
- {t("settings_view.wake_word.activation_hint")}
- </p>
-
- {error && (
- <p className="mt-stack text-meta text-destructive">{error}</p>
- )}
-
- {/* Phrase input — free text, no quick-picks */}
- <label className="mt-block block text-meta text-muted-foreground">
- {t("settings_view.wake_word.phrase_label")}
- </label>
- <input
- value={phrase}
- onChange={(e) => setPhrase(e.target.value)}
- maxLength={64}
- placeholder={t("settings_view.wake_word.phrase_placeholder")}
- disabled={loading}
- className={settingsInputCls + " mt-1.5 disabled:opacity-50"}
- />
-
- {derivedName ? (
- <p className="mt-1.5 text-meta text-muted-foreground">
- {t("settings_view.wake_word.derived_name").replace("{0}", derivedName)}
- </p>
- ) : null}
-
- {/* LANGUAGE — deliberately prominent + over-explained. Picking the
- wrong language here is the #1 cause of a silently dead wake word,
- and the trap is unintuitive: it is about the language the user
- SPEAKS (their accent/pronunciation), NOT the origin of the word
- ("Ruben" is heard by the German model because the user speaks it
- in German, not because the name is German). Bound to the wake
- word's OWN language pin ([trigger.wake_word] language) — the app
- display language and the STT recognition language stay untouched,
- and neither can move this choice. */}
- {/* A lift surface inside the card — the step up the ladder that says
- "this one matters", drawn in fill rather than in a tinted rim.
- It used to be --primary at 5 % behind a --primary hairline with a
- --primary heading: white ink on a white wash, which made a piece
- of guidance the loudest mark on the page and read as a status it
- is not. Emphasis is the surface and the ink ceiling now. */}
- <div className="mt-block rounded-md bg-secondary p-4">
- <div className="flex items-center gap-2">
- <Languages className="h-4 w-4 shrink-0 text-muted-foreground" />
- <span className="text-title font-semibold text-foreground-strong">
- {t("settings_view.wake_word.language_label")}
- </span>
- </div>
- <p className="mt-1.5 text-body text-foreground">
- {t("settings_view.wake_word.language_callout_title")}
- </p>
- <div className="mt-stack">
- <LanguageDropdown
- value={wakeLang}
- options={WAKE_LANGUAGES}
- placeholder={t("settings_view.wake_word.language_placeholder")}
- labelFor={(code) => t(`languages_view.options.${code}.label`)}
- onChange={(code) => void onPickWakeLanguage(code)}
- disabled={loading}
- />
- </div>
- <p className="mt-stack text-meta text-muted-foreground">
- {t("settings_view.wake_word.language_hint")}
- </p>
- </div>
+ }
+ >
+ {error && <p className="text-sm text-destructive">{error}</p>}
+ </SettingsRow>
+
+ {/* Phrase input — free text, no quick-picks */}
+ <SettingsRow
+ title={t("settings_view.wake_word.phrase_label")}
+ description={
+ derivedName
+ ? t("settings_view.wake_word.derived_name").replace("{0}", derivedName)
+ : undefined
+ }
+ control={
+ <input
+ value={phrase}
+ onChange={(e) => setPhrase(e.target.value)}
+ maxLength={64}
+ placeholder={t("settings_view.wake_word.phrase_placeholder")}
+ aria-label={t("settings_view.wake_word.phrase_label")}
+ disabled={loading}
+ className={settingsInputCls + " h-8 w-56 disabled:opacity-50"}
+ />
+ }
+ />
- {/* Engine select */}
- <label className="mt-block block text-meta text-muted-foreground">
- {t("settings_view.wake_word.engine_label")}
- </label>
- <BrandedSelect
- value={engine}
- onValueChange={setEngine}
- ariaLabel={t("settings_view.wake_word.engine_label")}
- disabled={loading}
- className="mt-1"
- options={WAKE_ENGINES.map((wakeEngine) => ({
- value: wakeEngine,
- label: t(WAKE_ENGINE_I18N_KEY[wakeEngine]),
- }))}
- />
-
- {/* Custom ONNX model path */}
+ {/* LANGUAGE — the #1 cause of a silently dead wake word is picking
+ the wrong one, and the trap is unintuitive: it is the language the
+ user SPEAKS (their pronunciation), NOT the origin of the word
+ ("Ruben" is heard by the German model because the user speaks it
+ in German). Bound to the wake word's OWN language pin
+ ([trigger.wake_word] language) — the app display language and the
+ STT recognition language stay untouched, and neither can move
+ this choice. */}
+ <SettingsRow
+ title={t("settings_view.wake_word.language_label")}
+ description={t("settings_view.wake_word.language_callout_title")}
+ control={
+ <LanguageDropdown
+ value={wakeLang}
+ options={WAKE_LANGUAGES}
+ placeholder={t("settings_view.wake_word.language_placeholder")}
+ labelFor={(code) => t(`languages_view.options.${code}.label`)}
+ onChange={(code) => void onPickWakeLanguage(code)}
+ disabled={loading}
+ />
+ }
+ >
+ <p className="text-sm text-muted-foreground">
+ {t("settings_view.wake_word.language_hint")}
+ </p>
+ </SettingsRow>
+
+ <SettingsRow
+ title={t("settings_view.wake_word.engine_label")}
+ control={
+ <SettingsSelect
+ value={engine}
+ onValueChange={setEngine}
+ ariaLabel={t("settings_view.wake_word.engine_label")}
+ disabled={loading}
+ options={WAKE_ENGINES.map((wakeEngine) => ({
+ value: wakeEngine,
+ label: t(WAKE_ENGINE_I18N_KEY[wakeEngine]),
+ }))}
+ />
+ }
+ >
{engine === "custom_onnx" && (
- <>
- <label className="mt-block block text-meta text-muted-foreground">
+ <label className="block">
+ <span className="mb-1.5 block text-sm text-muted-foreground">
{t("settings_view.wake_word.custom_model_path_label")}
- </label>
+ </span>
<input
value={customModelPath}
onChange={(e) => setCustomModelPath(e.target.value)}
placeholder="C:\\Users\\...\\my_wakeword.onnx"
disabled={loading}
- className={settingsInputCls + " mt-1.5 font-mono text-meta disabled:opacity-50"}
+ className={settingsInputCls + " font-mono text-sm disabled:opacity-50"}
/>
- </>
+ </label>
)}
{/* Any-phrase enablement: install the local speech pack in-app so
an arbitrary wake word works, instead of silently degrading. */}
{showNeedsWhisperHint && (
- <div className="mt-stack rounded-md bg-secondary p-4 text-body text-foreground">
+ <SettingsNote>
<p className="text-warning">
{t("settings_view.wake_word.needs_whisper_hint")}
</p>
{installStatus.state === "idle" && (
- <Button
- size="sm"
- className="mt-stack"
- onClick={() => void install()}
- >
+ <Button size="sm" className="mt-stack" onClick={() => void install()}>
{t("settings_view.wake_word.enable_local_button")}
</Button>
)}
@@ -665,11 +534,7 @@ function WakeWordPanel() {
{installStatus.message}
</p>
)}
- <Button
- size="sm"
- className="mt-stack"
- onClick={() => void install()}
- >
+ <Button size="sm" className="mt-stack" onClick={() => void install()}>
{t("settings_view.wake_word.enable_local_retry")}
</Button>
</div>
@@ -680,73 +545,39 @@ function WakeWordPanel() {
{t("settings_view.wake_word.enable_local_done")}
</p>
)}
- </div>
+ </SettingsNote>
)}
-
- {/* Save + Test buttons */}
- <div className="mt-block flex items-center gap-3">
- <Button
- size="sm"
- onClick={onSave}
- disabled={saving || loading || !trimmedPhrase}
- >
- {saving
- ? t("settings_view.saving")
- : t("settings_view.wake_word.save")}
- </Button>
- <Button
- size="sm"
- variant="outline"
- onClick={() => void onSelfTest()}
- disabled={selfTest.state === "running" || loading || !trimmedPhrase}
- >
- {selfTest.state === "running" ? (
- <span className="flex items-center gap-2">
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
- {t("settings_view.wake_word.self_test_running")}
- </span>
- ) : (
- t("settings_view.wake_word.self_test_button")
- )}
- </Button>
- </div>
-
- {/* Self-test result — honest readiness verdict (engine + language +
- vocabulary + mic), the fast way to see WHY a word won't wake. */}
- {selfTest.state === "done" && selfTest.data && (
- /* One surface for both verdicts, the verdict carried by the status
- ink on the sentence. A pass used to be a --primary wash and a
- fail a --foreground wash: two brightness washes standing in for
- a meaning that colour states directly, on a ground where neither
- was legible as a state at all. */
- <div className="mt-stack rounded-md bg-secondary p-4 text-body">
- <p
- className={
- selfTest.data.ok ? "text-success" : "text-destructive"
- }
- >
+ </SettingsRow>
+
+ {/* Save + Test, then the honest verdicts they produce. */}
+ <div className="space-y-3 px-4 py-3.5">
+ {/* Self-test result — readiness verdict (engine + language +
+ vocabulary + mic), the fast way to see WHY a word won't wake.
+ One surface for both verdicts; the status ink carries it. */}
+ {showResultNote && selfTest.data && (
+ <SettingsNote>
+ <p className={selfTest.data.ok ? "text-success" : "text-destructive"}>
{selfTest.data.message}
</p>
{selfTest.data.hint && (
<p className="mt-1 text-muted-foreground">{selfTest.data.hint}</p>
)}
- <p className="mt-1 font-mono text-meta text-muted-foreground">
+ <p className="mt-1 font-mono text-xs text-muted-foreground">
engine: {selfTest.data.engine} · language: {selfTest.data.language}
{selfTest.data.phrase_in_vocab === false ? " · not in vocabulary" : ""}
{selfTest.data.mic_ok ? "" : " · mic quiet"}
</p>
- </div>
+ </SettingsNote>
)}
- {/* Save result */}
{result && (
- <div className="mt-stack rounded-md bg-secondary p-4 text-body">
+ <SettingsNote>
<p className={result.degraded ? "text-warning" : "text-success"}>
{result.degraded
? t("settings_view.wake_word.degraded_warning")
: result.message}
</p>
- <p className="mt-1 font-mono text-meta text-muted-foreground">
+ <p className="mt-1 font-mono text-xs text-muted-foreground">
engine: {result.resolved_engine}
</p>
{result.degraded && result.message && (
@@ -758,17 +589,12 @@ function WakeWordPanel() {
</p>
)}
- {/* In-app recovery for the degraded ("stt_match only") scenario:
- wires the backend's own suggestion (Settings -> Wake word ->
- "Download wake model") to a real button instead of a
- CLI/API-only route. */}
+ {/* In-app recovery for the degraded ("stt_match only")
+ scenario: the backend's own suggestion as a real button. */}
{result.degraded && (
<div className="mt-stack">
{wakeModelDownload.state === "idle" && (
- <Button
- size="sm"
- onClick={() => void onDownloadWakeModel()}
- >
+ <Button size="sm" onClick={() => void onDownloadWakeModel()}>
{t("settings_view.wake_word.download_model_button")}
</Button>
)}
@@ -804,11 +630,38 @@ function WakeWordPanel() {
)}
</div>
)}
- </div>
+ </SettingsNote>
)}
+
+ <div className="flex flex-wrap items-center justify-end gap-2">
+ <Button
+ size="sm"
+ variant="ghost"
+ onClick={() => void onSelfTest()}
+ disabled={selfTest.state === "running" || loading || !trimmedPhrase}
+ >
+ {selfTest.state === "running" ? (
+ <>
+ <Loader2 className="animate-spin" />
+ {t("settings_view.wake_word.self_test_running")}
+ </>
+ ) : (
+ t("settings_view.wake_word.self_test_button")
+ )}
+ </Button>
+ <Button
+ size="sm"
+ onClick={onSave}
+ disabled={saving || loading || !trimmedPhrase}
+ >
+ {saving
+ ? t("settings_view.saving")
+ : t("settings_view.wake_word.save")}
+ </Button>
+ </div>
</div>
- </div>
- </div>
+ </SettingsCard>
+ </SettingsSection>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.test.tsx b/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.test.tsx
index 6345c21196..065ae536d5 100644
--- a/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.test.tsx
@@ -89,7 +89,7 @@ describe("AppSettingsGroup", () => {
// Once GET resolves, the switch reflects the enabled config and is enabled.
await waitFor(() => {
- const sw = screen.getByRole("switch");
+ const sw = screen.getByRole("switch", { name: "Launch app at login" });
expect(sw.getAttribute("aria-checked")).toBe("true");
expect(sw.hasAttribute("disabled")).toBe(false);
});
@@ -103,7 +103,7 @@ describe("AppSettingsGroup", () => {
render(<AppSettingsGroup />);
await waitFor(() => {
- const sw = screen.getByRole("switch");
+ const sw = screen.getByRole("switch", { name: "Launch app at login" });
expect(sw.hasAttribute("disabled")).toBe(true);
});
expect(
@@ -165,7 +165,7 @@ describe("AppSettingsGroup", () => {
vi.stubGlobal("fetch", fetchMock);
render(<AppSettingsGroup />);
- const sw = await waitFor(() => screen.getByRole("switch"));
+ const sw = await waitFor(() => screen.getByRole("switch", { name: "Launch app at login" }));
fireEvent.click(sw);
await waitFor(() => {
diff --git a/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx
index b210e9b3ea..d23bd2cd34 100644
--- a/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx
@@ -1,12 +1,20 @@
-import { useState } from "react";
-import { Bot, Compass, Monitor, Moon, Power, Sun, Zap } from "lucide-react";
+import { useState, type ReactNode } from "react";
+import { Monitor, Moon, Sun, Zap } from "lucide-react";
import { SETUP_REPLAY_EVENT } from "@/components/onboarding/tourEvents";
+import { Button } from "@/components/ui/button";
import { Switch } from "@/components/ui/switch";
import { useAutostart } from "@/hooks/useAutostart";
import { useBackgroundAgents, type BackgroundAgentsPatch } from "@/hooks/useBackgroundAgents";
import { useTheme, type ThemePreference } from "@/hooks/useTheme";
import { useEventStore } from "@/store/events";
import { fill, useLocaleChunk, useT } from "@/i18n";
+import {
+ SettingsCard,
+ SettingsNote,
+ SettingsRow,
+ SettingsSection,
+ SettingsSegmented,
+} from "@/views/settings/SettingsLayout";
/**
* "App settings" group inside the Settings view. Currently hosts the
@@ -21,19 +29,19 @@ import { fill, useLocaleChunk, useT } from "@/i18n";
* into. The toggle still persists the intent in that case (it just cannot create
* an OS entry there).
*/
-export function AppSettingsGroup() {
+export function AppSettingsGroup({ children }: { children?: ReactNode } = {}) {
const t = useT();
return (
- <div className="mt-8 space-y-4">
- <h3 className="text-lg font-semibold text-foreground-strong">
- {t("settings_view.app_settings_group_title")}
- </h3>
- <AppearanceRow />
- <AutostartRow />
- <BackgroundAgentsRow />
- <TourRow />
- </div>
+ <SettingsSection title={t("settings_view.app_settings_group_title")}>
+ <SettingsCard>
+ <AppearanceRow />
+ <AutostartRow />
+ <BackgroundAgentsRows />
+ {children}
+ <TourRow />
+ </SettingsCard>
+ </SettingsSection>
);
}
@@ -47,25 +55,20 @@ function TourRow() {
const ready = useLocaleChunk("onboarding");
if (!ready) return null;
return (
- <div className="rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <Compass className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="flex flex-wrap items-center justify-between gap-3">
- <h4 className="font-medium">{t("app_tour.replay_title")}</h4>
- <button
- type="button"
- onClick={() => window.dispatchEvent(new CustomEvent(SETUP_REPLAY_EVENT))}
- data-testid="settings-replay-tour"
- className="inline-flex items-center rounded-md border border-border bg-background px-2.5 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- >
- {t("app_tour.replay")}
- </button>
- </div>
- <p className="mt-0.5 text-xs text-muted-foreground">{t("app_tour.replay_body")}</p>
- </div>
- </div>
- </div>
+ <SettingsRow
+ title={t("app_tour.replay_title")}
+ description={t("app_tour.replay_body")}
+ control={
+ <Button
+ size="sm"
+ variant="secondary"
+ onClick={() => window.dispatchEvent(new CustomEvent(SETUP_REPLAY_EVENT))}
+ data-testid="settings-replay-tour"
+ >
+ {t("app_tour.replay")}
+ </Button>
+ }
+ />
);
}
@@ -93,59 +96,30 @@ function AppearanceRow() {
const { preference, theme, setPreference } = useTheme();
return (
- <div className="rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- {theme === "dark" ? (
- <Moon className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- ) : (
- <Sun className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- )}
- <div className="min-w-0 flex-1">
- <div className="flex flex-wrap items-center justify-between gap-3">
- <h4 className="font-medium">{t("settings_view.appearance.title")}</h4>
- <div
- role="radiogroup"
- aria-label={t("settings_view.appearance.title")}
- className="inline-flex rounded-lg border border-border bg-background p-0.5"
- >
- {THEME_OPTIONS.map(({ value, icon: Icon, labelKey }) => {
- const active = preference === value;
- return (
- <button
- key={value}
- type="button"
- role="radio"
- aria-checked={active}
- onClick={() => setPreference(value)}
- className={
- "inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors " +
- (active
- ? "bg-primary text-primary-foreground"
- : "text-muted-foreground hover:bg-secondary hover:text-foreground")
- }
- >
- <Icon className="h-3.5 w-3.5" />
- {t(labelKey)}
- </button>
- );
- })}
- </div>
- </div>
- <p className="mt-0.5 text-xs text-muted-foreground">
- {t("settings_view.appearance.description")}
- </p>
- {preference === "system" && (
- <p className="mt-2 text-xs text-muted-foreground">
- {t(
- theme === "dark"
- ? "settings_view.appearance.system_now_dark"
- : "settings_view.appearance.system_now_light",
- )}
- </p>
- )}
- </div>
- </div>
- </div>
+ <SettingsRow
+ title={t("settings_view.appearance.title")}
+ description={
+ preference === "system"
+ ? `${t("settings_view.appearance.description")} ${t(
+ theme === "dark"
+ ? "settings_view.appearance.system_now_dark"
+ : "settings_view.appearance.system_now_light",
+ )}`
+ : t("settings_view.appearance.description")
+ }
+ control={
+ <SettingsSegmented
+ value={preference}
+ onChange={setPreference}
+ ariaLabel={t("settings_view.appearance.title")}
+ options={THEME_OPTIONS.map(({ value, icon: Icon, labelKey }) => ({
+ value,
+ label: t(labelKey),
+ icon: <Icon aria-hidden />,
+ }))}
+ />
+ }
+ />
);
}
@@ -208,63 +182,63 @@ function AutostartRow() {
}
}
- return (
- <div className="rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <Power className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="flex items-center justify-between gap-4">
- <h4 className="font-medium">{t("settings_view.autostart.title")}</h4>
- <Switch
- checked={enabled}
- disabled={loading || saving || !supported}
- aria-label={t("settings_view.autostart.title")}
- onCheckedChange={onToggle}
- />
- </div>
- <p className="mt-0.5 text-xs text-muted-foreground">
- {t("settings_view.autostart.description")}
- </p>
+ const hasDetails = Boolean(
+ error ||
+ (!supported && !loading) ||
+ instantStartActive ||
+ canUpgradeInstantStart ||
+ (supported && config?.entry_path),
+ );
- {error && <p className="mt-3 text-xs text-destructive">{error}</p>}
+ return (
+ <SettingsRow
+ title={t("settings_view.autostart.title")}
+ description={t("settings_view.autostart.description")}
+ control={
+ <Switch
+ checked={enabled}
+ disabled={loading || saving || !supported}
+ aria-label={t("settings_view.autostart.title")}
+ onCheckedChange={onToggle}
+ />
+ }
+ >
+ {hasDetails && (
+ <>
+ {error && <p className="text-sm text-destructive">{error}</p>}
{!supported && !loading && (
- <p className="mt-3 text-xs text-foreground">
+ <p className="text-sm text-foreground">
{config?.detail || t("settings_view.autostart.unsupported")}
</p>
)}
{instantStartActive && (
- <p className="mt-3 text-xs text-muted-foreground">
+ <p className="text-sm text-muted-foreground">
{t("settings_view.autostart.instant_start_active")}
</p>
)}
{canUpgradeInstantStart && (
- <div className="mt-3 rounded-md border border-border bg-background p-3">
- <p className="text-xs text-muted-foreground">
+ <SettingsNote className="flex flex-wrap items-center justify-between gap-3">
+ <span className="min-w-0 flex-1 text-muted-foreground">
{t("settings_view.autostart.instant_start_hint")}
- </p>
- <button
- type="button"
- disabled={saving}
- onClick={onEnableInstantStart}
- className="mt-2 inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50"
- >
- <Zap className="h-3.5 w-3.5" />
+ </span>
+ <Button size="sm" disabled={saving} onClick={onEnableInstantStart}>
+ <Zap aria-hidden />
{t("settings_view.autostart.enable_instant_start")}
- </button>
- </div>
+ </Button>
+ </SettingsNote>
)}
{supported && config?.entry_path && (
- <p className="mt-2 break-all font-mono text-micro text-muted-foreground">
+ <p className="break-all font-mono text-xs text-muted-foreground">
{config.entry_path}
</p>
)}
- </div>
- </div>
- </div>
+ </>
+ )}
+ </SettingsRow>
);
}
@@ -273,10 +247,10 @@ const CHANNEL_LABELS: Record<string, string> = { telegram: "Telegram", discord:
/**
* "Keep agents running after closing": on quit the app hands routines and chat
* channels to a windowless background service, which hands them back when the
- * app opens again. The second switch makes the login entry start only that
- * service. The line below says what a quit would keep right now.
+ * app opens again. The second row makes the login entry start only that
+ * service. The line under the first says what a quit would keep right now.
*/
-function BackgroundAgentsRow() {
+function BackgroundAgentsRows() {
const t = useT();
const { config, loading, error, save } = useBackgroundAgents();
const pushToast = useEventStore((s) => s.pushToast);
@@ -305,57 +279,51 @@ function BackgroundAgentsRow() {
for (const channel of work?.channels ?? []) parts.push(CHANNEL_LABELS[channel] ?? channel);
return (
- <div className="rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <Bot className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="flex items-center justify-between gap-4">
- <h4 className="font-medium">{t("settings_view.background_agents.title")}</h4>
- <Switch
- checked={keep}
- disabled={loading || saving}
- aria-label={t("settings_view.background_agents.title")}
- onCheckedChange={(next) => void apply({ keep_agents_running: next })}
- />
- </div>
- <p className="mt-0.5 text-xs text-muted-foreground">
- {t("settings_view.background_agents.description")}
- </p>
-
- {error && <p className="mt-3 text-xs text-destructive">{error}</p>}
-
- {config?.running_as_service && (
- <p className="mt-3 text-xs text-foreground">
- {t("settings_view.background_agents.service_active")}
- </p>
- )}
+ <>
+ <SettingsRow
+ title={t("settings_view.background_agents.title")}
+ description={t("settings_view.background_agents.description")}
+ control={
+ <Switch
+ checked={keep}
+ disabled={loading || saving}
+ aria-label={t("settings_view.background_agents.title")}
+ onCheckedChange={(next) => void apply({ keep_agents_running: next })}
+ />
+ }
+ >
+ {(error || config?.running_as_service || (config && keep)) && (
+ <>
+ {error && <p className="text-sm text-destructive">{error}</p>}
- {config && keep && !config.running_as_service && (
- <p className="mt-3 text-xs text-muted-foreground">
- {parts.length > 0
- ? fill(t("settings_view.background_agents.keeps_now"), { what: parts.join(", ") })
- : t("settings_view.background_agents.keeps_nothing")}
- </p>
- )}
-
- <div className="mt-3 flex items-center justify-between gap-4 rounded-md border border-border bg-background p-3">
- <div className="min-w-0">
- <p className="text-xs font-medium">
- {t("settings_view.background_agents.login_title")}
+ {config?.running_as_service && (
+ <p className="text-sm text-foreground">
+ {t("settings_view.background_agents.service_active")}
</p>
- <p className="mt-0.5 text-xs text-muted-foreground">
- {t("settings_view.background_agents.login_description")}
+ )}
+
+ {config && keep && !config.running_as_service && (
+ <p className="text-sm text-muted-foreground">
+ {parts.length > 0
+ ? fill(t("settings_view.background_agents.keeps_now"), { what: parts.join(", ") })
+ : t("settings_view.background_agents.keeps_nothing")}
</p>
- </div>
- <Switch
- checked={config?.background_only_at_login ?? false}
- disabled={loading || saving || !config?.autostart_enabled}
- aria-label={t("settings_view.background_agents.login_title")}
- onCheckedChange={(next) => void apply({ background_only_at_login: next })}
- />
- </div>
- </div>
- </div>
- </div>
+ )}
+ </>
+ )}
+ </SettingsRow>
+ <SettingsRow
+ title={t("settings_view.background_agents.login_title")}
+ description={t("settings_view.background_agents.login_description")}
+ control={
+ <Switch
+ checked={config?.background_only_at_login ?? false}
+ disabled={loading || saving || !config?.autostart_enabled}
+ aria-label={t("settings_view.background_agents.login_title")}
+ onCheckedChange={(next) => void apply({ background_only_at_login: next })}
+ />
+ }
+ />
+ </>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.test.tsx b/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.test.tsx
index 7dc0b7c290..2143eb38e2 100644
--- a/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.test.tsx
@@ -42,7 +42,9 @@ describe("AudioDevicesGroup", () => {
);
render(<AudioDevicesGroup />);
- expect(screen.getByText("Audio devices")).toBeTruthy();
+ // One row per device kind, named for what it picks.
+ expect(screen.getByText("Voice output")).toBeTruthy();
+ expect(screen.getByText("Microphone")).toBeTruthy();
await waitFor(() => {
const output = screen.getByTestId("audio-output-select");
diff --git a/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.tsx
index 97f3a2124f..e3040a5b9b 100644
--- a/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/AudioDevicesGroup.tsx
@@ -1,12 +1,12 @@
import { useState } from "react";
-import { Headphones, Mic, RefreshCw, Volume2 } from "lucide-react";
+import { RefreshCw } from "lucide-react";
import {
useAudioDevices,
type AudioDeviceEntry,
} from "@/hooks/useAudioDevices";
import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
-import { BrandedSelect } from "@/components/ui/select";
+import { SettingsRow, SettingsSelect } from "@/views/settings/SettingsLayout";
/**
* "Audio devices" card inside the Settings view: one dropdown for the OUTPUT
@@ -49,75 +49,69 @@ export function AudioDevicesGroup() {
const autoValue = config?.auto_value ?? "auto-headset";
- return (
- <div className="mt-2 rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <Headphones className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="flex items-center justify-between gap-4">
- <h4 className="font-display text-sm font-semibold">
- {t("settings_view.audio_devices.title")}
- </h4>
- <button
- type="button"
- onClick={() => void refetch()}
- disabled={loading}
- title={t("settings_view.audio_devices.rescan")}
- aria-label={t("settings_view.audio_devices.rescan")}
- className="text-muted-foreground hover:text-foreground disabled:opacity-50"
- >
- <RefreshCw
- className={`h-3.5 w-3.5 ${loading ? "animate-spin" : ""}`}
- />
- </button>
- </div>
- <p className="mt-1 text-xs text-muted-foreground">
- {t("settings_view.audio_devices.description")}
- </p>
+ const rescan = (
+ <button
+ type="button"
+ onClick={() => void refetch()}
+ disabled={loading}
+ title={t("settings_view.audio_devices.rescan")}
+ aria-label={t("settings_view.audio_devices.rescan")}
+ className="flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"
+ >
+ <RefreshCw className={`h-3.5 w-3.5 ${loading ? "animate-spin" : ""}`} />
+ </button>
+ );
- {error && <p className="mt-3 text-xs text-destructive">{error}</p>}
+ if (config && !config.available) {
+ return (
+ <SettingsRow
+ id="settings-audio-devices"
+ title={t("settings_view.audio_devices.title")}
+ description={t("settings_view.audio_devices.none_found")}
+ control={rescan}
+ >
+ {error && <p className="text-sm text-destructive">{error}</p>}
+ </SettingsRow>
+ );
+ }
- {config && !config.available ? (
- <p className="mt-3 text-xs text-muted-foreground">
- {t("settings_view.audio_devices.none_found")}
- </p>
- ) : (
- <>
- <DevicePicker
- icon={<Volume2 className="h-3.5 w-3.5 text-muted-foreground" />}
- label={t("settings_view.audio_devices.output_label")}
- testId="audio-output-select"
- devices={config?.outputs ?? []}
- selected={config?.selected_output ?? autoValue}
- autoValue={autoValue}
- autoLabel={t("settings_view.audio_devices.auto_option")}
- defaultSuffix={t("settings_view.audio_devices.default_suffix")}
- disabled={loading || saving !== null}
- onSelect={(device) => void onSelect("output", device)}
- />
- <DevicePicker
- icon={<Mic className="h-3.5 w-3.5 text-muted-foreground" />}
- label={t("settings_view.audio_devices.input_label")}
- testId="audio-input-select"
- devices={config?.inputs ?? []}
- selected={config?.selected_input ?? autoValue}
- autoValue={autoValue}
- autoLabel={t("settings_view.audio_devices.auto_option")}
- defaultSuffix={t("settings_view.audio_devices.default_suffix")}
- disabled={loading || saving !== null}
- onSelect={(device) => void onSelect("input", device)}
- />
- </>
- )}
- </div>
- </div>
+ // Both rows sit inside one boundary, so they draw their own hairline.
+ return (
+ <div className="divide-y divide-border">
+ <DevicePicker
+ id="settings-audio-devices"
+ label={t("settings_view.audio_devices.output_label")}
+ description={t("settings_view.audio_devices.description")}
+ testId="audio-output-select"
+ devices={config?.outputs ?? []}
+ selected={config?.selected_output ?? autoValue}
+ autoValue={autoValue}
+ autoLabel={t("settings_view.audio_devices.auto_option")}
+ defaultSuffix={t("settings_view.audio_devices.default_suffix")}
+ disabled={loading || saving !== null}
+ onSelect={(device) => void onSelect("output", device)}
+ trailing={rescan}
+ error={error}
+ />
+ <DevicePicker
+ label={t("settings_view.audio_devices.input_label")}
+ testId="audio-input-select"
+ devices={config?.inputs ?? []}
+ selected={config?.selected_input ?? autoValue}
+ autoValue={autoValue}
+ autoLabel={t("settings_view.audio_devices.auto_option")}
+ defaultSuffix={t("settings_view.audio_devices.default_suffix")}
+ disabled={loading || saving !== null}
+ onSelect={(device) => void onSelect("input", device)}
+ />
</div>
);
}
function DevicePicker({
- icon,
+ id,
label,
+ description,
testId,
devices,
selected,
@@ -126,9 +120,12 @@ function DevicePicker({
defaultSuffix,
disabled,
onSelect,
+ trailing,
+ error,
}: {
- icon: React.ReactNode;
+ id?: string;
label: string;
+ description?: string;
testId: string;
devices: AudioDeviceEntry[];
selected: string;
@@ -137,6 +134,8 @@ function DevicePicker({
defaultSuffix: string;
disabled: boolean;
onSelect: (device: string) => void;
+ trailing?: React.ReactNode;
+ error?: string | null;
}) {
// A persisted name whose device is currently unplugged still shows as the
// selected value (an extra option) so the UI never lies about the config;
@@ -145,29 +144,35 @@ function DevicePicker({
const showOrphan = selected !== autoValue && !known;
return (
- <>
- <label className="mt-4 flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
- {icon}
- {label}
- </label>
- <BrandedSelect
- testId={testId}
- value={selected}
- onValueChange={onSelect}
- ariaLabel={label}
- disabled={disabled}
- className="mt-1"
- options={[
- { value: autoValue, label: autoLabel },
- ...devices.map((device) => ({
- value: device.name,
- label: device.is_default
- ? `${device.name} ${defaultSuffix}`
- : device.name,
- })),
- ...(showOrphan ? [{ value: selected, label: selected }] : []),
- ]}
- />
- </>
+ <SettingsRow
+ id={id}
+ title={label}
+ description={description}
+ control={
+ <>
+ <SettingsSelect
+ testId={testId}
+ value={selected}
+ onValueChange={onSelect}
+ ariaLabel={label}
+ disabled={disabled}
+ className="max-w-[18rem]"
+ options={[
+ { value: autoValue, label: autoLabel },
+ ...devices.map((device) => ({
+ value: device.name,
+ label: device.is_default
+ ? `${device.name} ${defaultSuffix}`
+ : device.name,
+ })),
+ ...(showOrphan ? [{ value: selected, label: selected }] : []),
+ ]}
+ />
+ {trailing}
+ </>
+ }
+ >
+ {error && <p className="text-sm text-destructive">{error}</p>}
+ </SettingsRow>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/BarSizeGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/BarSizeGroup.tsx
index 0a0a6ad0fe..3c1c391be3 100644
--- a/jarvis/ui/web/frontend/src/views/settings/BarSizeGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/BarSizeGroup.tsx
@@ -1,8 +1,13 @@
import { useEffect, useRef, useState } from "react";
-import { Maximize2 } from "lucide-react";
import { useBarSize } from "@/hooks/useBarSize";
import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
+import {
+ SettingsLinkButton,
+ SettingsRow,
+ SettingsValue,
+ settingsRangeCls,
+} from "@/views/settings/SettingsLayout";
/**
* "Bar size" slider inside the Settings view. Tunes how big the on-screen bar
@@ -119,46 +124,32 @@ export function BarSizeGroup() {
const showReset = pct !== def;
return (
- <div className="mt-2 rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <Maximize2 className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="flex items-center justify-between gap-4">
- <h4 className="font-display text-sm font-semibold">
- {t("settings_view.bar_size.title")}
- </h4>
- <span className="font-mono text-sm text-foreground-strong">{`${pct}%`}</span>
- </div>
- <p className="mt-1 text-xs text-muted-foreground">
- {t("settings_view.bar_size.description")}
- </p>
-
- <input
- type="range"
- min={min}
- max={max}
- step={5}
- value={pct}
- disabled={loading}
- onChange={(e) => onDrag(Number(e.target.value))}
- onMouseUp={() => void commit(pct)}
- onKeyUp={() => void commit(pct)}
- onTouchEnd={() => void commit(pct)}
- className="mt-4 w-full accent-primary disabled:opacity-50"
- />
-
- {showReset && (
- <button
- type="button"
- onClick={onReset}
- disabled={saving}
- className="mt-3 text-micro text-muted-foreground underline hover:text-foreground disabled:opacity-50"
- >
- {t("settings_view.bar_size.reset")}
- </button>
- )}
+ <SettingsRow
+ title={t("settings_view.bar_size.title")}
+ description={t("settings_view.bar_size.description")}
+ control={<SettingsValue>{`${pct}%`}</SettingsValue>}
+ >
+ <input
+ type="range"
+ aria-label={t("settings_view.bar_size.title")}
+ min={min}
+ max={max}
+ step={5}
+ value={pct}
+ disabled={loading}
+ onChange={(e) => onDrag(Number(e.target.value))}
+ onMouseUp={() => void commit(pct)}
+ onKeyUp={() => void commit(pct)}
+ onTouchEnd={() => void commit(pct)}
+ className={settingsRangeCls}
+ />
+ {showReset && (
+ <div className="flex justify-end">
+ <SettingsLinkButton onClick={onReset} disabled={saving}>
+ {t("settings_view.bar_size.reset")}
+ </SettingsLinkButton>
</div>
- </div>
- </div>
+ )}
+ </SettingsRow>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.test.tsx b/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.test.tsx
index fa03d4daee..ebff31ee71 100644
--- a/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.test.tsx
@@ -38,15 +38,24 @@ describe("LanguagesGroup (Languages folded into Settings)", () => {
expect(screen.getByText("languages_view.reply_section")).toBeDefined();
});
- it("renders a row for each UI language and the reply 'auto' option", () => {
+ it("shows each saved language on its dropdown and lists every choice", async () => {
render(<LanguagesGroup />);
- // en/de/es appear in both the UI and reply lists → at least one each.
- expect(screen.getAllByText("languages_view.options.en.label").length).toBeGreaterThan(0);
- expect(screen.getAllByText("languages_view.options.de.label").length).toBeGreaterThan(0);
- expect(screen.getAllByText("languages_view.options.es.label").length).toBeGreaterThan(0);
- // Reply language offers "automatic" as a row; recognition offers it as the
- // first entry of its dropdown (asserted separately below).
- expect(screen.getAllByText("languages_view.options.auto.label")).toHaveLength(2);
+ expect(screen.getByTestId("ui-language").textContent).toContain(
+ "languages_view.options.en.label",
+ );
+ expect(screen.getByTestId("reply-language").textContent).toContain(
+ "languages_view.options.auto.label",
+ );
+ fireEvent.click(screen.getByTestId("ui-language"));
+ const ui = await waitFor(() => screen.getByTestId("ui-language-panel"));
+ for (const code of ["en", "de", "es"]) {
+ expect(ui.textContent).toContain(`languages_view.options.${code}.label`);
+ }
+ fireEvent.click(screen.getByTestId("reply-language"));
+ const reply = await waitFor(() => screen.getByTestId("reply-language-panel"));
+ for (const code of ["auto", "en", "de", "es"]) {
+ expect(reply.textContent).toContain(`languages_view.reply_options.${code}`);
+ }
});
it("offers recognition languages the interface is not translated into", async () => {
diff --git a/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.tsx
index f75dd73180..3fad4a6048 100644
--- a/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/LanguagesGroup.tsx
@@ -1,6 +1,4 @@
import { useEffect } from "react";
-import { Check } from "lucide-react";
-import { cn } from "@/lib/utils";
import {
useT,
useUiLanguage,
@@ -17,16 +15,21 @@ import {
type ReplyLanguage,
} from "@/i18n";
import { LanguageSelect } from "@/components/ui/language-select";
+import {
+ SettingsCard,
+ SettingsRow,
+ SettingsSection,
+ SettingsSelect,
+ settingsSelectCls,
+} from "@/views/settings/SettingsLayout";
const UI_OPTIONS: UiLanguage[] = ["en", "de", "es"];
const REPLY_OPTIONS: ReplyLanguage[] = ["auto", "en", "de", "es"];
/**
- * "Languages" group inside the Settings view — the interface-language and
- * reply-language selectors. Moved here from the former standalone Languages
- * section; the controls, i18n hooks, and i18n keys (``languages_view.*``) are
- * unchanged. The page-level ViewHeader is dropped because this group sits under
- * the Settings header, as the first panel of the view.
+ * "Languages" section of the General settings page: interface language,
+ * voice-recognition language and reply language, one row each with its
+ * dropdown on the right (i18n keys ``languages_view.*``).
*/
export function LanguagesGroup() {
const t = useT();
@@ -49,38 +52,32 @@ export function LanguagesGroup() {
}, []);
return (
- <div className="space-y-5">
- <h3 className="text-lg font-semibold text-foreground-strong">
- {t("settings_view.languages_group_title")}
- </h3>
-
- <Section
- title={t("languages_view.ui_section")}
- hint={t("languages_view.ui_hint")}
- >
- {UI_OPTIONS.map((code) => (
- <LanguageRow
- key={`ui-${code}`}
- active={ui === code}
- label={t(`languages_view.options.${code}.label`)}
- description={t(`languages_view.options.${code}.description`)}
- onClick={() => setUiLanguage(code)}
- />
- ))}
- </Section>
-
- {/*
- A dropdown, not the row buttons the other two sections use: the
- recogniser understands ~100 languages, and rendering one card per
- language would bury the rest of the settings view. The reply and
- interface languages stay as rows — they have three options each.
- */}
- <Section
- title={t("languages_view.stt_section")}
- hint={t("languages_view.stt_hint")}
- >
- <li>
- <div className="max-w-xs">
+ <SettingsSection title={t("settings_view.languages_group_title")}>
+ <SettingsCard>
+ <SettingsRow
+ title={t("languages_view.ui_section")}
+ description={t("languages_view.ui_hint")}
+ control={
+ <SettingsSelect
+ value={ui}
+ onValueChange={(code) => setUiLanguage(code as UiLanguage)}
+ ariaLabel={t("languages_view.ui_section")}
+ testId="ui-language"
+ options={UI_OPTIONS.map((code) => ({
+ value: code,
+ label: t(`languages_view.options.${code}.label`),
+ }))}
+ />
+ }
+ />
+ {/*
+ A searchable list: the recogniser understands ~100 languages, while
+ the interface and reply languages have a handful each.
+ */}
+ <SettingsRow
+ title={t("languages_view.stt_section")}
+ description={t("languages_view.stt_hint")}
+ control={
<LanguageSelect
value={stt}
codes={sttChoices}
@@ -88,81 +85,28 @@ export function LanguagesGroup() {
autoLabel={t("languages_view.options.auto.label")}
ariaLabel={t("languages_view.stt_section")}
testId="stt-language"
+ className={settingsSelectCls}
/>
- </div>
- <p className="mt-2 text-sm text-muted-foreground">
- {t("languages_view.stt_options.auto")}
- </p>
- </li>
- </Section>
-
- <Section
- title={t("languages_view.reply_section")}
- hint={t("languages_view.reply_hint")}
- >
- {REPLY_OPTIONS.map((code) => (
- <LanguageRow
- key={`reply-${code}`}
- active={reply === code}
- label={t(`languages_view.options.${code}.label`)}
- description={t(`languages_view.reply_options.${code}`)}
- onClick={() => setReplyLanguage(code)}
- />
- ))}
- </Section>
- </div>
- );
-}
-
-function Section({
- title,
- hint,
- children,
-}: {
- title: string;
- hint: string;
- children: React.ReactNode;
-}) {
- return (
- <div className="rounded-lg border border-border bg-card">
- <div className="border-b border-border px-5 py-4">
- <div className="text-base font-medium text-foreground-strong">{title}</div>
- <div className="mt-1 text-sm text-muted-foreground">{hint}</div>
- </div>
- <ul className="divide-y divide-border px-2 py-1">{children}</ul>
- </div>
- );
-}
-
-function LanguageRow({
- active,
- label,
- description,
- onClick,
-}: {
- active: boolean;
- label: string;
- description: string;
- onClick: () => void;
-}) {
- return (
- <li>
- <button
- type="button"
- onClick={onClick}
- aria-pressed={active}
- className={cn(
- "my-1 flex min-h-11 w-full items-center gap-3 rounded-md px-3 py-2 text-left transition-colors",
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- active ? "bg-secondary" : "hover:bg-secondary",
- )}
- >
- <div className="flex-1">
- <div className="text-base font-medium text-foreground">{label}</div>
- <div className="text-sm text-muted-foreground">{description}</div>
- </div>
- {active && <Check className="h-4 w-4 shrink-0 text-accent" />}
- </button>
- </li>
+ }
+ />
+ <SettingsRow
+ title={t("languages_view.reply_section")}
+ description={t("languages_view.reply_hint")}
+ control={
+ <SettingsSelect
+ value={reply}
+ onValueChange={(code) => setReplyLanguage(code as ReplyLanguage)}
+ ariaLabel={t("languages_view.reply_section")}
+ testId="reply-language"
+ options={REPLY_OPTIONS.map((code) => ({
+ value: code,
+ label: t(`languages_view.options.${code}.label`),
+ description: t(`languages_view.reply_options.${code}`),
+ }))}
+ />
+ }
+ />
+ </SettingsCard>
+ </SettingsSection>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/MusicGroup.test.tsx b/jarvis/ui/web/frontend/src/views/settings/MusicGroup.test.tsx
index 08a44e8fe2..18dac839e1 100644
--- a/jarvis/ui/web/frontend/src/views/settings/MusicGroup.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/MusicGroup.test.tsx
@@ -1,4 +1,4 @@
-import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
// Identity translator so assertions can match exact i18n keys.
@@ -41,42 +41,53 @@ afterEach(() => {
vi.clearAllMocks();
});
+async function openPanel(testId: string): Promise<HTMLElement> {
+ fireEvent.click(screen.getByTestId(testId));
+ return waitFor(() => screen.getByTestId(`${testId}-panel`));
+}
+
describe("MusicGroup", () => {
- it("renders both sections with one row per value", () => {
+ it("renders one row per choice with the saved value on its dropdown", () => {
render(<MusicGroup />);
expect(screen.getByText("settings_view.music_group_title")).toBeDefined();
expect(screen.getByText("settings_view.music.service_section")).toBeDefined();
expect(screen.getByText("settings_view.music.playback_section")).toBeDefined();
+ expect(screen.getByTestId("music-service").textContent).toContain(
+ "settings_view.music.service_labels.auto",
+ );
+ expect(screen.getByTestId("music-playback").textContent).toContain(
+ "settings_view.music.playback_labels.background",
+ );
+ });
+
+ it("lists every value and says which services are connected", async () => {
+ render(<MusicGroup />);
+ const services = await openPanel("music-service");
for (const key of ["auto", "spotify", "youtube_music"]) {
- expect(screen.getByText(`settings_view.music.service_labels.${key}`)).toBeDefined();
- }
- for (const key of ["background", "browser"]) {
- expect(screen.getByText(`settings_view.music.playback_labels.${key}`)).toBeDefined();
+ expect(services.textContent).toContain(`settings_view.music.service_labels.${key}`);
}
+ // Spotify is connected, YouTube Music is not — the option lines say so.
+ expect(services.textContent).toMatch(
+ /service_options\.spotify — settings_view\.music\.connected/,
+ );
+ expect(services.textContent).toMatch(
+ /service_options\.youtube_music — settings_view\.music\.not_connected/,
+ );
});
- it("marks the active rows and says which services are connected", () => {
+ it("says when the background player cannot run on this host", async () => {
render(<MusicGroup />);
- const pressed = screen
- .getAllByRole("button")
- .filter((b) => b.getAttribute("aria-pressed") === "true");
- expect(pressed).toHaveLength(2); // one per section
- // Spotify is connected, YouTube Music is not — the row descriptions say so.
- expect(
- screen.getByText(/service_options\.spotify — settings_view\.music\.connected/),
- ).toBeDefined();
- expect(
- screen.getByText(/service_options\.youtube_music — settings_view\.music\.not_connected/),
- ).toBeDefined();
- // The background player cannot run in this fake host — the row says so.
- expect(screen.getByText(/settings_view\.music\.player_unavailable/)).toBeDefined();
+ const playback = await openPanel("music-playback");
+ expect(playback.textContent).toMatch(/settings_view\.music\.player_unavailable/);
});
- it("clicking a row saves that value only", () => {
+ it("picking an option saves that value only", async () => {
render(<MusicGroup />);
- fireEvent.click(screen.getByText("settings_view.music.service_labels.youtube_music"));
+ const services = await openPanel("music-service");
+ fireEvent.click(services.querySelector('[data-value="youtube_music"]')!);
expect(save).toHaveBeenCalledWith({ preferred_service: "youtube_music" });
- fireEvent.click(screen.getByText("settings_view.music.playback_labels.browser"));
+ const playback = await openPanel("music-playback");
+ fireEvent.click(playback.querySelector('[data-value="browser"]')!);
expect(save).toHaveBeenCalledWith({ playback: "browser" });
});
});
diff --git a/jarvis/ui/web/frontend/src/views/settings/MusicGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/MusicGroup.tsx
index 4bab256b49..2637cde88e 100644
--- a/jarvis/ui/web/frontend/src/views/settings/MusicGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/MusicGroup.tsx
@@ -1,5 +1,3 @@
-import { Check } from "lucide-react";
-import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
import { useEventStore } from "@/store/events";
import { useMusicSettings } from "@/hooks/useMusicSettings";
@@ -9,13 +7,19 @@ import {
type MusicPlaybackMode,
type MusicService,
} from "@/lib/musicSettings";
+import {
+ SettingsCard,
+ SettingsRow,
+ SettingsSection,
+ SettingsSelect,
+} from "@/views/settings/SettingsLayout";
/**
* "Music" group inside the Settings view — two connectors, one domain.
*
* Which service a request that names no service goes to (Spotify vs YouTube
* Music), and where YouTube Music plays (the background player window or the
- * browser). Same row-button idiom as the Languages group; both option lists
+ * browser). One row per choice with its dropdown on the right; both option lists
* are the frozen TS mirror of `music_constants.py`, and the row descriptions
* say which connectors are actually connected so a choice never looks live
* when it would do nothing.
@@ -57,99 +61,45 @@ export function MusicGroup() {
};
return (
- <div className="mb-8 space-y-4">
- <h3 className="text-lg font-semibold text-foreground-strong">
- {t("settings_view.music_group_title")}
- </h3>
-
- <Section
- title={t("settings_view.music.service_section")}
- hint={t("settings_view.music.service_hint")}
- >
- {MUSIC_SERVICES.map((service) => (
- <ChoiceRow
- key={`service-${service}`}
- active={settings?.preferred_service === service}
- disabled={loading}
- label={t(`settings_view.music.service_labels.${service}`)}
- description={serviceDescription(service)}
- onClick={() => void choose({ preferred_service: service })}
- />
- ))}
- </Section>
-
- <Section
- title={t("settings_view.music.playback_section")}
- hint={t("settings_view.music.playback_hint")}
- >
- {MUSIC_PLAYBACK_MODES.map((mode) => (
- <ChoiceRow
- key={`playback-${mode}`}
- active={settings?.playback === mode}
- disabled={loading}
- label={t(`settings_view.music.playback_labels.${mode}`)}
- description={playbackDescription(mode)}
- onClick={() => void choose({ playback: mode })}
- />
- ))}
- </Section>
- </div>
- );
-}
-
-function Section({
- title,
- hint,
- children,
-}: {
- title: string;
- hint: string;
- children: React.ReactNode;
-}) {
- return (
- <div>
- <div className="mb-1 text-micro text-muted-foreground">
- {title}
- </div>
- <div className="mb-3 text-xs text-muted-foreground">{hint}</div>
- <ul className="space-y-2">{children}</ul>
- </div>
- );
-}
-
-function ChoiceRow({
- active,
- disabled,
- label,
- description,
- onClick,
-}: {
- active: boolean;
- disabled: boolean;
- label: string;
- description: string;
- onClick: () => void;
-}) {
- return (
- <li>
- <button
- type="button"
- onClick={onClick}
- disabled={disabled}
- aria-pressed={active}
- className={cn(
- "flex w-full items-center gap-3 rounded-lg border px-4 py-3 text-left text-sm transition-colors disabled:opacity-60",
- active
- ? "bg-secondary"
- : "border-border bg-card hover:border-border-strong hover:bg-secondary",
- )}
- >
- <div className="flex-1">
- <div className="font-medium">{label}</div>
- <div className="mt-0.5 text-xs text-muted-foreground">{description}</div>
- </div>
- {active && <Check className="h-4 w-4 shrink-0 text-muted-foreground" />}
- </button>
- </li>
+ <SettingsSection title={t("settings_view.music_group_title")}>
+ <SettingsCard>
+ <SettingsRow
+ title={t("settings_view.music.service_section")}
+ description={t("settings_view.music.service_hint")}
+ control={
+ <SettingsSelect
+ value={settings?.preferred_service ?? "auto"}
+ disabled={loading}
+ testId="music-service"
+ ariaLabel={t("settings_view.music.service_section")}
+ onValueChange={(service) => void choose({ preferred_service: service as MusicService })}
+ options={MUSIC_SERVICES.map((service) => ({
+ value: service,
+ label: t(`settings_view.music.service_labels.${service}`),
+ description: serviceDescription(service),
+ }))}
+ />
+ }
+ />
+ <SettingsRow
+ title={t("settings_view.music.playback_section")}
+ description={t("settings_view.music.playback_hint")}
+ control={
+ <SettingsSelect
+ value={settings?.playback ?? "background"}
+ disabled={loading}
+ testId="music-playback"
+ ariaLabel={t("settings_view.music.playback_section")}
+ onValueChange={(mode) => void choose({ playback: mode as MusicPlaybackMode })}
+ options={MUSIC_PLAYBACK_MODES.map((mode) => ({
+ value: mode,
+ label: t(`settings_view.music.playback_labels.${mode}`),
+ description: playbackDescription(mode),
+ }))}
+ />
+ }
+ />
+ </SettingsCard>
+ </SettingsSection>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.test.tsx b/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.test.tsx
index c224050678..5141f8aab1 100644
--- a/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.test.tsx
@@ -70,13 +70,12 @@ describe("OverlayTaskbarGroup", () => {
expect(screen.queryByText("settings_view.bar_size.title")).toBeNull();
expect(screen.getByText("taskbar_view.mute_music.title")).toBeDefined();
});
- it("renders the group heading and both sub-headings", () => {
+ it("renders the group heading over the style and behaviour cards", () => {
render(<OverlayTaskbarGroup />);
expect(
screen.getByText("settings_view.overlay_taskbar_group_title"),
).toBeDefined();
- expect(screen.getByText("taskbar_view.appearance_title")).toBeDefined();
- expect(screen.getByText("taskbar_view.behavior_title")).toBeDefined();
+ expect(screen.getByText("settings_view.overlay_style.title")).toBeDefined();
});
it("renders the overlay-style panel and all four behavior toggles", () => {
diff --git a/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx
index 8254d37950..3029af8ed3 100644
--- a/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/OverlayTaskbarGroup.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
-import { Monitor, Eye, Volume2, Bell, MousePointer, PawPrint } from "lucide-react";
+import { PawPrint } from "lucide-react";
import { Switch } from "@/components/ui/switch";
import {
useOverlayStyle,
@@ -16,6 +16,8 @@ import { useRestartApp } from "@/hooks/useRestartApp";
import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
+import { Button } from "@/components/ui/button";
+import { SettingsCard, SettingsRow, SettingsSection } from "@/views/settings/SettingsLayout";
/**
* "Bar & Overlay" group inside the Settings view — the on-screen overlay
@@ -30,49 +32,31 @@ export function OverlayTaskbarGroup() {
const isBar = (overlay.config?.style ?? "jarvis_bar") === "jarvis_bar";
return (
- <div className="mt-8 space-y-4">
- <h3 className="text-lg font-semibold text-foreground-strong">
- {t("settings_view.overlay_taskbar_group_title")}
- </h3>
-
- <section>
- <h4 className="mb-2 text-base font-medium text-foreground-strong">
- {t("taskbar_view.appearance_title")}
- </h4>
+ <SettingsSection title={t("settings_view.overlay_taskbar_group_title")}>
+ <SettingsCard>
<OverlayStylePanel overlay={overlay} />
{isBar && <BarSizeGroup />}
- </section>
-
- <section>
- <h4 className="mb-2 text-base font-medium text-foreground-strong">
- {t("taskbar_view.behavior_title")}
- </h4>
- <div className="overflow-hidden rounded-lg border border-border bg-card">
- {isBar && <>
- <BarPersistentRow />
- <div className="mx-4 border-t border-border" />
- <FollowCursorRow />
- <div className="mx-4 border-t border-border" />
- </>}
- <MuteMusicRow />
- <div className="mx-4 border-t border-border" />
- <SoundEffectsRow />
- </div>
- </section>
- </div>
+ </SettingsCard>
+ <SettingsCard>
+ {isBar && <>
+ <BarPersistentRow />
+ <FollowCursorRow />
+ </>}
+ <MuteMusicRow />
+ <SoundEffectsRow />
+ </SettingsCard>
+ </SettingsSection>
);
}
-/** A label + description on the left, a toggle on the right (grouped-card layout). */
+/** A label + description on the left, a toggle on the right. */
function ToggleRow({
- icon: Icon,
title,
description,
checked,
disabled,
onToggle,
}: {
- icon: React.ComponentType<{ className?: string }>;
title: string;
description: string;
checked: boolean;
@@ -80,19 +64,18 @@ function ToggleRow({
onToggle: (next: boolean) => void;
}) {
return (
- <div className="flex items-start gap-3 p-4">
- <Icon className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="font-medium">{title}</div>
- <p className="mt-0.5 text-xs text-muted-foreground">{description}</p>
- </div>
- <Switch
- checked={checked}
- disabled={disabled}
- aria-label={title}
- onCheckedChange={onToggle}
- />
- </div>
+ <SettingsRow
+ title={title}
+ description={description}
+ control={
+ <Switch
+ checked={checked}
+ disabled={disabled}
+ aria-label={title}
+ onCheckedChange={onToggle}
+ />
+ }
+ />
);
}
@@ -121,7 +104,6 @@ function BarPersistentRow() {
return (
<ToggleRow
- icon={Eye}
title={t("taskbar_view.bar_persistent.title")}
description={t("taskbar_view.bar_persistent.description")}
checked={enabled ?? true}
@@ -156,7 +138,6 @@ function FollowCursorRow() {
return (
<ToggleRow
- icon={MousePointer}
title={t("taskbar_view.follow_cursor.title")}
description={t("taskbar_view.follow_cursor.description")}
checked={enabled ?? true}
@@ -191,7 +172,6 @@ function MuteMusicRow() {
return (
<ToggleRow
- icon={Volume2}
title={t("taskbar_view.mute_music.title")}
description={t("taskbar_view.mute_music.description")}
checked={enabled ?? false}
@@ -226,7 +206,6 @@ function SoundEffectsRow() {
return (
<ToggleRow
- icon={Bell}
title={t("taskbar_view.sound_effects.title")}
description={t("taskbar_view.sound_effects.description")}
checked={enabled ?? true}
@@ -280,81 +259,71 @@ function OverlayStylePanel({ overlay }: { overlay: ReturnType<typeof useOverlayS
}
return (
- <div className="rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <Monitor className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <h4 className="font-display text-sm font-semibold">
- {t("settings_view.overlay_style.title")}
- </h4>
- <p className="mt-1 text-xs text-muted-foreground">
- {t("settings_view.overlay_style.description")}
- </p>
-
- {/* Visual preview cards — click to apply (no dropdown). Two columns
- on a narrow window so a fifth style never squeezes the previews
- into unreadable slivers. */}
- <div className="mt-4 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-3">
- {options.map((opt) => (
- <button
- key={opt}
- type="button"
- onClick={() => onPick(opt)}
- disabled={saving || loading}
- aria-pressed={opt === style}
- className={cn(
- "flex flex-col items-center gap-2 rounded-lg border p-3 transition-all disabled:opacity-60",
- opt === style
- ? "bg-secondary ring-1 ring-primary/50"
- : "border-border bg-background hover:border-border-strong",
- )}
- >
- <div className="flex h-16 w-full items-center justify-center overflow-hidden rounded-md bg-card">
- <StylePreview style={opt} />
- </div>
- <span
- className={cn(
- "text-xs font-medium",
- opt === style ? "text-primary" : "text-muted-foreground",
- )}
- >
- {t(`settings_view.overlay_style.options.${opt}`)}
- </span>
- </button>
- ))}
- </div>
-
- {/* Which pet, its size and its bubble live on their own page. */}
- {style === "pet" && (
+ <SettingsRow
+ title={t("settings_view.overlay_style.title")}
+ description={t("settings_view.overlay_style.description")}
+ >
+ {/* Visual preview cards — click to apply (no dropdown). They wrap on a
+ narrow window so a fifth style never squeezes the previews into
+ unreadable slivers. */}
+ <div className="grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2.5 pt-1">
+ {options.map((opt) => {
+ const active = opt === style;
+ return (
<button
+ key={opt}
type="button"
- data-testid="overlay-style-open-pets"
- onClick={() => setActiveSection("pets")}
- className="mt-3 inline-flex items-center gap-1.5 text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ onClick={() => onPick(opt)}
+ disabled={saving || loading}
+ aria-pressed={active}
+ className={cn(
+ "flex flex-col items-center gap-2 rounded-md border p-2 transition-colors disabled:opacity-60",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ active
+ ? "border-accent bg-accent-soft"
+ : "border-border hover:border-border-strong hover:bg-secondary",
+ )}
>
- <PawPrint className="h-3.5 w-3.5" aria-hidden />
- {t("pets.open_settings")}
+ <div className="flex h-16 w-full items-center justify-center overflow-hidden rounded bg-background">
+ <StylePreview style={opt} />
+ </div>
+ <span
+ className={cn(
+ "text-sm font-medium",
+ active ? "text-foreground-strong" : "text-muted-foreground",
+ )}
+ >
+ {t(`settings_view.overlay_style.options.${opt}`)}
+ </span>
</button>
- )}
+ );
+ })}
+ </div>
- {needsRestart && (
- <div className="mt-3 flex flex-wrap items-center gap-3">
- <p className="text-xs text-foreground">
- {t("settings_view.overlay_style.restart_required")}
- </p>
- <button
- type="button"
- onClick={() => void restart()}
- disabled={restarting}
- className="rounded-md bg-secondary px-3 py-1.5 text-xs font-medium text-foreground-strong transition-colors hover:bg-popover disabled:opacity-60"
- >
- {restartLabel}
- </button>
- </div>
- )}
- {error && <p className="mt-3 text-xs text-destructive">{error}</p>}
+ {/* Which pet, its size and its bubble live on their own page. */}
+ {style === "pet" && (
+ <button
+ type="button"
+ data-testid="overlay-style-open-pets"
+ onClick={() => setActiveSection("pets")}
+ className="inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <PawPrint className="h-3.5 w-3.5" aria-hidden />
+ {t("pets.open_settings")}
+ </button>
+ )}
+
+ {needsRestart && (
+ <div className="flex flex-wrap items-center justify-between gap-3 rounded-md bg-secondary px-3 py-2.5">
+ <p className="text-sm text-foreground">
+ {t("settings_view.overlay_style.restart_required")}
+ </p>
+ <Button size="sm" variant="secondary" onClick={() => void restart()} disabled={restarting}>
+ {restartLabel}
+ </Button>
</div>
- </div>
- </div>
+ )}
+ {error && <p className="text-sm text-destructive">{error}</p>}
+ </SettingsRow>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/PermissionsPanel.tsx b/jarvis/ui/web/frontend/src/views/settings/PermissionsPanel.tsx
index 5af835bd05..15fa552809 100644
--- a/jarvis/ui/web/frontend/src/views/settings/PermissionsPanel.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/PermissionsPanel.tsx
@@ -10,10 +10,9 @@ import {
MousePointer2,
Music,
RefreshCw,
- ShieldCheck,
Wand2,
} from "lucide-react";
-import { useEffect, useState } from "react";
+import { useCallback, useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
@@ -24,7 +23,8 @@ import {
type PermissionSnapshot,
type SetupProgress,
} from "@/hooks/usePermissions";
-import { SettingsBlock } from "@/views/settings/SettingsBlock";
+import { SettingsCard, SettingsSection } from "@/views/settings/SettingsLayout";
+import { cn } from "@/lib/utils";
const ICONS = {
microphone: Mic,
@@ -40,10 +40,16 @@ const READY_STATES = new Set(["granted", "not_required"]);
export function PermissionRows({
compact = false,
+ embedded = false,
deferRestartNote = false,
onSnapshot,
}: {
compact?: boolean;
+ /**
+ * Drawn inside a settings card: rows lose their own frame and sit on the
+ * card, split by its hairlines.
+ */
+ embedded?: boolean;
/**
* Onboarding mode: the guide ends with ONE unconditional fresh restart,
* so a granted-but-stale permission shows a calm "applies after the
@@ -145,6 +151,14 @@ export function PermissionRows({
const items = snapshot?.permissions ?? [];
if (items.length === 0 || snapshot?.platform !== "darwin") {
+ if (embedded) {
+ return (
+ <div className="flex items-start gap-2 py-3.5 text-sm text-muted-foreground">
+ <CheckCircle2 className="mt-0.5 h-4 w-4 shrink-0 text-success" />
+ {t("permissions.not_required")}
+ </div>
+ );
+ }
return (
<div className="flex items-start gap-2 rounded-lg border border-border bg-background p-3 text-xs text-muted-foreground">
<CheckCircle2 className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
@@ -154,7 +168,7 @@ export function PermissionRows({
}
return (
- <div className="space-y-2">
+ <div className={embedded ? "divide-y divide-border [&>.rounded-lg]:my-3" : "space-y-2"}>
{snapshot?.app_identity.stable === false && (
<div className="flex items-start gap-2 rounded-lg bg-secondary p-3 text-xs text-foreground">
<CircleAlert className="mt-0.5 h-4 w-4 shrink-0" />
@@ -185,6 +199,7 @@ export function PermissionRows({
item={permission}
busy={pendingId === permission.id}
compact={compact}
+ embedded={embedded}
onRequest={() => run(() => request(permission.id))}
onOpenSettings={() => run(() => openSettings(permission.id))}
onReset={() => run(() => reset(permission.id))}
@@ -264,6 +279,7 @@ function PermissionRow({
item,
busy,
compact,
+ embedded,
onRequest,
onOpenSettings,
onReset,
@@ -271,6 +287,7 @@ function PermissionRow({
item: PermissionItem;
busy: boolean;
compact: boolean;
+ embedded: boolean;
onRequest: () => void;
onOpenSettings: () => void;
onReset: () => void;
@@ -305,7 +322,12 @@ function PermissionRow({
: item.status;
return (
- <div className={`rounded-lg border border-border bg-background ${compact ? "p-3" : "p-4"}`}>
+ <div
+ className={cn(
+ embedded ? "py-3.5" : "rounded-lg border border-border bg-background",
+ !embedded && (compact ? "p-3" : "p-4"),
+ )}
+ >
<div className="flex flex-wrap items-center gap-3">
<Icon className="h-4 w-4 shrink-0 text-muted-foreground" />
<div className="min-w-[12rem] flex-1">
@@ -356,18 +378,21 @@ function PermissionRow({
export function PermissionsPanel() {
const t = useT();
+ // The explanation names macOS; every other OS needs no grants at all and
+ // only gets the one-line "nothing to grant" row.
+ const [platform, setPlatform] = useState<string | null>(null);
+ const onSnapshot = useCallback(
+ (snapshot: PermissionSnapshot | null) => setPlatform(snapshot?.platform ?? null),
+ [],
+ );
return (
- <div className="mt-8 space-y-4">
- <h3 className="text-lg font-semibold text-foreground-strong">
- {t("permissions.group_title")}
- </h3>
- <SettingsBlock
- icon={ShieldCheck}
- title={t("permissions.title")}
- description={t("permissions.description")}
- >
- <PermissionRows />
- </SettingsBlock>
- </div>
+ <SettingsSection
+ title={t("permissions.group_title")}
+ description={platform === "darwin" ? t("permissions.description") : undefined}
+ >
+ <SettingsCard className="px-4">
+ <PermissionRows embedded onSnapshot={onSnapshot} />
+ </SettingsCard>
+ </SettingsSection>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/RealtimeVoiceGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/RealtimeVoiceGroup.tsx
index 5c3bc91905..1c75f176d9 100644
--- a/jarvis/ui/web/frontend/src/views/settings/RealtimeVoiceGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/RealtimeVoiceGroup.tsx
@@ -1,9 +1,8 @@
-import { Radio } from "lucide-react";
-
import { Switch } from "@/components/ui/switch";
import { useVoiceMode } from "@/hooks/useVoiceMode";
import { realtimeTransportIssueKey } from "@/lib/realtimeTransportIssue";
import { useT } from "@/i18n";
+import { SettingsRow } from "@/views/settings/SettingsLayout";
/**
* Provider-neutral Realtime voice toggle inside the Settings view. It flips
@@ -64,49 +63,46 @@ export function RealtimeVoiceGroup() {
? t(realtimeTransportIssueKey(transportIssue))
: transportOfferDetail;
return (
- <div className="mt-2 rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <Radio className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="flex items-center justify-between gap-4">
- <h4 className="font-medium">{t("settings_view.realtime_voice.title")}</h4>
- <Switch
- checked={on}
- disabled={isLoading || isSaving || (!on && !realtimeAvailable)}
- aria-label={t("settings_view.realtime_voice.title")}
- onCheckedChange={(next) => setMode(next ? "realtime" : "pipeline")}
- />
- </div>
- <p className="mt-0.5 text-xs text-muted-foreground">
- {realtimeAvailable
- ? t("settings_view.realtime_voice.description")
- : t("settings_view.realtime_voice.unavailable")}
- </p>
- <p className="mt-1.5 text-micro text-muted-foreground" aria-live="polite">
- {runtimeText}
- </p>
- {on && lastStartError && (
- <p
- data-testid="realtime-last-start-error"
- className="mt-1 text-micro text-foreground"
- aria-live="polite"
- >
- {t("voice_state.connect_failed")
- .replace("{0}", lastStartError.provider || "?")
- .replace("{1}", lastStartError.message)}
- </p>
- )}
- {offerDetail && (
- <p
- data-testid="realtime-transport-offer-detail"
- className="mt-1 text-micro text-foreground"
- aria-live="polite"
- >
- {offerDetail}
- </p>
- )}
- </div>
- </div>
- </div>
+ <SettingsRow
+ id="settings-realtime-voice"
+ title={t("settings_view.realtime_voice.title")}
+ description={
+ realtimeAvailable
+ ? t("settings_view.realtime_voice.description")
+ : t("settings_view.realtime_voice.unavailable")
+ }
+ control={
+ <Switch
+ checked={on}
+ disabled={isLoading || isSaving || (!on && !realtimeAvailable)}
+ aria-label={t("settings_view.realtime_voice.title")}
+ onCheckedChange={(next) => setMode(next ? "realtime" : "pipeline")}
+ />
+ }
+ >
+ <p className="text-sm text-muted-foreground" aria-live="polite">
+ {runtimeText}
+ </p>
+ {on && lastStartError && (
+ <p
+ data-testid="realtime-last-start-error"
+ className="text-sm text-foreground"
+ aria-live="polite"
+ >
+ {t("voice_state.connect_failed")
+ .replace("{0}", lastStartError.provider || "?")
+ .replace("{1}", lastStartError.message)}
+ </p>
+ )}
+ {offerDetail && (
+ <p
+ data-testid="realtime-transport-offer-detail"
+ className="text-sm text-foreground"
+ aria-live="polite"
+ >
+ {offerDetail}
+ </p>
+ )}
+ </SettingsRow>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/SettingsGroupBoundary.tsx b/jarvis/ui/web/frontend/src/views/settings/SettingsGroupBoundary.tsx
index 10084b3192..378544c893 100644
--- a/jarvis/ui/web/frontend/src/views/settings/SettingsGroupBoundary.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/SettingsGroupBoundary.tsx
@@ -7,6 +7,8 @@ interface SettingsGroupBoundaryProps {
children: ReactNode;
/** Group name for the console log — never shown to the user. */
group: string;
+ /** A row inside a settings card: the error takes the row's place, unframed. */
+ inline?: boolean;
}
interface SettingsGroupBoundaryState {
@@ -74,16 +76,20 @@ export class SettingsGroupBoundary extends Component<
}
return (
- <div className="mt-2 rounded-lg border border-destructive/30 bg-card p-4">
+ <div
+ className={
+ this.props.inline
+ ? "px-4 py-3.5"
+ : "rounded-lg border border-destructive/30 bg-card p-4"
+ }
+ >
<div className="flex items-start gap-3">
- <div className="rounded-md bg-secondary p-2 text-destructive">
- <AlertTriangle className="h-4 w-4" />
- </div>
+ <AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-destructive" />
<div className="min-w-0 flex-1">
- <h4 className="font-display text-sm font-semibold">
+ <h4 className="text-base font-medium text-foreground">
{translate("view_error_boundary.group_title")}
</h4>
- <p className="mt-1 text-xs text-muted-foreground">
+ <p className="mt-0.5 text-sm text-muted-foreground">
{translate("view_error_boundary.group_hint")}
</p>
{this.state.message && (
diff --git a/jarvis/ui/web/frontend/src/views/settings/SettingsLayout.tsx b/jarvis/ui/web/frontend/src/views/settings/SettingsLayout.tsx
new file mode 100644
index 0000000000..e9ef2fc573
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/settings/SettingsLayout.tsx
@@ -0,0 +1,266 @@
+import type { ReactNode } from "react";
+
+import { BrandedSelect, type BrandedSelectOption } from "@/components/ui/select";
+import { cn } from "@/lib/utils";
+
+/*
+ * The building blocks of the General settings page.
+ *
+ * One reading column, a title, then sections: a short heading above one
+ * grouped card whose rows are split by hairlines. Every row has the same
+ * shape — the setting's name and one quiet sentence on the left, its control
+ * on the right — so the page scans as a list of decisions instead of a stack
+ * of separately styled panels. Extra content a row needs (a slider, a status
+ * line, a note) sits under the row's text at the row's own inset.
+ */
+
+/** The page: a centred reading column with a title. */
+export function SettingsPage({
+ title,
+ description,
+ children,
+}: {
+ title: string;
+ description?: string;
+ children: ReactNode;
+}) {
+ return (
+ <div className="mx-auto w-full max-w-3xl px-6 pb-20 pt-10 sm:px-10">
+ <header className="mb-8">
+ <h1 className="font-display text-2xl font-semibold text-foreground-strong">{title}</h1>
+ {description && <p className="mt-1.5 text-base text-muted-foreground">{description}</p>}
+ </header>
+ <div className="space-y-10">{children}</div>
+ </div>
+ );
+}
+
+/** A heading with an optional line under it, then the section's card(s). */
+export function SettingsSection({
+ title,
+ description,
+ actions,
+ children,
+ className,
+}: {
+ title: ReactNode;
+ description?: ReactNode;
+ /** Right-aligned beside the heading — a rescan button, a badge. */
+ actions?: ReactNode;
+ children: ReactNode;
+ className?: string;
+}) {
+ return (
+ <section className={cn("space-y-3", className)}>
+ <div className="flex items-end justify-between gap-4">
+ <div className="min-w-0">
+ <h2 className="text-base font-semibold text-foreground-strong">{title}</h2>
+ {description && <p className="mt-0.5 text-sm text-muted-foreground">{description}</p>}
+ </div>
+ {actions && <div className="flex shrink-0 items-center gap-2">{actions}</div>}
+ </div>
+ {children}
+ </section>
+ );
+}
+
+/** The grouped surface: rows stacked with a hairline between each. */
+export function SettingsCard({ children, className }: { children: ReactNode; className?: string }) {
+ return (
+ <div
+ className={cn(
+ "divide-y divide-border rounded-lg border border-border bg-card",
+ className,
+ )}
+ >
+ {children}
+ </div>
+ );
+}
+
+/**
+ * One setting: name + description on the left, the control on the right.
+ * `children` render under the text at full row width.
+ */
+export function SettingsRow({
+ title,
+ description,
+ control,
+ children,
+ id,
+ testId,
+ className,
+}: {
+ title: ReactNode;
+ description?: ReactNode;
+ control?: ReactNode;
+ children?: ReactNode;
+ id?: string;
+ testId?: string;
+ className?: string;
+}) {
+ return (
+ <div id={id} data-testid={testId} className={cn("scroll-mt-6 px-4 py-3.5", className)}>
+ <div className="flex flex-wrap items-center justify-between gap-x-6 gap-y-2">
+ <div className="min-w-0 flex-1 basis-64">
+ <div className="text-base font-medium text-foreground">{title}</div>
+ {description && (
+ <div className="mt-0.5 text-sm text-muted-foreground">{description}</div>
+ )}
+ </div>
+ {control && <div className="flex shrink-0 items-center gap-2">{control}</div>}
+ </div>
+ {children && <div className="mt-3 space-y-2">{children}</div>}
+ </div>
+ );
+}
+
+/** A quiet lifted block inside a row: a hint, a result, a follow-up action. */
+export function SettingsNote({
+ children,
+ tone = "default",
+ className,
+ testId,
+}: {
+ children: ReactNode;
+ tone?: "default" | "success" | "warning" | "error";
+ className?: string;
+ testId?: string;
+}) {
+ return (
+ <div
+ data-testid={testId}
+ className={cn(
+ "rounded-md bg-secondary px-3 py-2.5 text-sm",
+ tone === "default" && "text-foreground",
+ tone === "success" && "text-success",
+ tone === "warning" && "text-warning",
+ tone === "error" && "text-destructive",
+ className,
+ )}
+ >
+ {children}
+ </div>
+ );
+}
+
+/** A compact dropdown that sits at the right edge of a row. */
+export function SettingsSelect({
+ value,
+ options,
+ onValueChange,
+ ariaLabel,
+ placeholder,
+ disabled,
+ testId,
+ className,
+}: {
+ value: string;
+ options: readonly BrandedSelectOption[];
+ onValueChange: (value: string) => void;
+ ariaLabel: string;
+ placeholder?: string;
+ disabled?: boolean;
+ testId?: string;
+ className?: string;
+}) {
+ return (
+ <BrandedSelect
+ value={value}
+ options={options}
+ onValueChange={onValueChange}
+ ariaLabel={ariaLabel}
+ placeholder={placeholder}
+ disabled={disabled}
+ testId={testId}
+ className={cn(settingsSelectCls, className)}
+ />
+ );
+}
+
+/** Trigger styling shared by every right-aligned dropdown on the page. */
+export const settingsSelectCls =
+ "h-8 w-auto max-w-[16rem] gap-1.5 bg-transparent py-0 pl-2.5 pr-2 hover:bg-secondary";
+
+/** Two to four exclusive choices drawn side by side. */
+export function SettingsSegmented<T extends string>({
+ value,
+ options,
+ onChange,
+ ariaLabel,
+ disabled,
+}: {
+ value: T;
+ options: readonly { value: T; label: string; icon?: ReactNode }[];
+ onChange: (value: T) => void;
+ ariaLabel: string;
+ disabled?: boolean;
+}) {
+ return (
+ <div
+ role="radiogroup"
+ aria-label={ariaLabel}
+ className="inline-flex items-center gap-0.5 rounded-md border border-border p-0.5"
+ >
+ {options.map((option) => {
+ const active = option.value === value;
+ return (
+ <button
+ key={option.value}
+ type="button"
+ role="radio"
+ aria-checked={active}
+ disabled={disabled}
+ onClick={() => onChange(option.value)}
+ className={cn(
+ "inline-flex h-7 items-center gap-1.5 rounded px-2.5 text-sm font-medium transition-colors",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
+ "[&>svg]:h-3.5 [&>svg]:w-3.5",
+ active
+ ? "bg-secondary text-foreground-strong"
+ : "text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {option.icon}
+ {option.label}
+ </button>
+ );
+ })}
+ </div>
+ );
+}
+
+/** A range input in the page's one accent, with a readable track. */
+export const settingsRangeCls =
+ "h-1.5 w-full cursor-pointer accent-accent disabled:cursor-not-allowed disabled:opacity-50";
+
+/** The value read-out beside a slider row's title. */
+export function SettingsValue({ children }: { children: ReactNode }) {
+ return (
+ <span className="min-w-[3.5rem] text-right text-sm font-medium tabular-nums text-foreground">
+ {children}
+ </span>
+ );
+}
+
+/** A small text action under a row ("Reset to default"). */
+export function SettingsLinkButton({
+ children,
+ onClick,
+ disabled,
+}: {
+ children: ReactNode;
+ onClick: () => void;
+ disabled?: boolean;
+}) {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ disabled={disabled}
+ className="text-sm text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"
+ >
+ {children}
+ </button>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/settings/SettingsResilience.test.tsx b/jarvis/ui/web/frontend/src/views/settings/SettingsResilience.test.tsx
index d126ed943d..ae2831913c 100644
--- a/jarvis/ui/web/frontend/src/views/settings/SettingsResilience.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/SettingsResilience.test.tsx
@@ -160,17 +160,15 @@ describe("SettingsView against an empty backend", () => {
render(wrap(<SettingsView />));
- // A locale row (identical in every language) proves the page is rendered.
+ // The interface-language dropdown proves the page is rendered.
// The keybind rows moved to the Keyboard shortcuts page — tested below.
await waitFor(() => {
- // One row per language section (interface / recognition / reply).
- expect(screen.getAllByText("Deutsch (German)").length).toBeGreaterThan(0);
+ expect(screen.getByTestId("ui-language").textContent).toContain("English");
});
- // A 640px form cap left the groups as a left-hand column in a sea of
- // black. The section fills the window; the page gutter sits on the row inside.
+ // The page is one centred reading column with its own gutter.
const scroll = screen.getByTestId("settings-scroll");
- expect(scroll.className).not.toMatch(/max-w-form/);
- expect(scroll.firstElementChild?.className).toMatch(/px-8/);
+ expect(scroll.firstElementChild?.className).toMatch(/mx-auto/);
+ expect(scroll.firstElementChild?.className).toMatch(/px-6/);
});
it("renders the Keyboard shortcuts page when every route answers {}", async () => {
diff --git a/jarvis/ui/web/frontend/src/views/settings/SilenceWindowGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/SilenceWindowGroup.tsx
index bb56e42663..1c6e4ba760 100644
--- a/jarvis/ui/web/frontend/src/views/settings/SilenceWindowGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/SilenceWindowGroup.tsx
@@ -1,8 +1,13 @@
import { useEffect, useRef, useState } from "react";
-import { Timer } from "lucide-react";
import { useSilenceWindow } from "@/hooks/useSilenceWindow";
import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
+import {
+ SettingsLinkButton,
+ SettingsRow,
+ SettingsValue,
+ settingsRangeCls,
+} from "@/views/settings/SettingsLayout";
/** The automatic setting: every voice mode keeps its own factory timing. */
const AUTOMATIC_MS = 0;
@@ -96,52 +101,38 @@ export function SilenceWindowGroup() {
const showReset = ms !== defaultMs;
return (
- <div className="mt-2 rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <Timer className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="flex items-center justify-between gap-4">
- <h4 className="font-display text-sm font-semibold">
- {t("settings_view.silence_window.title")}
- </h4>
- <span className="font-mono text-sm text-foreground-strong">{describe(ms)}</span>
- </div>
- <p className="mt-1 text-xs text-muted-foreground">
- {t("settings_view.silence_window.description")}
+ <SettingsRow
+ id="settings-silence-window"
+ title={t("settings_view.silence_window.title")}
+ description={t("settings_view.silence_window.description")}
+ control={<SettingsValue>{describe(ms)}</SettingsValue>}
+ >
+ <input
+ type="range"
+ aria-label={t("settings_view.silence_window.title")}
+ min={config?.min ?? AUTOMATIC_MS}
+ max={config?.max ?? 5000}
+ step={100}
+ value={ms}
+ disabled={loading || saving}
+ onChange={(e) => setLocalMs(snap(Number(e.target.value)))}
+ onMouseUp={() => void commit(ms)}
+ onKeyUp={() => void commit(ms)}
+ onTouchEnd={() => void commit(ms)}
+ className={settingsRangeCls}
+ />
+ {(isAutomatic || showReset) && (
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <p className="text-sm text-muted-foreground">
+ {isAutomatic ? t("settings_view.silence_window.automatic_caption") : null}
</p>
-
- <input
- type="range"
- min={config?.min ?? AUTOMATIC_MS}
- max={config?.max ?? 5000}
- step={100}
- value={ms}
- disabled={loading || saving}
- onChange={(e) => setLocalMs(snap(Number(e.target.value)))}
- onMouseUp={() => void commit(ms)}
- onKeyUp={() => void commit(ms)}
- onTouchEnd={() => void commit(ms)}
- className="mt-4 w-full accent-primary disabled:opacity-50"
- />
-
- {isAutomatic && (
- <p className="mt-2 text-micro text-muted-foreground">
- {t("settings_view.silence_window.automatic_caption")}
- </p>
- )}
-
{showReset && (
- <button
- type="button"
- onClick={onReset}
- disabled={saving}
- className="mt-3 text-micro text-muted-foreground underline hover:text-foreground disabled:opacity-50"
- >
+ <SettingsLinkButton onClick={onReset} disabled={saving}>
{t("settings_view.silence_window.reset")}
- </button>
+ </SettingsLinkButton>
)}
</div>
- </div>
- </div>
+ )}
+ </SettingsRow>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/SystemPromptGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/SystemPromptGroup.tsx
index dc59d0e493..03730c69cd 100644
--- a/jarvis/ui/web/frontend/src/views/settings/SystemPromptGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/SystemPromptGroup.tsx
@@ -1,9 +1,10 @@
import { useEffect, useState } from "react";
-import { FileText, RotateCcw } from "lucide-react";
+import { RotateCcw } from "lucide-react";
import { Button } from "@/components/ui/button";
import { useSystemPrompt } from "@/hooks/useSystemPrompt";
import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
+import { SettingsCard, SettingsSection } from "@/views/settings/SettingsLayout";
/**
* "System Prompt" panel inside the Settings view. Shows the persona that
@@ -61,58 +62,63 @@ export function SystemPromptGroup() {
}
return (
- <div className="mt-2 rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <FileText className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="flex items-center gap-2">
- <h4 className="font-display text-sm font-semibold">
- {t("settings_view.system_prompt.title")}
- </h4>
- <span
- className={`rounded-full px-2 py-0.5 text-micro font-medium ${
- isCustom
- ? "bg-secondary text-foreground-strong"
- : "border border-border bg-muted text-muted-foreground"
- }`}
- >
- {isCustom
- ? t("settings_view.system_prompt.custom_badge")
- : t("settings_view.system_prompt.default_badge")}
- </span>
- </div>
- <p className="mt-1 text-xs text-muted-foreground">
- {t("settings_view.system_prompt.description")}
- </p>
+ <SettingsSection
+ title={t("settings_view.system_prompt.title")}
+ description={t("settings_view.system_prompt.description")}
+ actions={
+ <span
+ className={`rounded-md border px-2 py-0.5 text-xs font-medium ${
+ isCustom
+ ? "border-accent/40 text-accent"
+ : "border-border text-muted-foreground"
+ }`}
+ >
+ {isCustom
+ ? t("settings_view.system_prompt.custom_badge")
+ : t("settings_view.system_prompt.default_badge")}
+ </span>
+ }
+ >
+ <SettingsCard className="p-4">
+ {error && <p className="mb-3 text-sm text-destructive">{error}</p>}
- {error && <p className="mt-3 text-xs text-destructive">{error}</p>}
+ <label htmlFor="system-prompt-editor" className="sr-only">
+ {t("settings_view.system_prompt.editor_label")}
+ </label>
+ <textarea
+ id="system-prompt-editor"
+ data-testid="system-prompt-editor"
+ value={draft}
+ onChange={(e) => setDraft(e.target.value)}
+ disabled={loading}
+ spellCheck={false}
+ rows={14}
+ placeholder={t("settings_view.system_prompt.placeholder")}
+ className="block w-full resize-y rounded-md border border-border bg-background px-3 py-2.5 font-mono text-sm leading-relaxed text-foreground placeholder:text-foreground-faint focus:border-accent focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50"
+ />
- <label className="mt-4 block text-xs font-medium text-muted-foreground">
- {t("settings_view.system_prompt.editor_label")}
- </label>
- <textarea
- data-testid="system-prompt-editor"
- value={draft}
- onChange={(e) => setDraft(e.target.value)}
- disabled={loading}
- spellCheck={false}
- rows={14}
- placeholder={t("settings_view.system_prompt.placeholder")}
- className="jarvis-input-surface mt-1 w-full resize-y rounded-md border border-input px-3 py-2 font-mono text-xs leading-relaxed focus:outline-none focus:ring-2 focus:ring-border-strong disabled:opacity-50"
- />
-
- <div className="mt-1.5 flex items-center justify-between">
- <span className="font-mono text-micro text-muted-foreground">
+ <div className="mt-3 flex flex-wrap items-center justify-between gap-3">
+ <div className="min-w-0 text-xs text-muted-foreground">
+ <span className="font-mono tabular-nums">
{t("settings_view.system_prompt.chars").replace("{0}", String(draft.length))}
</span>
- {trimmedEmpty && (
- <span className="text-micro text-foreground">
- {t("settings_view.system_prompt.empty_hint")}
- </span>
+ <span aria-hidden> · </span>
+ {trimmedEmpty ? (
+ <span className="text-foreground">{t("settings_view.system_prompt.empty_hint")}</span>
+ ) : (
+ <span>{t("settings_view.system_prompt.applies_next_turn")}</span>
)}
</div>
-
- <div className="mt-4 flex flex-wrap items-center gap-3">
+ <div className="ml-auto flex items-center gap-2">
+ <Button
+ size="sm"
+ variant="ghost"
+ onClick={onReset}
+ disabled={resetting || loading || !canReset}
+ >
+ <RotateCcw aria-hidden />
+ {t("settings_view.system_prompt.reset")}
+ </Button>
<Button
size="sm"
onClick={onSave}
@@ -122,23 +128,9 @@ export function SystemPromptGroup() {
? t("settings_view.saving")
: t("settings_view.system_prompt.save")}
</Button>
- <Button
- size="sm"
- variant="outline"
- onClick={onReset}
- disabled={resetting || loading || !canReset}
- className="gap-1.5"
- >
- <RotateCcw className="h-3.5 w-3.5" />
- {t("settings_view.system_prompt.reset")}
- </Button>
</div>
-
- <p className="mt-3 text-micro text-muted-foreground">
- {t("settings_view.system_prompt.applies_next_turn")}
- </p>
</div>
- </div>
- </div>
+ </SettingsCard>
+ </SettingsSection>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/VolumeGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/VolumeGroup.tsx
index 27e414c439..3485cf83e6 100644
--- a/jarvis/ui/web/frontend/src/views/settings/VolumeGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/VolumeGroup.tsx
@@ -1,8 +1,13 @@
import { useEffect, useRef, useState } from "react";
-import { Volume2 } from "lucide-react";
import { useTtsVolume } from "@/hooks/useTtsVolume";
import { useEventStore } from "@/store/events";
import { useT } from "@/i18n";
+import {
+ SettingsLinkButton,
+ SettingsRow,
+ SettingsValue,
+ settingsRangeCls,
+} from "@/views/settings/SettingsLayout";
/**
* "Volume" slider inside the Settings view. Tunes how loudly Jarvis speaks
@@ -69,46 +74,33 @@ export function VolumeGroup() {
const showReset = pct !== Math.round((config?.default ?? 1) * 100);
return (
- <div className="mt-2 rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <Volume2 className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="flex items-center justify-between gap-4">
- <h4 className="font-display text-sm font-semibold">
- {t("settings_view.volume.title")}
- </h4>
- <span className="font-mono text-sm text-foreground-strong">{`${pct}%`}</span>
- </div>
- <p className="mt-1 text-xs text-muted-foreground">
- {t("settings_view.volume.description")}
- </p>
-
- <input
- type="range"
- min={0}
- max={100}
- step={1}
- value={pct}
- disabled={loading || saving}
- onChange={(e) => setLocalPct(Number(e.target.value))}
- onMouseUp={() => void commit(pct)}
- onKeyUp={() => void commit(pct)}
- onTouchEnd={() => void commit(pct)}
- className="mt-4 w-full accent-primary disabled:opacity-50"
- />
-
- {showReset && (
- <button
- type="button"
- onClick={onReset}
- disabled={saving}
- className="mt-3 text-micro text-muted-foreground underline hover:text-foreground disabled:opacity-50"
- >
- {t("settings_view.volume.reset")}
- </button>
- )}
+ <SettingsRow
+ id="settings-volume"
+ title={t("settings_view.volume.title")}
+ description={t("settings_view.volume.description")}
+ control={<SettingsValue>{`${pct}%`}</SettingsValue>}
+ >
+ <input
+ type="range"
+ aria-label={t("settings_view.volume.title")}
+ min={0}
+ max={100}
+ step={1}
+ value={pct}
+ disabled={loading || saving}
+ onChange={(e) => setLocalPct(Number(e.target.value))}
+ onMouseUp={() => void commit(pct)}
+ onKeyUp={() => void commit(pct)}
+ onTouchEnd={() => void commit(pct)}
+ className={settingsRangeCls}
+ />
+ {showReset && (
+ <div className="flex justify-end">
+ <SettingsLinkButton onClick={onReset} disabled={saving}>
+ {t("settings_view.volume.reset")}
+ </SettingsLinkButton>
</div>
- </div>
- </div>
+ )}
+ </SettingsRow>
);
}