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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(settings): open the settings hub as a centred dialog over the app
rubenluetke10-beepb6bca951b8d2
diff --git a/jarvis/ui/web/frontend/src/App.detached.test.tsx b/jarvis/ui/web/frontend/src/App.detached.test.tsxindex 104a8fb9e0..1df914435c 100644--- a/jarvis/ui/web/frontend/src/App.detached.test.tsx+++ b/jarvis/ui/web/frontend/src/App.detached.test.tsx@@ -1,4 +1,4 @@-import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";+import { act, cleanup, render, screen } from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import App from "@/App";@@ -38,12 +38,7 @@ vi.mock("@/components/layout/PaneResizer", () => ({PaneResizer: () => <div data-testid="sidebar-resizer" />,}));vi.mock("@/components/layout/TopBar", () => ({- TopBar: ({ settingsNavigation }: { settingsNavigation?: { open: boolean; onToggle: () => void } }) => (- <div data-testid="topbar">- {settingsNavigation && <button data-testid="settings-sidebar-toggle" onClick={settingsNavigation.onToggle}- aria-expanded={settingsNavigation.open}>Toggle navigation</button>}- </div>- ),+ TopBar: () => <div data-testid="topbar" />,}));vi.mock("@/components/layout/MainView", () => ({MainView: () => <div data-testid="main-view" />,@@ -91,25 +86,13 @@ afterEach(() => {});describe("App shell around detached coding views", () => {- it("hides the main sidebar on each Settings visit and lets it be reopened", () => {+ it("keeps the main sidebar while Settings floats over the app", () => {render(<App />);expect(screen.getByTestId("sidebar")).toBeTruthy();act(() => useEventStore.setState({ activeSection: "profile" }));- expect(screen.queryByTestId("sidebar")).toBeNull();- expect(screen.queryByTestId("sidebar-resizer")).toBeNull();- const toggle = screen.getByTestId("settings-sidebar-toggle");- expect(toggle.getAttribute("aria-expanded")).toBe("false");-- fireEvent.click(toggle);expect(screen.getByTestId("sidebar")).toBeTruthy();- expect(toggle.getAttribute("aria-expanded")).toBe("true");- act(() => useEventStore.setState({ activeSection: "apikeys" }));- expect(screen.getByTestId("sidebar")).toBeTruthy();-- act(() => useEventStore.setState({ activeSection: "tasks" }));- act(() => useEventStore.setState({ activeSection: "profile" }));- expect(screen.queryByTestId("sidebar")).toBeNull();+ expect(screen.getByTestId("sidebar-resizer")).toBeTruthy();});it("renders the desktop wallpaper behind normal app sections", () => {diff --git a/jarvis/ui/web/frontend/src/App.tsx b/jarvis/ui/web/frontend/src/App.tsxindex b854242ed6..046f50f03c 100644--- a/jarvis/ui/web/frontend/src/App.tsx+++ b/jarvis/ui/web/frontend/src/App.tsx@@ -18,7 +18,6 @@ import {SIDEBAR_WIDTH_STORAGE_KEY,} from "@/components/layout/Sidebar";import { PaneResizer } from "@/components/layout/PaneResizer";-import { SETTINGS_HUB_IDS } from "@/components/layout/navGroups";import { useResizablePane } from "@/hooks/useResizablePane";import { TopBar } from "@/components/layout/TopBar";import { PermissionsAlertBanner } from "@/components/layout/PermissionsAlertBanner";@@ -278,16 +277,7 @@ export default function App() {const activeSection = useEventStore((s) => s.activeSection);const agentsNavOpen = useSocietyShell((s) => s.navigationOpen);const toggleAgentsNav = useSocietyShell((s) => s.toggleNavigation);- const settingsHubActive = SETTINGS_HUB_IDS.includes(activeSection);- const [settingsSidebarOpen, setSettingsSidebarOpen] = useState(false);- // Each visit to the Settings hub starts with its own navigation as the only- // left column. Switching tabs inside the hub preserves a deliberate reveal.- useEffect(() => {- if (!settingsHubActive) setSettingsSidebarOpen(false);- }, [settingsHubActive]);- const hideNavigation =- (activeSection === "agents" && !agentsNavOpen) ||- (settingsHubActive && !settingsSidebarOpen);+ const hideNavigation = activeSection === "agents" && !agentsNavOpen;const solo = useEventStore((s) => s.solo);const detachedViews = useEventStore((s) => s.detachedViews);/*@@ -295,22 +285,18 @@ export default function App() {** The toggle moved here from the sidebar header, so the stranded handlers* move with it: the agents section folds its own navigation, every other- * section folds the main column. The settings hub brings its own toggle- * (TopBar maps it onto the same button), so it needs nothing here. The- * collapsed flag mirrors the rail the sidebar itself reports — a dragged+ * section folds the main column. The collapsed flag mirrors the rail the sidebar itself reports — a dragged* narrow column reads as collapsed even before the toggle was touched.*/- const navToggle = settingsHubActive- ? undefined- : activeSection === "agents"- ? {- collapsed: !agentsNavOpen || sidebar.size < SIDEBAR_RAIL_AT_WIDTH,- onToggle: toggleAgentsNav,- }- : {- collapsed: navCollapsed || sidebar.size < SIDEBAR_RAIL_AT_WIDTH,- onToggle: toggleNav,- };+ const navToggle = activeSection === "agents"+ ? {+ collapsed: !agentsNavOpen || sidebar.size < SIDEBAR_RAIL_AT_WIDTH,+ onToggle: toggleAgentsNav,+ }+ : {+ collapsed: navCollapsed || sidebar.size < SIDEBAR_RAIL_AT_WIDTH,+ onToggle: toggleNav,+ };/** The realtime broker must exist exactly ONCE across all windows: it@@ -377,7 +363,7 @@ export default function App() {{!hideNavigation && <><Sidebarwidth={sidebar.size}- collapsed={activeSection === "agents" || settingsHubActive ? false : navCollapsed}+ collapsed={activeSection === "agents" ? false : navCollapsed}/><PaneResizer@@ -411,7 +397,7 @@ export default function App() {{/* Gray, like the sidebar. The content panel below rounds itstop-left corner so this gray shows in the curve. */}<div className="h-8 shrink-0" data-testid="caption-rule" />- <div className={activeSection === "agents" || settingsHubActive ? "flex min-h-0 min-w-0 flex-1 flex-col" : "jarvis-sheet flex min-h-0 min-w-0 flex-1 flex-col"}>+ <div className={activeSection === "agents" ? "flex min-h-0 min-w-0 flex-1 flex-col" : "jarvis-sheet flex min-h-0 min-w-0 flex-1 flex-col"}>{/* App-wide macOS permission alert — topmost so a missing grant isimpossible to miss on any view. No-op on other platforms. */}<PermissionsAlertBanner />@@ -420,10 +406,7 @@ export default function App() {it is the same class of problem: an OS-level gate the user must betold about, since nothing else reports it. */}<InputIsolationBanner />- <TopBar navToggle={navToggle} settingsNavigation={settingsHubActive ? {- open: settingsSidebarOpen,- onToggle: () => setSettingsSidebarOpen((open) => !open),- } : undefined} />+ <TopBar navToggle={navToggle} />{!(["agentic-ide", "chat-workspace", "agentic-ide-classic"].includes(activeSection)) && <VoiceWarmingBanner />}{/* The one-time "all lights green" note — the first time everysection of the active voice mode answers. Never again after. */}diff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.settingsHub.test.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.settingsHub.test.tsxindex 977a156ac7..26ddfba174 100644--- a/jarvis/ui/web/frontend/src/components/layout/MainView.settingsHub.test.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.settingsHub.test.tsx@@ -1,15 +1,18 @@-import { cleanup, render, screen } from "@testing-library/react";+import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { MainView } from "./MainView";import { useEventStore, type SectionId } from "@/store/events";// The hub's own tab behaviour is covered by SettingsHubView.test — here only-// the ROUTING matters: every hub id must mount the hub, and nothing else may.+// the ROUTING matters: every hub id must mount the hub as a dialog over the+// last regular section, and nothing else may.vi.mock("@/views/ChatsSurface", () => ({ChatsSurface: () => <div data-testid="chats-surface" />,}));vi.mock("@/views/SettingsHubView", () => ({- SettingsHubView: () => <div data-testid="settings-hub" />,+ SettingsHubDialog: ({ onClose }: { onClose: () => void }) => (+ <button type="button" data-testid="settings-hub" onClick={onClose}>close</button>+ ),}));beforeEach(() => {@@ -42,7 +45,16 @@ describe("MainView — every settings-hub id mounts the hub", () => {render(<MainView />);expect(await screen.findByTestId("settings-hub")).toBeTruthy();- expect(screen.queryByTestId("chats-surface")).toBeNull();+ // The section behind the dialog stays on screen.+ expect(screen.getByTestId("chats-surface")).toBeTruthy();+ });++ it("closes back to the section it was opened from", async () => {+ useEventStore.setState({ activeSection: "chats" });+ render(<MainView />);+ act(() => useEventStore.setState({ activeSection: "apikeys" }));+ fireEvent.click(await screen.findByTestId("settings-hub"));+ expect(useEventStore.getState().activeSection).toBe("chats");});it("keeps non-hub sections on their own views", async () => {diff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.tsxindex bbc3f6d5f6..3f689716e4 100644--- a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.tsx@@ -21,6 +21,7 @@ import { useT } from "@/i18n";import { cn } from "@/lib/utils";import { ViewErrorBoundary } from "@/components/ViewErrorBoundary";import { DetachedViewPlaceholder } from "@/components/layout/DetachedViewPlaceholder";+import { SETTINGS_HUB_IDS } from "@/components/layout/navGroups";// Type-only, so the section's chunk stays split out of the entry bundle.import type { AgenticIdeViewProps } from "@/views/AgenticIdeView";// The default section is the one view that must be on screen the moment React@@ -81,12 +82,12 @@ function lazyPropView<P>(// front-loads what the user reaches for first. Views are named exports, hence// the explicit unwrap into the { default } shape React.lazy expects.// The Settings hub — Profile, {name}.md, Contacts, Socials, API Keys, Local-// models, Wallpaper, Spend and Feedback behind one left-nav page. The hub+// models, Wallpaper, Spend and Feedback behind one left-nav dialog. The hub// statically owns only its shell; every tab stays its own lazy chunk (see// SettingsHubView), so this one import replaces the eleven per-view imports// below without merging their chunks back together.-const SettingsHubView = lazyView(() =>- import("@/views/SettingsHubView").then((m) => ({ default: m.SettingsHubView })),+const SettingsHubDialog = lazyPropView<{ onClose: () => void }>(() =>+ import("@/views/SettingsHubView").then((m) => ({ default: m.SettingsHubDialog })),);// The Agents section is the society (MASTERPLAN §4.1): stage + agents rail +// model cards. The board it replaced is the society's stage until the island@@ -102,6 +103,11 @@ const WikiView = lazyView(() =>type PluginArea = "plugins" | "mcps" | "skills";const isPluginArea = (section: string): section is PluginArea =>section === "plugins" || section === "mcps" || section === "skills";+const isSettingsHub = (section: string) =>+ (SETTINGS_HUB_IDS as readonly string[]).includes(section);+// Sections that float as a dialog over the last regular section instead of+// replacing it.+const isOverlaySection = (section: string) => isPluginArea(section) || isSettingsHub(section);const PluginsDialog = lazyPropView<{ onClose: () => void; area: PluginArea; onAreaChange: (area: PluginArea) => void }>(() =>import("@/views/PluginsDialog").then((m) => ({ default: m.PluginsDialog })),@@ -380,10 +386,10 @@ export function MainView() {const solo = useEventStore((s) => s.solo);const detachedViews = useEventStore((s) => s.detachedViews);const [backgroundSection, setBackgroundSection] = useState(- isPluginArea(active) ? "chats" : active,+ isOverlaySection(active) ? "chats" : active,);- if (!isPluginArea(active) && backgroundSection !== active) setBackgroundSection(active);- const displayed = isPluginArea(active) ? backgroundSection : active;+ if (!isOverlaySection(active) && backgroundSection !== active) setBackgroundSection(active);+ const displayed = isOverlaySection(active) ? backgroundSection : active;useIdleViewPrefetch();@@ -411,7 +417,7 @@ export function MainView() {if (codingDetached) setStickyMounted(false);}, [codingDetached]);- if (codingDetached && (CODING_SECTION_IDS as readonly string[]).includes(displayed) && !isPluginArea(active)) {+ if (codingDetached && (CODING_SECTION_IDS as readonly string[]).includes(displayed) && !isOverlaySection(active)) {return <DetachedViewPlaceholder view={displayed} />;}@@ -466,6 +472,13 @@ export function MainView() {</Suspense></ViewErrorBoundary>)}+ {isSettingsHub(active) && (+ <ViewErrorBoundary viewName="settings" resetKey="settings" onRecover={() => setActive(backgroundSection)}>+ <Suspense fallback={null}>+ <SettingsHubDialog onClose={() => setActive(backgroundSection)} />+ </Suspense>+ </ViewErrorBoundary>+ )}</>);}@@ -492,30 +505,6 @@ function SwitchOnActiveSection({ active }: { active: string }) {return <BoardView />;case "memory":return <WikiView />;- // The Settings hub: Profile, {name}.md, Contacts, Socials, API Keys (plus- // the merged-in "telephony" id and the "telephony-setup" page, which lives- // one button inside the telephony credentials card), Local models,- // Wallpaper, Spend and Feedback behind one left-nav page. The hub selects- // its tab from the active id, so every existing deep link, deck jump and- // voice alias ("go to telephony", "show languages", …) keeps landing- // on the right tab — only the stage around the content changed.- case "settings":- case "taskbar":- case "languages":- case "profile":- case "agent-instructions":- case "contacts":- case "socials":- case "apikeys":- case "telephony":- case "telephony-setup":- case "local-models":- case "computers":- case "wallpaper":- case "appshots":- case "costs":- case "feedback":- return <SettingsHubView />;// The merged voice section: Dictation (default landing) + Dictionary +// Shortcuts + Language + the speech-to-text keys, behind one tab bar. The// active id doubles as the tab state, so a voice deep-link to any of themdiff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsxindex 11b856cbfa..f7eb806baa 100644--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx@@ -24,15 +24,14 @@ beforeEach(() => {afterEach(() => vi.restoreAllMocks());describe("TopBar detach button", () => {- it("offers the Settings navigation toggle with its current state", () => {- useEventStore.setState({ activeSection: "profile" });+ it("offers the sidebar toggle with its current state", () => {const onToggle = vi.fn();- const { rerender } = render(<TopBar settingsNavigation={{ open: false, onToggle }} />);- const toggle = screen.getByTestId("settings-sidebar-toggle");+ const { rerender } = render(<TopBar navToggle={{ collapsed: true, onToggle }} />);+ const toggle = screen.getByTestId("section-nav-sidebar");expect(toggle.getAttribute("aria-expanded")).toBe("false");fireEvent.click(toggle);expect(onToggle).toHaveBeenCalledOnce();- rerender(<TopBar settingsNavigation={{ open: true, onToggle }} />);+ rerender(<TopBar navToggle={{ collapsed: false, onToggle }} />);expect(toggle.getAttribute("aria-expanded")).toBe("true");});diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsxindex b5a49a7d81..764ce4f91e 100644--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx@@ -71,8 +71,7 @@ const CHROME_QUIET = "text-muted-foreground hover:bg-secondary hover:text-foregr*/const CHROME_ARMED = "bg-warning text-background";-export function TopBar({ settingsNavigation, navToggle }: {- settingsNavigation?: { open: boolean; onToggle: () => void };+export function TopBar({ navToggle }: {/*** The sidebar toggle the caption owns. State lives in the shell (App.tsx):* the sidebar header no longer carries its own button — it moved here, next@@ -83,19 +82,6 @@ export function TopBar({ settingsNavigation, navToggle }: {} = {}) {const chrome = useDesktopChrome();const controls = chrome.frameless ? chrome.controls : "none";- /*- * The settings hub's own navigation toggle and the caption sidebar toggle- * are the same control: one panel button at the leading edge, not two- * adjacent ones doing the same job. It keeps its test id so the hub's- * contract ("the caption reopens the navigation") stays observable.- */- const sidebarToggle = settingsNavigation- ? {- collapsed: !settingsNavigation.open,- onToggle: settingsNavigation.onToggle,- testId: "settings-sidebar-toggle",- }- : navToggle;return (// One title strip for the whole window. The empty middle is the drag@@ -108,7 +94,7 @@ export function TopBar({ settingsNavigation, navToggle }: {{controls === "leading" && (<WindowControls controls={controls} maximized={chrome.maximized} onCommand={chrome.command} />)}- <SectionNavButtons sidebarToggle={sidebarToggle} />+ <SectionNavButtons sidebarToggle={navToggle} /><divclassName="pywebview-drag-region min-w-0 flex-1"onDoubleClick={() => {diff --git a/jarvis/ui/web/frontend/src/views/SettingsHubView.test.tsx b/jarvis/ui/web/frontend/src/views/SettingsHubView.test.tsxindex 4ccca9d9c6..03397181d7 100644--- a/jarvis/ui/web/frontend/src/views/SettingsHubView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/SettingsHubView.test.tsx@@ -89,7 +89,10 @@ vi.mock("@/views/feedback/FeedbackView", () => ({FeedbackView: stub("TAB_FEEDBACK"),}));-import { SettingsHubView } from "@/views/SettingsHubView";+import { SettingsHubDialog, SettingsHubView as HubView } from "@/views/SettingsHubView";++const noop = () => {};+const SettingsHubView = () => <HubView onClose={noop} />;const NAV_IDS = ["settings",@@ -116,28 +119,37 @@ afterEach(() => {});describe("SettingsHubView header and navigation", () => {- it("separates the navigation from the content and returns to the app", async () => {- render(<SettingsHubView />);+ it("separates the navigation from the content and closes through its X", async () => {+ const onClose = vi.fn();+ render(<HubView onClose={onClose} />);await screen.findByTestId("TAB_SETTINGS");expect(screen.getByTestId("settings-hub-sidebar").className).toContain("jarvis-nav-surface");expect(screen.getByTestId("settings-hub-content").parentElement?.className).toContain("jarvis-sheet");- fireEvent.click(screen.getByRole("button", { name: "settings_hub.back_to_app" }));- expect(mockState.setActiveSection).toHaveBeenCalledWith("chats");+ fireEvent.click(screen.getByTestId("settings-hub-close"));+ expect(onClose).toHaveBeenCalledOnce();+ expect(mockState.setActiveSection).not.toHaveBeenCalled();});- it("renders exactly one header titled from nav.settings", async () => {- render(<SettingsHubView />);+ it("opens as a named dialog that Escape closes", async () => {+ const onClose = vi.fn();+ render(<SettingsHubDialog onClose={onClose} />);+ const dialog = await screen.findByRole("dialog", { name: "nav.settings" });+ expect(dialog.getAttribute("data-testid")).toBe("settings-hub-dialog");+ expect(screen.getByPlaceholderText("settings_hub.search_placeholder")).toBeTruthy();+ await screen.findByTestId("TAB_SETTINGS");+ fireEvent.keyDown(dialog, { key: "Escape" });+ expect(onClose).toHaveBeenCalledOnce();+ });- expect(screen.getAllByTestId("view-header")).toHaveLength(1);- expect(screen.getByTestId("view-header-title").textContent).toBe("nav.settings");- expect(screen.getByTestId("view-header-subtitle").textContent).toBe(- "settings_hub.subtitle",- );- expect(- screen.getByPlaceholderText("settings_hub.search_placeholder"),- ).toBeTruthy();- // The default tab's chunk still has to arrive.+ it("clears a filled search on Escape before closing", async () => {+ const onClose = vi.fn();+ render(<SettingsHubDialog onClose={onClose} />);await screen.findByTestId("TAB_SETTINGS");+ const search = screen.getByTestId("settings-hub-search");+ fireEvent.change(search, { target: { value: "wall" } });+ fireEvent.keyDown(search, { key: "Escape" });+ expect((search as HTMLInputElement).value).toBe("");+ expect(onClose).not.toHaveBeenCalled();});it("lists all ten entries in the left navigation", async () => {diff --git a/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx b/jarvis/ui/web/frontend/src/views/SettingsHubView.tsxindex ab4993964e..6c20bfda71 100644--- a/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx+++ b/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx@@ -1,5 +1,6 @@-import { lazy, Suspense, useMemo, useState, type ComponentType, type LazyExoticComponent } from "react";-import { ArrowLeft, Loader2, Search, Settings as SettingsIcon, X } from "lucide-react";+import * as Dialog from "@radix-ui/react-dialog";+import { lazy, Suspense, useMemo, useRef, useState, type ComponentType, type LazyExoticComponent } from "react";+import { Loader2, Search, X } from "lucide-react";import {NAV_FOOTER_ITEMS,NAV_GROUPS,@@ -10,14 +11,14 @@ import {import { useEventStore } from "@/store/events";import { useSectionHealth } from "@/hooks/useProviders";import { useT, useUiLanguage } from "@/i18n";-import { ViewHeader } from "@/views/ChatsView";+import { isComboboxPanelEvent } from "@/components/ui/combobox";import { searchSettingsOptions, searchSettingsPages } from "@/views/settings/settingsSearch";import { cn } from "@/lib/utils";/**- * The Settings hub — every personal/system section behind one page, with a- * searchable left navigation (Personal · System · Activity) and the selected- * section on the right:+ * The Settings hub — every personal/system section behind one dialog that+ * floats over the user's current section, with a searchable left navigation+ * (General · System · Activity) and the selected section on the right:** General: Settings, Appshots, Profile, {name}.md, Contacts, Socials* System: Computers, API Keys, Local models, Wallpaper@@ -204,7 +205,7 @@ function HubLoadingFallback() {);}-export function SettingsHubView() {+export function SettingsHubView({ onClose }: { onClose: () => void }) {const t = useT();const language = useUiLanguage();const active = useEventStore((s) => s.activeSection);@@ -304,19 +305,12 @@ export function SettingsHubView() {<div data-testid="settings-hub" className="flex h-full min-h-0 flex-col md:flex-row"><asidedata-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-72 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 md:border-r">- <div className="border-b border-border px-3 py-3">- <button type="button" onClick={() => setActive("chats")}- className="flex h-9 w-full items-center gap-2 rounded-md px-2 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">- <ArrowLeft className="h-4 w-4 shrink-0" aria-hidden />- {t("settings_hub.back_to_app")}- </button>- </div><div className="px-3 pb-2 pt-3"><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 />- <input type="text" role="searchbox" value={query} onChange={(event) => setQuery(event.target.value)}+ <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")}@@ -394,12 +388,12 @@ export function SettingsHubView() {)}</nav></aside>- <div className="jarvis-sheet flex min-h-0 min-w-0 flex-1 flex-col">- <ViewHeader- icon={<SettingsIcon className="h-4 w-4 text-foreground" />}- title={t("nav.settings")}- subtitle={t("settings_hub.subtitle")}- />+ <div className="jarvis-sheet relative flex min-h-0 min-w-0 flex-1 flex-col">+ <button type="button" onClick={onClose} aria-label={t("common.close")}+ data-testid="settings-hub-close"+ className="absolute right-3 top-3 z-10 grid h-8 w-8 place-items-center rounded-lg 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 />+ </button><div data-testid="settings-hub-content" className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis"><div className="h-full w-full max-w-[2000px]"><Suspense fallback={<HubLoadingFallback />}>@@ -413,3 +407,66 @@ export function SettingsHubView() {</div>);}++/**+ * The hub as a centred window over the current section (the way desktop apps+ * open their preferences), not a page that replaces the whole app. Closing it+ * — the X, Escape or a click on the scrim — returns to the section behind it.+ *+ * Centred with `inset-0` + `m-auto` rather than a translate: a transform would+ * turn the dialog into the containing block of every `position: fixed` layer a+ * tab renders inline (the wallpaper preview, view-level dialogs) and trap them+ * inside the window instead of covering the screen.+ */+export function SettingsHubDialog({ onClose }: { onClose: () => void }) {+ const t = useT();+ const content = useRef<HTMLDivElement>(null);+ const opener = useRef(document.activeElement);+ // A nested modal inside a tab (credential dialogs, pickers) owns outside+ // clicks and Escape while it is open; so does an open combobox panel.+ const nestedOwnsEvent = (event: Event) =>+ isComboboxPanelEvent(event) || content.current?.querySelector('[aria-modal="true"]') != null;+ return (+ <Dialog.Root open onOpenChange={(open) => { if (!open) onClose(); }}>+ <Dialog.Portal>+ <Dialog.Overlay className="fixed inset-0 z-40 bg-scrim/65 backdrop-blur-[2px]" />+ <Dialog.Content+ data-testid="settings-hub-dialog"+ ref={content}+ aria-describedby={undefined}+ onCloseAutoFocus={(event) => {+ const previous = opener.current;+ const target = previous instanceof HTMLElement && previous.isConnected && previous !== document.body+ ? previous+ : document.querySelector<HTMLElement>("main");+ if (!target) return;+ // This route-driven dialog has no Radix Trigger to restore focus to.+ event.preventDefault();+ const needsTabIndex = target.tagName === "MAIN" && !target.hasAttribute("tabindex");+ if (needsTabIndex) target.setAttribute("tabindex", "-1");+ target.focus({ preventScroll: true });+ if (needsTabIndex) target.removeAttribute("tabindex");+ }}+ onPointerDownOutside={(event) => { if (nestedOwnsEvent(event)) event.preventDefault(); }}+ onFocusOutside={(event) => { if (nestedOwnsEvent(event)) event.preventDefault(); }}+ onInteractOutside={(event) => { if (nestedOwnsEvent(event)) event.preventDefault(); }}+ onEscapeKeyDown={(event) => {+ if (content.current?.querySelector('[aria-modal="true"]')) {+ event.preventDefault();+ return;+ }+ // Escape in a filled search box clears the search first.+ const target = event.target;+ if (target instanceof HTMLInputElement && target.dataset.testid === "settings-hub-search" && target.value) {+ event.preventDefault();+ }+ }}+ className="fixed inset-0 z-40 m-auto flex h-[min(86dvh,820px)] w-[min(1040px,calc(100vw-32px))] flex-col overflow-hidden rounded-2xl border border-border bg-popover text-foreground shadow-float outline-none"+ >+ <Dialog.Title className="sr-only">{t("nav.settings")}</Dialog.Title>+ <SettingsHubView onClose={onClose} />+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog.Root>+ );+}