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(society): icon-only caption switch on the Agents page

rubenluetke10-beep9bd5f1c5001b
diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx
index ea79806826..a05be7f86d 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/IdeLayoutSwitch.tsx
@@ -1,6 +1,10 @@
import { useRef } from "react";
import { Building2, LayoutGrid, MessagesSquare } from "lucide-react";
import { cn } from "@/lib/utils";
+import {
+ CAPTION_ICON_CLASS, CAPTION_ICON_STROKE, CAPTION_SEGMENT, CAPTION_SEGMENT_OFF, CAPTION_SEGMENT_ON,
+ CAPTION_SEGMENT_PX as SEGMENT_PX, CAPTION_THUMB, CAPTION_TRACK,
+} from "@/components/layout/captionSwitch";
import { useIdeSidePanelStore, type SidePanelTabId } from "@/store/ideSidePanel";
import { useIdeThreadsStore, type IdeLayout } from "@/store/ideThreads";
@@ -12,9 +16,6 @@ const CHOICES: { choice: Choice; label: string; Icon: typeof LayoutGrid }[] = [
{ choice: "verse", label: "Jarvis Verse", Icon: Building2 },
];
-/** Width of one segment; the sliding thumb moves by exactly this much. */
-const SEGMENT_PX = 40;
-
/** How the side panel stood before the Verse took the whole view. */
interface PanelBefore {
open: boolean;
@@ -70,19 +71,16 @@ export function IdeLayoutSwitch({ className }: { className?: string }) {
};
return <div role="radiogroup" aria-label="IDE layout" data-testid="ide-layout-switch"
- className={cn("relative flex h-7 items-center rounded-full border border-border bg-secondary/70 p-[3px] shadow-rim dark:bg-card", className)}>
+ className={cn(CAPTION_TRACK, className)}>
<span aria-hidden
style={{ width: SEGMENT_PX, transform: `translateX(${index * SEGMENT_PX}px)` }}
- className="absolute inset-y-[3px] left-[3px] rounded-full border border-border-strong/60 bg-background shadow-[0_1px_2px_rgb(var(--scrim-rgb)/0.25)] dark:border-border-strong dark:bg-surface-raised transition-transform duration-200 ease-out motion-reduce:transition-none" />
+ className={CAPTION_THUMB} />
{CHOICES.map(({ choice, label, Icon }) => <button key={choice} type="button" role="radio"
data-testid={`ide-layout-${choice}`} aria-checked={current === choice} aria-label={label} title={label}
onClick={() => pick(choice)}
style={{ width: SEGMENT_PX }}
- className={cn(
- "relative z-[1] flex h-full items-center justify-center rounded-full transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- current === choice ? "text-foreground-strong" : "text-muted-foreground hover:text-foreground",
- )}>
- <Icon aria-hidden className="h-4 w-4" strokeWidth={1.9} />
+ className={cn(CAPTION_SEGMENT, current === choice ? CAPTION_SEGMENT_ON : CAPTION_SEGMENT_OFF)}>
+ <Icon aria-hidden className={CAPTION_ICON_CLASS} strokeWidth={CAPTION_ICON_STROKE} />
</button>)}
</div>;
}
diff --git a/jarvis/ui/web/frontend/src/components/layout/captionSwitch.ts b/jarvis/ui/web/frontend/src/components/layout/captionSwitch.ts
new file mode 100644
index 0000000000..9b29e0f5db
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/layout/captionSwitch.ts
@@ -0,0 +1,35 @@
+/**
+ * The look of an icon switch that sits in the middle of the window caption —
+ * the Agentic IDE's grid / threads / Verse switch and the Agents page's
+ * Verse / agents switch share it, so both read as the same control.
+ *
+ * A rounded track, one thumb that slides under the segment that is on, and
+ * icon-only segments of a fixed width (the thumb moves by exactly that much).
+ */
+
+/** Width of one segment; the sliding thumb moves by exactly this much. */
+export const CAPTION_SEGMENT_PX = 40;
+
+export const CAPTION_TRACK =
+ "relative flex h-7 items-center rounded-full border border-border bg-secondary/70 p-[3px] shadow-rim dark:bg-card";
+
+export const CAPTION_THUMB =
+ "absolute inset-y-[3px] left-[3px] rounded-full border border-border-strong/60 bg-background " +
+ "shadow-[0_1px_2px_rgb(var(--scrim-rgb)/0.25)] dark:border-border-strong dark:bg-surface-raised " +
+ "transition-transform duration-200 ease-out motion-reduce:transition-none";
+
+export const CAPTION_SEGMENT =
+ "relative z-[1] flex h-full items-center justify-center rounded-full transition-colors duration-150 " +
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
+
+export const CAPTION_SEGMENT_ON = "text-foreground-strong";
+export const CAPTION_SEGMENT_OFF = "text-muted-foreground hover:text-foreground";
+
+/** A lone round icon button beside a caption switch, on the same track. */
+export const CAPTION_ICON_BUTTON =
+ "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border bg-secondary/70 " +
+ "text-muted-foreground shadow-rim transition-colors duration-150 hover:text-foreground dark:bg-card " +
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
+
+export const CAPTION_ICON_CLASS = "h-4 w-4";
+export const CAPTION_ICON_STROKE = 1.9;
diff --git a/jarvis/ui/web/frontend/src/components/society/browser/BrowserProfilesButton.tsx b/jarvis/ui/web/frontend/src/components/society/browser/BrowserProfilesButton.tsx
index fc83c8828c..4a56e39cfc 100644
--- a/jarvis/ui/web/frontend/src/components/society/browser/BrowserProfilesButton.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/browser/BrowserProfilesButton.tsx
@@ -2,22 +2,32 @@ import { lazy, Suspense, useState } from "react";
import { Globe } from "lucide-react";
import { useLocaleChunk, useT } from "@/i18n";
import { cn } from "@/lib/utils";
+import { CAPTION_ICON_BUTTON, CAPTION_ICON_CLASS, CAPTION_ICON_STROKE } from "@/components/layout/captionSwitch";
const BrowserProfilesDialog = lazy(() => import("./BrowserProfilesDialog"));
-/** No profile request or browser launch until the user opens the manager. */
-export function BrowserProfilesButton({ agentId, className, connectChrome = false }: {
- agentId?: string; className?: string; connectChrome?: boolean;
+/**
+ * No profile request or browser launch until the user opens the manager.
+ *
+ * `iconOnly`: the round globe button that sits beside the window caption's
+ * switch; the name stays on as its accessible label and hover title.
+ */
+export function BrowserProfilesButton({ agentId, className, connectChrome = false, iconOnly = false }: {
+ agentId?: string; className?: string; connectChrome?: boolean; iconOnly?: boolean;
}) {
const t = useT();
useLocaleChunk("society");
const [open, setOpen] = useState(false);
+ const label = t(connectChrome ? "society.browser_profiles.connect_supported_chrome" : "society.browser_profiles.title");
return <>
- <button type="button" onClick={() => setOpen(true)}
+ {iconOnly ? <button type="button" onClick={() => setOpen(true)} aria-label={label} title={label}
+ data-testid="browser-profiles-button" className={cn(CAPTION_ICON_BUTTON, className)}>
+ <Globe aria-hidden className={CAPTION_ICON_CLASS} strokeWidth={CAPTION_ICON_STROKE} />
+ </button> : <button type="button" onClick={() => setOpen(true)}
className={cn("inline-flex items-center justify-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className)}>
<Globe size={13} aria-hidden="true" />
- {t(connectChrome ? "society.browser_profiles.connect_supported_chrome" : "society.browser_profiles.title")}
- </button>
+ {label}
+ </button>}
{open && <Suspense fallback={<span role="status" className="text-xs text-muted-foreground">{t("society.browser_profiles.loading")}</span>}>
<BrowserProfilesDialog agentId={agentId} connectChrome={connectChrome} onClose={() => setOpen(false)} />
</Suspense>}
diff --git a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
index 2377a7c5a6..7b7ff278df 100644
--- a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
+++ b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx
@@ -1,10 +1,16 @@
import { lazy, Suspense, useCallback, useMemo, useState, useEffect } from "react";
import { createPortal } from "react-dom";
import { useQueryClient } from "@tanstack/react-query";
+import { Building2, Users } from "lucide-react";
import { setMapFullscreen } from "@/lib/mapFullscreen";
import { inDesktopShell } from "@/lib/nativeDrop";
import { useLocaleChunk, useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+import {
+ CAPTION_ICON_CLASS, CAPTION_ICON_STROKE, CAPTION_SEGMENT, CAPTION_SEGMENT_OFF, CAPTION_SEGMENT_ON,
+ CAPTION_SEGMENT_PX, CAPTION_THUMB, CAPTION_TRACK,
+} from "@/components/layout/captionSwitch";
import { AgentCardOverlay } from "@/components/society/card/AgentCardOverlay";
import { BrowserProfilesButton } from "@/components/society/browser/BrowserProfilesButton";
import { BUILDING_CARDS, isBuildingPlace, type BuildingPlace } from "@/components/society/card/buildingCards";
@@ -19,6 +25,12 @@ import { createSocietyChatGroup, updateSocietyChatGroup, useSocietyChatGroups }
import { CanvasActivity } from "@/hooks/useCanvasAwake";
import { forgetLastAgentId, rememberLastAgentId, storedLastAgentId } from "./lastAgent";
+/** The page's two faces, in caption order: the Verse map, then the agent roster. */
+const MODES = [
+ { value: "world", labelKey: "society.world.mode_map", Icon: Building2 },
+ { value: "agents", labelKey: "society.roster.title", Icon: Users },
+] as const;
+
const JarvisAgentsBoard = lazy(() =>
import("@/views/JarvisAgentsView").then((m) => ({ default: m.JarvisAgentsView })),
);
@@ -155,13 +167,21 @@ export function SocietyView() {
if (isBuildingPlace(place)) setOpenPlace(place);
}, []);
+ // Icon-only, in the same caption look as the Agentic IDE's switch; the
+ // names live on as the accessible label and the hover title.
+ const modeIndex = MODES.findIndex((item) => item.value === mode);
const modeSwitch = (
- <div role="tablist" aria-label={t("society.world.mode_label")} className="flex items-center gap-0.5 rounded-md border border-border/60 bg-background/80 p-0.5 backdrop-blur-sm">
- {(["world", "agents"] as const).map((value) => {
+ <div role="tablist" aria-label={t("society.world.mode_label")} className={CAPTION_TRACK}>
+ <span aria-hidden className={CAPTION_THUMB}
+ style={{ width: CAPTION_SEGMENT_PX, transform: `translateX(${Math.max(0, modeIndex) * CAPTION_SEGMENT_PX}px)` }} />
+ {MODES.map(({ value, labelKey, Icon }) => {
+ const label = t(labelKey);
return <button key={value} type="button" role="tab" aria-selected={mode === value}
+ aria-label={label} title={label} data-testid={`society-mode-${value}`}
onClick={() => switchMode(value)}
- className={`inline-flex h-5 items-center justify-center rounded px-2 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${mode === value ? "bg-secondary text-foreground" : "text-muted-foreground hover:text-foreground"}`}>
- {t(value === "world" ? "society.world.mode_map" : "society.roster.title")}
+ style={{ width: CAPTION_SEGMENT_PX }}
+ className={cn(CAPTION_SEGMENT, mode === value ? CAPTION_SEGMENT_ON : CAPTION_SEGMENT_OFF)}>
+ <Icon aria-hidden className={CAPTION_ICON_CLASS} strokeWidth={CAPTION_ICON_STROKE} />
</button>;
})}
</div>
@@ -176,7 +196,7 @@ export function SocietyView() {
modes — one switch, always centered, always a way back. */}
{createPortal(
<div className="pointer-events-none fixed inset-x-0 top-0 z-[140] flex h-8 items-center justify-center" data-testid="mode-switch">
- <div className="pointer-events-auto flex items-center gap-2">{modeSwitch}<BrowserProfilesButton className="h-6" /></div>
+ <div className="pointer-events-auto flex items-center gap-2">{modeSwitch}<BrowserProfilesButton iconOnly /></div>
</div>,
document.body,
)}