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.

refactor(agents): drop second header bar, float Map/Agents switch in caption

rubenluetke10-beepda7269ffd1ea
diff --git a/jarvis/ui/web/frontend/src/views/society/SocietyView.test.tsx b/jarvis/ui/web/frontend/src/views/society/SocietyView.test.tsx
index b782afac08..9041511efb 100644
--- a/jarvis/ui/web/frontend/src/views/society/SocietyView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/society/SocietyView.test.tsx
@@ -77,24 +77,31 @@ it("opens map selections in Agents and keeps creation available", async () => {
});
-it("floats the Map/Agents switch over the map instead of a second header bar", async () => {
+it("floats the Map/Agents switch without a second header bar", async () => {
render(<SocietyView />);
- fireEvent.click(screen.getByRole("tab", { name: "society.world.mode_map" }));
+ // Agents mode carries the switch in the window caption: no second bar, no
+ // "Back to app" — the workspace expands straight under the caption.
+ expect(screen.queryByRole("button", { name: "settings_hub.back_to_app" })).toBeNull();
+ const captionSwitch = screen.getByTestId("agents-mode-switch");
+ expect(within(captionSwitch).getByRole("tab", { name: "society.world.mode_map" })).toBeTruthy();
+ fireEvent.click(within(captionSwitch).getByRole("tab", { name: "society.world.mode_map" }));
const map = await screen.findByTestId("map");
- // The section header bar (with "Back to app") is gone in Map mode: the
- // canvas starts directly under the window caption.
+ // The switch rides along into the map HUD, so Map stays closable.
+ expect(screen.queryByTestId("agents-mode-switch")).toBeNull();
expect(screen.queryByRole("button", { name: "settings_hub.back_to_app" })).toBeNull();
- // The switch itself rides along into the map HUD, so Map stays closable.
expect(within(map).getByRole("tab", { name: "society.roster.title" })).toBeTruthy();
fireEvent.click(within(map).getByRole("tab", { name: "society.roster.title" }));
expect(screen.queryByTestId("map")).toBeNull();
- expect(screen.getByRole("button", { name: "settings_hub.back_to_app" })).toBeTruthy();
+ expect(screen.getByTestId("agents-mode-switch")).toBeTruthy();
+ expect(screen.queryByRole("button", { name: "settings_hub.back_to_app" })).toBeNull();
});
-it("offers a way back to the app instead of a sections toggle", () => {
+it("navigates back through the window caption instead of a sections toggle", () => {
render(<SocietyView />);
expect(screen.queryByRole("button", { name: "society.world.toggle_sections" })).toBeNull();
- expect(screen.getByRole("button", { name: "settings_hub.back_to_app" })).toBeTruthy();
+ expect(screen.queryByRole("button", { name: "settings_hub.back_to_app" })).toBeNull();
+ // The caption sidebar toggle (owned by TopBar) is the way back to the app.
+ expect(screen.getByTestId("agents-mode-switch")).toBeTruthy();
});
it("requests fullscreen for Map and leaves it on Escape", async () => {
diff --git a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
index 2c0a48f0c5..9f0e86f79a 100644
--- a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
+++ b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
@@ -1,7 +1,5 @@
import { lazy, Suspense, useCallback, useMemo, useState, useEffect } from "react";
-import { ArrowLeft } from "lucide-react";
-import { useEventStore } from "@/store/events";
import { useSocietyShell } from "@/store/societyShell";
import { setMapFullscreen } from "@/lib/mapFullscreen";
import { inDesktopShell } from "@/lib/nativeDrop";
@@ -54,14 +52,6 @@ export function SocietyView() {
setCreating(false);
}, []);
- const setActive = useEventStore((s) => s.setActiveSection);
- const backToApp = (
- <button type="button" onClick={() => setActive("chats")}
- className="relative z-10 flex h-6 items-center gap-1.5 rounded-md px-1.5 text-sm 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>
- );
const [fullscreenError, setFullscreenError] = useState(false);
const switchMode = useCallback((next: "agents" | "world") => {
setMode(next);
@@ -124,9 +114,8 @@ export function SocietyView() {
<div className={mode === "world" ? "fixed inset-x-0 bottom-0 top-8 z-30 flex flex-col bg-background" : "flex h-full min-h-0 w-full flex-col"} data-testid="society-view">
<div className="flex min-h-0 min-w-0 flex-1 flex-col">
{mode === "agents" && (
- <div className="relative flex h-8 shrink-0 items-center px-2">
- {backToApp}
- <div className="absolute left-1/2 -translate-x-1/2">{modeSwitch}</div>
+ <div className="pointer-events-none fixed inset-x-0 top-0 z-[130] flex h-8 items-center justify-center" data-testid="agents-mode-switch">
+ <div className="pointer-events-auto">{modeSwitch}</div>
</div>
)}
{fullscreenError && <p role="alert" className="bg-card px-4 py-2 text-sm text-destructive">{t("society.world.fullscreen_failed")}</p>}