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(ui): drop theme, restart, own-window and panel toggles from the caption

rubenluetke10-beepfc7c666c4890
diff --git a/jarvis/ui/web/frontend/src/App.tsx b/jarvis/ui/web/frontend/src/App.tsx
index 4db639a9bc..7755221a47 100644
--- a/jarvis/ui/web/frontend/src/App.tsx
+++ b/jarvis/ui/web/frontend/src/App.tsx
@@ -1,4 +1,3 @@
-import { useSocietyShell } from "@/store/societyShell";
import { Suspense, lazy, useCallback, useEffect, useState } from "react";
import { isSectionId, useEventStore } from "@/store/events";
@@ -13,7 +12,6 @@ import { useSectionUrlMemory } from "@/hooks/useSectionUrlMemory";
import {
Sidebar,
SIDEBAR_DEFAULT_WIDTH,
- SIDEBAR_RAIL_AT_WIDTH,
SIDEBAR_RAIL_WIDTH,
SIDEBAR_WIDTH_STORAGE_KEY,
} from "@/components/layout/Sidebar";
@@ -234,8 +232,8 @@ export default function App() {
* The sidebar starts EXPANDED (2026-08-23 — it used to start as the icon
* rail). The front page's own controls live in it now: the Voice | Chat
* switch, "New chat", the recent runs and chats. A rail would hide the one
- * switch the page is built around. Collapsing is still one click away and
- * is remembered.
+ * switch the page is built around. A rail left by an earlier version is
+ * still honored until the seam is dragged.
*
* Persisted separately from the drag width on purpose: expanding restores the
* column the user sized, not the designed default. A storage read that throws
@@ -249,17 +247,6 @@ export default function App() {
return false;
}
});
- const toggleNav = useCallback(() => {
- setNavCollapsed((current) => {
- const next = !current;
- try {
- window.localStorage.setItem(NAV_COLLAPSED_KEY, next ? "true" : "false");
- } catch {
- /* storage unavailable — the choice simply does not survive a restart */
- }
- return next;
- });
- }, []);
// Dragging the seam is itself an "I want the sidebar" gesture: a drag that
// left the rail state behind would snap straight back to icons and read as a
// broken handle.
@@ -270,7 +257,7 @@ export default function App() {
try {
window.localStorage.setItem(NAV_COLLAPSED_KEY, "false");
} catch {
- /* see above */
+ /* storage unavailable — the choice simply does not survive a restart */
}
}
sidebar.startResize(event);
@@ -279,28 +266,8 @@ export default function App() {
);
const activeSection = useEventStore((s) => s.activeSection);
- const agentsNavOpen = useSocietyShell((s) => s.navigationOpen);
- const toggleAgentsNav = useSocietyShell((s) => s.toggleNavigation);
- const hideNavigation = activeSection === "agents" && !agentsNavOpen;
const solo = useEventStore((s) => s.solo);
const detachedViews = useEventStore((s) => s.detachedViews);
- /*
- * The caption's leading navigation (sidebar toggle beside back/forward).
- *
- * 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 collapsed flag mirrors the rail the sidebar itself reports — a dragged
- * narrow column reads as collapsed even before the toggle was touched.
- */
- 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
@@ -366,7 +333,6 @@ export default function App() {
{brokerMounted && <SubscriptionRealtimeTransportBroker />}
<BrowserRealtimeControl controlOnly />
- {!hideNavigation && <>
<Sidebar
width={sidebar.size}
collapsed={activeSection === "agents" ? false : navCollapsed}
@@ -381,7 +347,6 @@ export default function App() {
active={sidebar.isResizing}
title="Drag to resize the sidebar — double-click to reset"
/>
- </>}
{/*
The stage column carries NO z-index, and must not get one back.
@@ -411,7 +376,7 @@ export default function App() {
it is the same class of problem: an OS-level gate the user must be
told about, since nothing else reports it. */}
<InputIsolationBanner />
- <TopBar navToggle={navToggle} />
+ <TopBar />
{!(["agentic-ide", "chat-workspace", "agentic-ide-classic"].includes(activeSection)) && <VoiceWarmingBanner />}
<SectionStage visualization={visualizationActive}>
<MainView />
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx
index b703bd8823..55cfed4416 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx
@@ -2,7 +2,6 @@ import { act, cleanup, fireEvent, render, screen } from "@testing-library/react"
import { useIdeChatStore } from "@/store/ideChat";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { IdeSidePanelFrame } from "./IdeSidePanel";
-import { IdeSidePanelToggle } from "./IdeSidePanelToggle";
import { useEventStore } from "@/store/events";
import { useIdeProjectsStore } from "@/store/ideProjects";
import { useIdeSidePanelStore } from "@/store/ideSidePanel";
@@ -26,7 +25,6 @@ vi.mock("@/components/society/office/OfficeStage", () => ({
function Harness() {
return (
<>
- <IdeSidePanelToggle />
<IdeSidePanelFrame>
<div data-testid="grid">grid</div>
</IdeSidePanelFrame>
@@ -68,7 +66,7 @@ describe("IdeSidePanel", () => {
fireEvent.click(screen.getByTestId("ide-side-panel-collapse"));
expect(screen.getByTestId(`shell-${first.id}`)).toBe(firstNode);
expect(firstNode.dataset.active).toBe("false");
- fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));
+ fireEvent.click(screen.getByTestId("ide-side-panel-rail-agents"));
fireEvent.click(screen.getByTestId(`ide-side-panel-tab-${first.id}`));
expect(firstNode.dataset.active).toBe("true");
fireEvent.click(screen.getByTestId(`ide-side-panel-close-${second.id}`));
@@ -103,12 +101,12 @@ describe("IdeSidePanel", () => {
expect((screen.getByTestId("ide-side-panel-add-terminal") as HTMLButtonElement).disabled).toBe(true);
});
- it("opens from the caption toggle and closes from its own header", () => {
+ it("opens from its rail and closes from its own header", () => {
render(<Harness />);
expect(screen.queryByTestId("ide-side-panel")).toBeNull();
expect(screen.getByTestId("ide-side-panel-host").style.width).toBe("0px");
- fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));
+ fireEvent.click(screen.getByTestId("ide-side-panel-rail-agents"));
expect(screen.getByTestId("ide-side-panel")).toBeTruthy();
expect(screen.getByTestId("ide-side-panel-tab-agents").getAttribute("aria-selected")).toBe("true");
expect(screen.getByTestId("ide-workspace-agents")).toBeTruthy();
@@ -123,7 +121,7 @@ describe("IdeSidePanel", () => {
it("keeps the grid mounted while the panel opens and closes", () => {
render(<Harness />);
const grid = screen.getByTestId("grid");
- fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));
+ fireEvent.click(screen.getByTestId("ide-side-panel-rail-agents"));
fireEvent.click(screen.getByTestId("ide-side-panel-collapse"));
expect(screen.getByTestId("grid")).toBe(grid);
});
@@ -133,7 +131,7 @@ describe("IdeSidePanel", () => {
render(<Harness />);
fireEvent.click(screen.getByTestId("ide-side-panel-close-agents"));
expect(screen.queryByTestId("ide-side-panel")).toBeNull();
- fireEvent.click(screen.getByTestId("ide-side-panel-toggle"));
+ fireEvent.click(screen.getByTestId("ide-side-panel-rail-agents"));
expect(screen.getByTestId("ide-side-panel-tab-agents")).toBeTruthy();
});
@@ -169,12 +167,6 @@ describe("IdeSidePanel", () => {
expect(screen.getByTestId("ide-side-panel-tab-agents")).toBeTruthy();
});
- it("shows the toggle only in the Agentic IDE", () => {
- act(() => useEventStore.setState({ activeSection: "chats" }));
- render(<IdeSidePanelToggle />);
- expect(screen.queryByTestId("ide-side-panel-toggle")).toBeNull();
- });
-
it("leaves a labelled rail on the right edge while closed, and opens at the tab picked there", () => {
render(<Harness />);
const rail = screen.getByTestId("ide-side-panel-rail");
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.loading.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.loading.test.tsx
deleted file mode 100644
index 6d8e640114..0000000000
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.loading.test.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";
-import { afterEach, expect, it, vi } from "vitest";
-import { IdeSidePanelToggle } from "./IdeSidePanelToggle";
-import { SIDE_PANEL_ID } from "./sidePanelIds";
-import { useEventStore } from "@/store/events";
-import { useIdeSidePanelStore } from "@/store/ideSidePanel";
-
-const loaded = vi.hoisted(() => ({ panels: 0 }));
-vi.mock("./IdeSidePanel", () => {
- loaded.panels += 1;
- return { SIDE_PANEL_ID: "ide-side-panel" };
-});
-afterEach(cleanup);
-
-it("keeps caption controls functional without importing the IDE panel or its tab implementations", () => {
- useEventStore.setState({ activeSection: "chats" });
- useIdeSidePanelStore.setState({ open: false });
- render(<IdeSidePanelToggle />);
- expect(screen.queryByTestId("ide-side-panel-toggle")).toBeNull();
- expect(loaded.panels).toBe(0);
- act(() => useEventStore.setState({ activeSection: "agentic-ide" }));
- const toggle = screen.getByTestId("ide-side-panel-toggle");
- expect(toggle.getAttribute("aria-controls")).toBe(SIDE_PANEL_ID);
- fireEvent.click(toggle);
- expect(toggle.getAttribute("aria-expanded")).toBe("true");
- fireEvent.click(toggle);
- expect(toggle.getAttribute("aria-expanded")).toBe("false");
- expect(loaded.panels).toBe(0);
-});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.tsx
deleted file mode 100644
index ab6be2ac13..0000000000
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanelToggle.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { PanelRightClose, PanelRightOpen } from "lucide-react";
-import { useT } from "@/i18n";
-import { cn } from "@/lib/utils";
-import { useEventStore } from "@/store/events";
-import { useIdeSidePanelStore } from "@/store/ideSidePanel";
-import { SIDE_PANEL_ID } from "./sidePanelIds";
-
-/**
- * Opens and shuts the Agentic IDE's right-hand side panel.
- *
- * It lives in the window caption's right end — the mirror of the sidebar
- * toggle at the left end — so it never sits on top of a terminal pane's own
- * header buttons. Only the Agentic IDE has the panel, so only it shows this.
- */
-export function IdeSidePanelToggle({ className }: { className?: string }) {
- const t = useT();
- const activeSection = useEventStore((state) => state.activeSection);
- const open = useIdeSidePanelStore((state) => state.open);
- const toggle = useIdeSidePanelStore((state) => state.toggle);
- if (activeSection !== "agentic-ide") return null;
- const label = t(open ? "ide_side_panel.collapse" : "ide_side_panel.expand");
- const Icon = open ? PanelRightClose : PanelRightOpen;
- return (
- <button
- type="button"
- onClick={toggle}
- title={label}
- aria-label={label}
- aria-expanded={open}
- aria-controls={SIDE_PANEL_ID}
- data-testid="ide-side-panel-toggle"
- className={cn(
- "inline-flex h-8 w-8 shrink-0 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",
- open && "text-foreground",
- className,
- )}
- >
- <Icon aria-hidden className="h-4 w-4" />
- </button>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.test.tsx b/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.test.tsx
index 108733cc62..f1f718f078 100644
--- a/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.test.tsx
@@ -1,5 +1,5 @@
import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";
-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { SectionNavButtons } from "./SectionNavButtons";
import { resetSectionHistory } from "@/hooks/useSectionHistory";
@@ -21,7 +21,7 @@ beforeEach(() => {
afterEach(() => cleanup());
describe("SectionNavButtons", () => {
- it("renders back and forward with no sidebar toggle unless one is offered", () => {
+ it("renders back and forward with no sidebar toggle", () => {
render(<SectionNavButtons />);
expect(screen.getByTestId("section-nav-buttons")).toBeTruthy();
@@ -73,36 +73,6 @@ describe("SectionNavButtons", () => {
expect(forwardButton().disabled).toBe(true);
});
- it("offers the sidebar toggle with its state and hands the click to the shell", () => {
- const onToggle = vi.fn();
- const { rerender } = render(
- <SectionNavButtons sidebarToggle={{ collapsed: false, onToggle }} />,
- );
-
- const toggle = screen.getByTestId("section-nav-sidebar");
- expect(toggle.getAttribute("aria-expanded")).toBe("true");
- expect(toggle.getAttribute("aria-label")).toBeTruthy();
- fireEvent.click(toggle);
- expect(onToggle).toHaveBeenCalledTimes(1);
-
- rerender(
- <SectionNavButtons sidebarToggle={{ collapsed: true, onToggle }} />,
- );
- expect(
- screen.getByTestId("section-nav-sidebar").getAttribute("aria-expanded"),
- ).toBe("false");
- });
-
- it("keeps a caller-provided test id for the sidebar toggle", () => {
- render(
- <SectionNavButtons
- sidebarToggle={{ collapsed: true, onToggle: () => {}, testId: "settings-sidebar-toggle" }}
- />,
- );
-
- expect(screen.getByTestId("settings-sidebar-toggle")).toBeTruthy();
- });
-
it("stays out of a detached solo window", () => {
useEventStore.setState({ solo: true });
render(<SectionNavButtons />);
diff --git a/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.tsx b/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.tsx
index cd50abda1d..9438f36af4 100644
--- a/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/SectionNavButtons.tsx
@@ -1,17 +1,9 @@
-import { ArrowLeft, ArrowRight, PanelLeftClose, PanelLeftOpen } from "lucide-react";
+import { ArrowLeft, ArrowRight } from "lucide-react";
import { useT } from "@/i18n";
import { useEventStore } from "@/store/events";
import { useSectionHistory } from "@/hooks/useSectionHistory";
-/** The sidebar toggle the caption owns — state lives in the shell (App.tsx). */
-export interface SidebarToggleState {
- collapsed: boolean;
- onToggle: () => void;
- /** Test id for the button. Defaults to `section-nav-sidebar`. */
- testId?: string;
-}
-
/**
* One shape for every caption control in this group.
*
@@ -26,7 +18,7 @@ const NAV_BUTTON =
"disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted-foreground";
/**
- * The caption's leading navigation: sidebar toggle, back, forward.
+ * The caption's leading navigation: back and forward.
*
* Rendered at the far left of the window caption (see TopBar), so it is on
* screen for EVERY section — chat, agents, voice, settings — with no second
@@ -35,11 +27,7 @@ const NAV_BUTTON =
* forward only re-applies an undone step, staying disabled until one exists.
* A detached solo window is pinned to one view, so the group stays out of it.
*/
-export function SectionNavButtons({
- sidebarToggle,
-}: {
- sidebarToggle?: SidebarToggleState;
-} = {}) {
+export function SectionNavButtons() {
const t = useT();
const solo = useEventStore((s) => s.solo);
const { canGoBack, canGoForward, goBack, goForward } = useSectionHistory();
@@ -56,23 +44,6 @@ export function SectionNavButtons({
role="group"
aria-label={t("sidebar.sections")}
>
- {sidebarToggle && (
- <button
- type="button"
- data-testid={sidebarToggle.testId ?? "section-nav-sidebar"}
- onClick={sidebarToggle.onToggle}
- aria-expanded={!sidebarToggle.collapsed}
- aria-label={t(sidebarToggle.collapsed ? "sidebar.expand" : "sidebar.collapse")}
- title={t(sidebarToggle.collapsed ? "sidebar.expand" : "sidebar.collapse")}
- className={NAV_BUTTON}
- >
- {sidebarToggle.collapsed ? (
- <PanelLeftOpen className="h-4 w-4" aria-hidden />
- ) : (
- <PanelLeftClose className="h-4 w-4" aria-hidden />
- )}
- </button>
- )}
<button
type="button"
data-testid="section-nav-back"
diff --git a/jarvis/ui/web/frontend/src/components/layout/ThemeToggle.tsx b/jarvis/ui/web/frontend/src/components/layout/ThemeToggle.tsx
deleted file mode 100644
index de9ff3157e..0000000000
--- a/jarvis/ui/web/frontend/src/components/layout/ThemeToggle.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { Moon, Sun } from "lucide-react";
-
-import { useOptionalTheme } from "@/hooks/useTheme";
-import { useT } from "@/i18n";
-import { cn } from "@/lib/utils";
-
-/**
- * Light ↔ dark, one click, from the app chrome.
- *
- * The full preference (including "follow the system") stays in Settings; this
- * is the quick flip the maintainer asked for in the top bar (2026-08-23).
- * Flipping from "system" resolves to the concrete opposite of what is on
- * screen, so the button always does the visible thing.
- */
-export function ThemeToggle({ className }: { className?: string }) {
- const t = useT();
- // Outside the provider (an isolated mount) there is nothing to flip: the
- // rest of the actions keep rendering, this one steps aside.
- const ctx = useOptionalTheme();
- if (!ctx) return null;
- const { theme, toggle } = ctx;
- const dark = theme === "dark";
- const label = dark ? t("home.theme_to_light") : t("home.theme_to_dark");
- const Icon = dark ? Sun : Moon;
- return (
- <button
- type="button"
- onClick={toggle}
- title={label}
- aria-label={label}
- data-testid="theme-toggle"
- className={cn(
- // Same recipe as the rest of the bar: no fill at rest, one step up
- // under the pointer. The old version answered a hover by recolouring
- // its BORDER, which is a rim doing a fill's job.
- "inline-flex h-8 w-8 shrink-0 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-border-strong",
- className,
- )}
- >
- <Icon aria-hidden className="h-4 w-4" />
- </button>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
index f7eb806baa..fb07214f74 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
@@ -1,7 +1,6 @@
-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { cleanup, render, screen } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-import { TopBar, TopBarActions } from "./TopBar";
-import { ThemeProvider } from "@/hooks/useTheme";
+import { TopBar } from "./TopBar";
import { useEventStore } from "@/store/events";
import { resetSectionHistory } from "@/hooks/useSectionHistory";
@@ -13,7 +12,7 @@ vi.mock("@/components/MascotGigi", () => ({
}));
// The caption is on every screen. Tests still name the section so a later
-// change cannot quietly hide Restart on one of them.
+// change cannot quietly drop back/forward on one of them.
beforeEach(() => {
useEventStore.setState({
activeSection: "dictation",
@@ -23,131 +22,15 @@ beforeEach(() => {
});
afterEach(() => vi.restoreAllMocks());
-describe("TopBar detach button", () => {
- it("offers the sidebar toggle with its current state", () => {
- const onToggle = vi.fn();
- 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 navToggle={{ collapsed: false, onToggle }} />);
- expect(toggle.getAttribute("aria-expanded")).toBe("true");
- });
-
- it("offers 'own window' on the detachable sections only", () => {
+describe("TopBar caption buttons", () => {
+ it("carries no theme, restart, own-window or panel toggles", () => {
+ useEventStore.setState({ activeSection: "agentic-ide" });
render(<TopBar />);
- expect(screen.getByTestId("detach-view-button")).toBeTruthy();
-
- cleanup();
- useEventStore.setState({ activeSection: "settings" });
- render(<TopBar />);
- expect(screen.queryByTestId("detach-view-button")).toBeNull();
- });
-
- it("never renders inside a solo window (no detaching a detached view)", () => {
- useEventStore.setState({ solo: true });
- render(<TopBarActions />);
+ expect(screen.queryByTestId("theme-toggle")).toBeNull();
expect(screen.queryByTestId("detach-view-button")).toBeNull();
- });
-});
-
-describe("TopBar restart button", () => {
- it("renders a restart button labelled in the active locale", () => {
- render(<TopBar />);
- expect(
- screen.getByRole("button", { name: /restart/i }),
- ).toBeTruthy();
- });
-
- it("requires a confirming second click before it calls the backend", () => {
- const fetchMock = vi
- .fn()
- .mockResolvedValue({ ok: true, json: async () => ({ ok: true }) });
- vi.stubGlobal("fetch", fetchMock);
-
- render(<TopBar />);
- // First click only arms the confirmation — no network call yet.
- fireEvent.click(screen.getByRole("button", { name: /^restart$/i }));
- expect(fetchMock).not.toHaveBeenCalled();
- // The button now asks for confirmation.
- expect(
- screen.getByRole("button", { name: /confirm restart/i }),
- ).toBeTruthy();
- });
-
- it("POSTs to /api/settings/restart-app on the confirming click", async () => {
- const fetchMock = vi
- .fn()
- .mockResolvedValue({ ok: true, json: async () => ({ ok: true }) });
- vi.stubGlobal("fetch", fetchMock);
-
- render(<TopBar />);
- fireEvent.click(screen.getByRole("button", { name: /^restart$/i }));
- fireEvent.click(screen.getByRole("button", { name: /confirm restart/i }));
-
- await waitFor(() => {
- expect(fetchMock).toHaveBeenCalledTimes(1);
- });
- const [url, opts] = fetchMock.mock.calls[0];
- expect(url).toBe("/api/settings/restart-app");
- expect(opts?.method).toBe("POST");
- });
-
- it("on 409 surfaces running missions and the next click forces the restart", async () => {
- const fetchMock = vi
- .fn()
- .mockResolvedValueOnce({
- ok: false,
- status: 409,
- json: async () => ({
- detail: {
- error: "missions_running",
- missions: [{ id: "a", title: "research" }],
- },
- }),
- })
- .mockResolvedValueOnce({ ok: true, json: async () => ({ ok: true }) });
- vi.stubGlobal("fetch", fetchMock);
-
- render(<TopBar />);
- fireEvent.click(screen.getByRole("button", { name: /^restart$/i }));
- fireEvent.click(screen.getByRole("button", { name: /confirm restart/i }));
-
- // The guard refused: the button now offers a force restart instead.
- await waitFor(() => {
- expect(
- screen.getByRole("button", { name: /restart anyway/i }),
- ).toBeTruthy();
- });
-
- // The first POST carried NO force flag (the mission was not killed).
- expect(fetchMock.mock.calls[0][0]).not.toContain("force");
-
- // Forcing it sends force=true.
- fireEvent.click(screen.getByRole("button", { name: /restart anyway/i }));
- await waitFor(() => {
- expect(fetchMock).toHaveBeenCalledTimes(2);
- });
- expect(fetchMock.mock.calls[1][0]).toContain("force=true");
- });
-
- it("surfaces a failed restart instead of leaving the button stuck", async () => {
- const fetchMock = vi
- .fn()
- .mockResolvedValue({ ok: false, status: 503 });
- vi.stubGlobal("fetch", fetchMock);
-
- render(<TopBar />);
- fireEvent.click(screen.getByRole("button", { name: /^restart$/i }));
- fireEvent.click(screen.getByRole("button", { name: /confirm restart/i }));
-
- // After the failure the button returns to its idle, re-clickable state.
- await waitFor(() => {
- expect(
- screen.getByRole("button", { name: /^restart$/i }),
- ).toBeTruthy();
- });
+ expect(screen.queryByTestId("ide-side-panel-toggle")).toBeNull();
+ expect(screen.queryByTestId("section-nav-sidebar")).toBeNull();
+ expect(screen.queryByRole("button", { name: /restart/i })).toBeNull();
});
});
@@ -169,16 +52,6 @@ describe("TopBar section navigation", () => {
},
);
- it("offers the sidebar toggle from the caption and hands the click to the shell", () => {
- const onToggle = vi.fn();
- render(<TopBar navToggle={{ collapsed: false, onToggle }} />);
-
- const toggle = screen.getByTestId("section-nav-sidebar");
- expect(toggle.getAttribute("aria-expanded")).toBe("true");
- fireEvent.click(toggle);
- expect(onToggle).toHaveBeenCalledOnce();
- });
-
it("stays out of a detached solo window", () => {
useEventStore.setState({ solo: true });
render(<TopBar />);
@@ -188,19 +61,18 @@ describe("TopBar section navigation", () => {
describe("TopBar caption on every section", () => {
it.each(["chats", "agents", "agentic-ide-classic", "dictation"] as const)(
- "keeps restart on %s",
+ "renders the caption on %s",
(section) => {
useEventStore.setState({ activeSection: section });
render(<TopBar />);
const caption = screen.getByTestId("window-caption");
expect(caption.className).not.toContain("jarvis-shell-surface");
expect(caption).toBeTruthy();
- expect(screen.getByRole("button", { name: /^restart$/i })).toBeTruthy();
expect(screen.queryByTestId("window-close")).toBeNull();
},
);
- it("places theme and restart immediately before the window buttons", async () => {
+ it("keeps the window buttons at the right end of the caption", async () => {
(window as unknown as { pywebview?: { api: object } }).pywebview = { api: {} };
vi.stubGlobal(
"fetch",
@@ -210,17 +82,9 @@ describe("TopBar caption on every section", () => {
}),
);
- render(
- <ThemeProvider>
- <TopBar />
- </ThemeProvider>,
- );
+ render(<TopBar />);
const minimize = await screen.findByTestId("window-minimize");
- const restart = screen.getByRole("button", { name: /^restart$/i });
- const theme = screen.getByTestId("theme-toggle");
- expect(theme.compareDocumentPosition(restart) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
- expect(restart.compareDocumentPosition(minimize) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
expect(minimize.compareDocumentPosition(screen.getByTestId("window-close")) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
delete (window as unknown as { pywebview?: unknown }).pywebview;
diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
index 69b8337b1a..9d1a3314af 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useRef, useState } from "react";
-import { AppWindow, Download, RotateCw } from "lucide-react";
+import { Download } from "lucide-react";
-import { useEventStore, type SectionId } from "@/store/events";
+import { useEventStore } from "@/store/events";
import {
fetchUpdateProgress,
useUpdate,
@@ -12,29 +12,23 @@ import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
import { CodingModeBadge } from "@/components/layout/CodingModeBadge";
import { SectionNavButtons } from "@/components/layout/SectionNavButtons";
-import { ThemeToggle } from "@/components/layout/ThemeToggle";
-import { IdeSidePanelToggle } from "@/components/agentic/sidePanel/IdeSidePanelToggle";
import { useDesktopChrome, WindowControls } from "@/components/layout/WindowControls";
-import { hasEmbeddedDesktopBridge } from "@/components/voice/BrowserRealtimeControl";
-import { openExternalUrl } from "@/lib/openExternal";
/**
* The window's title strip, on every screen.
*
- * It is one thin row at the top of the window: drag the empty part to move
- * the window, and the right end holds the app buttons (theme, restart, and
- * an update when one exists) immediately beside minimize, maximize and close.
- * Sections do not grow a second bar for those buttons.
+ * It is one thin row at the top of the window: back/forward at the left, the
+ * empty middle to drag the window, and minimize, maximize and close at the
+ * right. Theme, restart and the sidebar toggles are not caption buttons; the
+ * theme lives in Settings.
*
- * The backend already ships the self-restart machinery: restart and update
- * POST to ``/api/settings/restart-app``, which spawns a detached relauncher
- * (see jarvis/ui/relauncher.py). On a headless host that endpoint returns 503
- * and we recover with an honest toast.
- *
- * A restart tears down the whole app mid-task, so both buttons honor the
- * mission guard (409 → arm a force override) rather than killing live missions
- * silently. We avoid a native ``window.confirm`` on purpose — it blocks the
- * pywebview loop.
+ * The update button below (rendered in the sidebar) restarts through
+ * ``/api/settings/restart-app``, which spawns a detached relauncher (see
+ * jarvis/ui/relauncher.py). On a headless host that endpoint returns 503 and
+ * we recover with an honest toast. A restart tears down the whole app
+ * mid-task, so it honors the mission guard (409 → arm a force override)
+ * rather than killing live missions silently. We avoid a native
+ * ``window.confirm`` on purpose — it blocks the pywebview loop.
*/
const CONFIRM_TIMEOUT_MS = 4000;
@@ -71,15 +65,7 @@ const CHROME_QUIET = "text-muted-foreground hover:bg-secondary hover:text-foregr
*/
const CHROME_ARMED = "bg-warning text-background";
-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
- * to back/forward, so the leading controls sit in the empty caption corner
- * on every section.
- */
- navToggle?: { collapsed: boolean; onToggle: () => void };
-} = {}) {
+export function TopBar() {
const chrome = useDesktopChrome();
const controls = chrome.frameless ? chrome.controls : "none";
@@ -97,7 +83,7 @@ export function TopBar({ navToggle }: {
{controls === "leading" && (
<WindowControls controls={controls} maximized={chrome.maximized} onCommand={chrome.command} />
)}
- <SectionNavButtons sidebarToggle={navToggle} />
+ <SectionNavButtons />
<div
className="pywebview-drag-region min-w-0 flex-1"
onDoubleClick={() => {
@@ -106,8 +92,6 @@ export function TopBar({ navToggle }: {
/>
<div className="flex shrink-0 items-center">
<CodingModeBadge />
- <TopBarActions />
- <IdeSidePanelToggle />
{controls === "trailing" && (
<WindowControls controls={controls} maximized={chrome.maximized} onCommand={chrome.command} />
)}
@@ -116,227 +100,6 @@ export function TopBar({ navToggle }: {
);
}
-/**
- * The app-chrome ACTIONS, without the bar around them.
- *
- * Separate from `TopBar` so a view that already has a header row can carry them
- * in it rather than under a second one. They are the same components either
- * way — a screen that had its own copy of "restart the app" would drift from
- * this one within a release.
- */
-export function TopBarActions() {
- return (
- <>
- <ThemeToggle />
- <DetachButton />
- <RestartButton />
- </>
- );
-}
-
-/**
- * The views the desktop shell can split off into their own solo window.
- * Mirrors the backend ``DETACHABLE_VIEWS`` registry (jarvis/ui/desktop_app.py)
- * — the server validates again, this set only decides where the button shows.
- */
-const DETACHABLE_SECTIONS = new Set<SectionId>([
- "agentic-ide",
- "agentic-ide-classic",
- "chat-workspace",
- "chats",
- "dictation",
- "dictionary",
- "voice-shortcuts",
- "voice-language",
- "voice-api-keys",
- "visualization",
-]);
-
-/**
- * "Open this view in its own window" — the detach entry point.
- *
- * Bridge-first like `openExternalUrl`: inside the embedded desktop shell the
- * backend spawns a real second pywebview window (WebView2 silently drops
- * `window.open`, so the frontend cannot do it itself); in a plain browser the
- * solo URL simply opens as a new tab. A shell whose webview backend cannot
- * create runtime windows answers `ok: false` with a fallback URL and the view
- * opens in the user's real browser instead — honest on every host. Idempotent:
- * re-clicking while detached focuses the existing window.
- */
-function DetachButton() {
- const t = useT();
- const activeSection = useEventStore((s) => s.activeSection);
- const solo = useEventStore((s) => s.solo);
- const pushToast = useEventStore((s) => s.pushToast);
- const [busy, setBusy] = useState(false);
-
- // A solo window never detaches further, and most sections have no solo mode.
- if (solo || !DETACHABLE_SECTIONS.has(activeSection)) return null;
-
- async function onClick() {
- if (busy) return;
- const view = activeSection;
- const soloPath = `/?view=${view}&solo=1`;
- if (!hasEmbeddedDesktopBridge()) {
- // A real browser: a tab of this same browser IS the detached window.
- window.open(soloPath, "_blank", "noopener,noreferrer");
- return;
- }
- setBusy(true);
- try {
- const res = await fetch("/api/window/detach", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ view }),
- });
- const data = (await res.json().catch(() => null)) as {
- ok?: boolean;
- fallback_url?: string;
- } | null;
- if (data?.ok) return;
- // The shell could not create a runtime window — open a browser tab.
- await openExternalUrl(
- `${window.location.origin}${data?.fallback_url ?? soloPath}`,
- );
- } catch {
- pushToast("error", t("topbar.detach_failed"));
- } finally {
- setBusy(false);
- }
- }
-
- return (
- <button
- type="button"
- onClick={() => void onClick()}
- disabled={busy}
- title={t("topbar.detach_hint")}
- data-testid="detach-view-button"
- aria-label={t("topbar.detach")}
- className={clsx(CHROME_BUTTON, "w-8 justify-center px-0", CHROME_QUIET)}
- >
- <AppWindow aria-hidden className="h-4 w-4" />
- </button>
- );
-}
-
-function RestartButton() {
- const t = useT();
- const pushToast = useEventStore((s) => s.pushToast);
- const [confirming, setConfirming] = useState(false);
- const [restarting, setRestarting] = useState(false);
- // Set when the backend refused the restart (HTTP 409) because missions are
- // running: the next click resends the POST with ``force=true``.
- const [forceArmed, setForceArmed] = useState(false);
- const resetTimer = useRef<number | null>(null);
-
- const clearResetTimer = useCallback(() => {
- if (resetTimer.current !== null) {
- clearTimeout(resetTimer.current);
- resetTimer.current = null;
- }
- }, []);
-
- // Drop a pending "disarm" timer if the bar is ever unmounted.
- useEffect(() => clearResetTimer, [clearResetTimer]);
-
- async function doRestart(force: boolean) {
- clearResetTimer();
- setRestarting(true);
- try {
- const url = force
- ? "/api/settings/restart-app?force=true"
- : "/api/settings/restart-app";
- const res = await fetch(url, { method: "POST" });
- if (res.status === 409) {
- // The mission guard refused: a restart would kill live missions. Don't
- // kill them silently — surface the count and arm a force-restart so the
- // next click is the user's explicit override.
- let count = 0;
- try {
- const body = await res.json();
- count = body?.detail?.missions?.length ?? 0;
- } catch {
- /* malformed body — still arm the override */
- }
- setRestarting(false);
- setConfirming(false);
- setForceArmed(true);
- clearResetTimer();
- resetTimer.current = window.setTimeout(() => {
- setForceArmed(false);
- resetTimer.current = null;
- }, CONFIRM_TIMEOUT_MS);
- pushToast("warning", `${count} ${t("topbar.restart_missions_running")}`);
- return;
- }
- if (!res.ok) throw new Error(`restart-failed:${res.status}`);
- // On success the window goes away — keep the spinning state; never clear
- // it, so the user doesn't see the button flip back before the app dies.
- pushToast("info", t("topbar.restarting"));
- } catch {
- // Headless host (503) or a transient failure: recover the control so the
- // user isn't left with a dead button.
- setRestarting(false);
- setConfirming(false);
- setForceArmed(false);
- pushToast("error", t("topbar.restart_failed"));
- }
- }
-
- function onClick() {
- if (restarting) return;
- if (forceArmed) {
- // The guard already refused once; this click is the explicit override.
- void doRestart(true);
- return;
- }
- if (!confirming) {
- // First click only arms the confirmation; auto-disarm after a few
- // seconds so a stray click never leaves a primed restart button behind.
- setConfirming(true);
- clearResetTimer();
- resetTimer.current = window.setTimeout(() => {
- setConfirming(false);
- resetTimer.current = null;
- }, CONFIRM_TIMEOUT_MS);
- return;
- }
- void doRestart(false);
- }
-
- const label = restarting
- ? t("topbar.restarting")
- : forceArmed
- ? t("topbar.restart_force")
- : confirming
- ? t("topbar.restart_confirm")
- : t("topbar.restart");
-
- const showLabel = confirming || forceArmed || restarting;
-
- return (
- <button
- type="button"
- onClick={onClick}
- disabled={restarting}
- title={t("topbar.restart_hint")}
- aria-label={label}
- className={clsx(
- CHROME_BUTTON,
- showLabel ? "px-3" : "w-8 justify-center px-0",
- confirming || forceArmed ? CHROME_ARMED : CHROME_QUIET,
- )}
- >
- <RotateCw
- aria-hidden
- className={cn("h-4 w-4", restarting && "animate-spin")}
- />
- {showLabel ? label : null}
- </button>
- );
-}
-
// The restart can fail transiently right after an apply (the backend is busy,
// the desktop shell still warming) — retry briefly before giving up honestly.
const RESTART_ATTEMPTS = 3;
diff --git a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts b/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
index 6d6ddf011e..abaa008aca 100644
--- a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
+++ b/jarvis/ui/web/frontend/src/store/ideSidePanel.ts
@@ -4,9 +4,8 @@ import { create } from "zustand";
* The Agentic IDE's right-hand side panel: open or shut, which tabs it holds,
* and which one is in front.
*
- * Two places need the answer and neither can reach the other by props: the
- * toggle lives in the window caption (`TopBar`), the panel itself inside the
- * IDE view. The state survives a reload through localStorage, which may be
+ * The panel, its closed-state rail and the explorer path routing all need the
+ * answer, so it lives in one store. The state survives a reload through localStorage, which may be
* blocked — every read and write degrades to the defaults instead of throwing.
*/
@@ -84,7 +83,6 @@ interface IdeSidePanelState {
terminals: SidePanelTerminal[];
addTerminalTab: (workspaceId: string, workspaceName: string) => void;
setOpen: (open: boolean) => void;
- toggle: () => void;
/** Open a tab (or bring it forward when it is already open). */
openTab: (id: SidePanelTabId) => void;
select: (id: SidePanelTabId) => void;
@@ -141,7 +139,6 @@ export const useIdeSidePanelStore = create<IdeSidePanelState>((set, get) => {
if (!open) set({ spotlight: null, maximized: false, inUse: false });
commit({ open });
},
- toggle: () => get().setOpen(!get().open),
openTab: (id) => {
const { tabs } = get();
commit({ open: true, tabs: tabs.includes(id) ? tabs : [...tabs, id], active: id });
diff --git a/jarvis/ui/web/frontend/src/store/societyShell.ts b/jarvis/ui/web/frontend/src/store/societyShell.ts
deleted file mode 100644
index 1e6e187f63..0000000000
--- a/jarvis/ui/web/frontend/src/store/societyShell.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { create } from "zustand";
-
-/** Section-local navigation starts hidden on every visit. */
-export const useSocietyShell = create<{
- navigationOpen: boolean;
- toggleNavigation: () => void;
- reset: () => void;
-}>((set) => ({
- navigationOpen: false,
- toggleNavigation: () => set((s) => ({ navigationOpen: !s.navigationOpen })),
- reset: () => set({ navigationOpen: false }),
-}));
diff --git a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
index ff2b6e4bfb..2377a7c5a6 100644
--- a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
+++ b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
@@ -2,7 +2,6 @@ import { lazy, Suspense, useCallback, useMemo, useState, useEffect } from "react
import { createPortal } from "react-dom";
import { useQueryClient } from "@tanstack/react-query";
-import { useSocietyShell } from "@/store/societyShell";
import { setMapFullscreen } from "@/lib/mapFullscreen";
import { inDesktopShell } from "@/lib/nativeDrop";
import { useLocaleChunk, useT } from "@/i18n";
@@ -121,12 +120,9 @@ export function SocietyView() {
}, []);
useEffect(() => {
- const reset = useSocietyShell.getState().reset;
- reset();
// A reload starts in Agents; restore a native window left fullscreen by it.
if (inDesktopShell()) void setMapFullscreen(false).catch(() => setFullscreenError(true));
return () => {
- reset();
void setMapFullscreen(false).catch((error) => console.warn("Fullscreen exit failed", error));
};
}, []);