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(agentic-ide): fold the app bar into the workspace's own header row

Ruben Lütkeec5cc08ff77e
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
index 34ac096877..f08f447c33 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -25,6 +25,7 @@ vi.mock("@/lib/agenticIdeApi", () => ({
closeTerminal: vi.fn(),
closeTerminals: vi.fn(),
composePrompt: vi.fn(),
+ moveTerminal: vi.fn(),
// Polled by the grid so the pane headers keep saying what their agents are
// doing. Resolves empty by default; the recap tests give it real rows.
fetchTerminalRecaps: vi.fn(async () => ({
@@ -52,6 +53,12 @@ vi.mock("@/hooks/useTheme", () => ({
useThemeValue: () => "dark",
}));
+/**
+ * The pane header's press handler, as much of it as the stub needs. Spelled out
+ * rather than borrowed from React's types so the stub stays a stub.
+ */
+type PointerEventLike = { clientX: number; clientY: number; button: number };
+
/**
* xterm needs a real canvas, so the pane is stubbed — but the stub exposes the
* same action buttons, because what these tests check is the WIRING: which call
@@ -70,6 +77,8 @@ vi.mock("./AgenticTerminal", () => ({
onToggleMaximize,
onSplit,
onClose,
+ onArrangeStart,
+ arranging,
}: {
name: string;
maximized?: boolean;
@@ -82,6 +91,8 @@ vi.mock("./AgenticTerminal", () => ({
onToggleMaximize?: () => void;
onSplit?: (direction: "right" | "down", agent?: string) => void;
onClose?: () => void;
+ onArrangeStart?: (event: PointerEventLike) => void;
+ arranging?: boolean;
}) => (
<div
data-testid={`pane-${name}`}
@@ -90,8 +101,14 @@ vi.mock("./AgenticTerminal", () => ({
data-restart-token={String(restartToken ?? 0)}
data-recap={recap ?? ""}
data-recap-detail={recapDetail ?? ""}
+ // Whether this pane offers the drag at all, and whether it is the one
+ // currently in hand — the real header draws both; here they are read.
+ data-arrangeable={onArrangeStart ? "yes" : "no"}
+ data-arranging={arranging ? "yes" : "no"}
>
{name}
+ {/* Stands for the pane header, which is the grip in the real component. */}
+ <div data-testid={`pane-drag-${name}`} onPointerDown={onArrangeStart} />
<button data-testid={`pane-maximize-${name}`} onClick={onToggleMaximize}>
max
</button>
@@ -1238,3 +1255,183 @@ describe("session recaps", () => {
);
});
});
+
+/*
+ * Rearranging the grid by dragging a pane by its header.
+ *
+ * A workspace is assembled one split at a time and ends up in the order the
+ * splits happened, not the order the work is in. The only way to fix that used
+ * to be closing a pane and opening a new one elsewhere, which kills a working
+ * agent and its whole conversation — so these tests are really about one
+ * promise: a drop changes where a pane is drawn and NOTHING else.
+ *
+ * jsdom ships neither PointerEvent nor layout, so both are supplied here: the
+ * gesture is fired as MouseEvents (which carry the coordinates a plain Event
+ * drops), and each pane cell is told where it is on screen.
+ */
+describe("rearranging panes", () => {
+ /** Give a pane cell a box, since jsdom lays nothing out. */
+ function placeCell(name: string, left: number, top: number, width = 200, height = 100) {
+ const cell = screen.getByTestId(`pane-cell-${name}`);
+ cell.getBoundingClientRect = () =>
+ ({
+ left,
+ top,
+ width,
+ height,
+ right: left + width,
+ bottom: top + height,
+ x: left,
+ y: top,
+ toJSON: () => ({}),
+ }) as DOMRect;
+ }
+
+ /** Two panes side by side, each 200×100, Mika at the origin. */
+ function twoPlacedPanes() {
+ const handles = renderGrid();
+ placeCell("Mika", 0, 0);
+ placeCell("Nova", 200, 0);
+ return handles;
+ }
+
+ function press(name: string, x: number, y: number) {
+ fireEvent(
+ screen.getByTestId(`pane-drag-${name}`),
+ new MouseEvent("pointerdown", {
+ bubbles: true,
+ clientX: x,
+ clientY: y,
+ button: 0,
+ }),
+ );
+ }
+
+ function move(x: number, y: number) {
+ act(() => {
+ window.dispatchEvent(new MouseEvent("pointermove", { clientX: x, clientY: y }));
+ });
+ }
+
+ /** Let go — awaited, so the move the drop triggers settles inside `act`. */
+ async function release() {
+ await act(async () => {
+ window.dispatchEvent(new MouseEvent("pointerup"));
+ });
+ }
+
+ it("swaps two panes when one is dropped in the middle of the other", async () => {
+ const swapped = sessionWith([
+ ["Nova", 0],
+ ["Mika", 1],
+ ]);
+ vi.mocked(api.moveTerminal).mockResolvedValue(swapped);
+ const { onSessionChanged } = twoPlacedPanes();
+
+ press("Mika", 100, 50);
+ move(300, 50); // the middle of Nova
+
+ // Mid-drag the grid says what the drop would do, before it happens.
+ expect(screen.getByTestId("pane-dropzone-Nova").dataset.zone).toBe("swap");
+ expect(screen.getByTestId("agentic-arrange-ghost").textContent).toContain("Mika");
+ expect(screen.getByTestId("pane-Mika").dataset.arranging).toBe("yes");
+
+ await release();
+
+ expect(api.moveTerminal).toHaveBeenCalledWith("Mika", "Nova", "swap");
+ await waitFor(() => expect(onSessionChanged).toHaveBeenCalledWith(swapped));
+ });
+
+ it("places a pane beside another when it is dropped near an edge", async () => {
+ vi.mocked(api.moveTerminal).mockResolvedValue(BASE);
+ twoPlacedPanes();
+
+ press("Mika", 100, 50);
+ move(205, 50); // hard against Nova's left edge
+
+ expect(screen.getByTestId("pane-dropzone-Nova").dataset.zone).toBe("left");
+
+ await release();
+
+ expect(api.moveTerminal).toHaveBeenCalledWith("Mika", "Nova", "left");
+ });
+
+ it("reads the bottom of a pane as 'put it underneath'", async () => {
+ vi.mocked(api.moveTerminal).mockResolvedValue(BASE);
+ twoPlacedPanes();
+
+ press("Mika", 100, 50);
+ move(300, 97);
+ await release();
+
+ expect(api.moveTerminal).toHaveBeenCalledWith("Mika", "Nova", "below");
+ });
+
+ it("leaves a plain click on the header alone", async () => {
+ // The header is also where a pane is clicked to focus it. A press that goes
+ // nowhere must stay a click, or every click would rearrange the grid.
+ twoPlacedPanes();
+
+ press("Mika", 100, 50);
+ move(102, 51); // inside the threshold — not a drag
+ await release();
+
+ expect(api.moveTerminal).not.toHaveBeenCalled();
+ expect(screen.queryByTestId("agentic-arrange-ghost")).toBeNull();
+ });
+
+ it("cancels the drag on Escape", async () => {
+ twoPlacedPanes();
+
+ press("Mika", 100, 50);
+ move(300, 50);
+ act(() => {
+ window.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }));
+ });
+ await release();
+
+ expect(api.moveTerminal).not.toHaveBeenCalled();
+ expect(screen.queryByTestId("agentic-arrange-ghost")).toBeNull();
+ });
+
+ it("does nothing when a pane is dropped back on itself", async () => {
+ twoPlacedPanes();
+
+ press("Mika", 100, 50);
+ move(150, 50); // still over Mika
+ await release();
+
+ expect(api.moveTerminal).not.toHaveBeenCalled();
+ });
+
+ it("offers no drag while a pane is maximized", () => {
+ // Every other pane is hidden, so there is nothing on screen to drop onto.
+ renderGrid();
+ expect(screen.getByTestId("pane-Mika").dataset.arrangeable).toBe("yes");
+
+ fireEvent.click(screen.getByTestId("pane-maximize-Mika"));
+
+ expect(screen.getByTestId("pane-Mika").dataset.arrangeable).toBe("no");
+ });
+
+ it("offers no drag in selection mode", () => {
+ // Selection mode's overlay owns every click on a pane.
+ renderGrid();
+
+ fireEvent.click(screen.getByTestId("terminal-selection-toggle"));
+
+ expect(screen.getByTestId("pane-Mika").dataset.arrangeable).toBe("no");
+ });
+
+ it("says so when the move is refused", async () => {
+ vi.mocked(api.moveTerminal).mockRejectedValue(new Error("Nova is gone."));
+ const { onSessionChanged } = twoPlacedPanes();
+
+ press("Mika", 100, 50);
+ move(300, 50);
+ await release();
+
+ await waitFor(() => expect(pushToast).toHaveBeenCalledWith("error", "Nova is gone."));
+ expect(onSessionChanged).not.toHaveBeenCalled();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index f1e7cc13e8..beaf54abb4 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -18,6 +18,7 @@ import {
ChevronUp,
FileText,
FolderGit2,
+ GripVertical,
Image as ImageIcon,
ListChecks,
Loader2,
@@ -61,12 +62,14 @@ import {
nameClipboardFile,
type PaneDropPayload,
} from "./paneDrop";
+import { usePaneArrange, type DropZone } from "./paneArrange";
import {
addTerminal,
attachToTerminal,
closeTerminal,
closeTerminals,
composePrompt,
+ moveTerminal,
clearTerminalRecap,
fetchTerminalRecaps,
refreshTerminalRecap,
@@ -112,11 +115,38 @@ interface AgenticGridProps {
* Left out (the wizard, tests) the toolbar simply names the project itself.
*/
workspaceBar?: React.ReactNode;
+ /**
+ * The app's own chrome actions (Restart, and Update when one is offered),
+ * pinned to the far right of this same row.
+ *
+ * They belong to the shell, not to this workspace — but the shell's bar does
+ * not render in this section (see TopBar), because a full-width strip holding
+ * two buttons above a wall of terminals was the third horizontal band in a
+ * row. Passing them in keeps them on screen, which is the part that matters:
+ * a frontend change reaches the user through that Restart button.
+ */
+ appActions?: React.ReactNode;
}
const FONT_MIN = 10;
const FONT_MAX = 20;
+/**
+ * The part of the hovered pane a drop would take, drawn as it will look.
+ *
+ * A label alone ("Right of Mika") is a sentence to read mid-gesture; the filled
+ * half is the answer at a glance, and it is the same shape the pane will
+ * actually have afterwards. Swap fills the whole pane because that is exactly
+ * what it takes over.
+ */
+const ZONE_BOX: Record<DropZone, string> = {
+ swap: "inset-0",
+ left: "inset-y-0 left-0 w-1/2",
+ right: "inset-y-0 right-0 w-1/2",
+ above: "inset-x-0 top-0 h-1/2",
+ below: "inset-x-0 bottom-0 h-1/2",
+};
+
/**
* How often the pane headers re-read what their agents are doing.
*
@@ -519,11 +549,46 @@ export function AgenticGrid({
}, [composerCollapsed, resizeComposer]);
const perBand = useMemo(() => bandCapacityFor(gridWidth), [gridWidth]);
- const grid = useMemo(
- () => paneGrid(session.terminals, perBand),
- [session.terminals, perBand],
+
+ /*
+ * The sizes the panes are drawn at, and the seams between them.
+ *
+ * Kept apart from the arrangement on purpose: `session.terminals` says which
+ * column and slot each pane is in and only the backend may change that, while
+ * the weights say how much room each one gets and only this browser does. A
+ * drag therefore never waits on a request, and a workspace opened on a second
+ * machine is the same arrangement at that machine's own sizes.
+ */
+ const canvasRef = useRef<HTMLDivElement | null>(null);
+ const sizes = usePaneWeights(
+ session.id,
+ useCallback(
+ () => ({
+ width: canvasRef.current?.clientWidth ?? gridWidth,
+ height: canvasRef.current?.clientHeight ?? gridHeight,
+ }),
+ [gridWidth, gridHeight],
+ ),
+ );
+ const layout = useMemo(
+ () => paneLayout(session.terminals, perBand, sizes.weights),
+ [session.terminals, perBand, sizes.weights],
);
+ /*
+ * How tall the workspace is drawn, which is not always how tall it looks.
+ *
+ * Panes take a percentage of this, so it is also the floor that keeps them
+ * readable: once the bands' tallest stacks cannot fit at `MIN_PANE_HEIGHT_PX`
+ * each, the canvas grows past the window and the workspace scrolls rather
+ * than shrinking every pane further. A maximized pane is exactly the window,
+ * so it can never end up taller than the area it is being read in.
+ */
+ const canvasHeight =
+ maximized !== null
+ ? gridHeight
+ : Math.max(gridHeight, layout.minHeightUnits * MIN_PANE_HEIGHT_PX);
+
const atLimit = session.terminals.length >= maxTerminals;
const split = async (
@@ -549,12 +614,70 @@ export function AgenticGrid({
}
};
+ /*
+ * A pane was dragged onto another one.
+ *
+ * The move is asked of the backend rather than applied here first. An
+ * optimistic reorder would be a second implementation of the placement
+ * arithmetic living in the browser, and the two would drift — the workspace on
+ * disk is what a restart brings back, so the layout the user sees has to be
+ * the layout the backend actually recorded.
+ */
+ const movePane = useCallback(
+ async (moved: string, target: string, zone: DropZone) => {
+ setWorking(true);
+ try {
+ const next = await moveTerminal(moved, target, zone);
+ // Column widths follow the panes that carried them, so a pane dropped
+ // into a wide column does not drag that column's width away with it.
+ sizes.setWeights((current) =>
+ remapColumnWeights(current, session.terminals, next.terminals),
+ );
+ onSessionChanged?.(next);
+ } catch (error) {
+ pushToast("error", (error as Error).message);
+ } finally {
+ setWorking(false);
+ }
+ },
+ [onSessionChanged, pushToast, session.terminals, sizes.setWeights],
+ );
+
+ const arrange = usePaneArrange(
+ useCallback(
+ (moved: string, target: string, zone: DropZone) => {
+ void movePane(moved, target, zone);
+ },
+ [movePane],
+ ),
+ );
+
+ /*
+ * When a pane may be picked up at all.
+ *
+ * Not while a pane is maximized (the others are hidden with CSS, so there is
+ * nothing on screen to drop onto), not in selection mode (its overlay owns
+ * every click), and not while another workspace change is still in flight —
+ * two layout writes racing would leave the grid describing neither.
+ */
+ const canArrange =
+ !selectionMode &&
+ maximized === null &&
+ !busy &&
+ !working &&
+ session.terminals.length > 1;
+
const closeOne = async (name: string) => {
setWorking(true);
try {
const next = await closeTerminal(name);
setPendingClose(null);
if (maximized === name) setMaximized(null);
+ // The surviving columns keep the widths they were dragged to; the closed
+ // pane's own height weight goes with it.
+ sizes.setWeights((current) =>
+ remapColumnWeights(current, session.terminals, next.terminals),
+ );
onSessionChanged?.(next);
if (target === name) setTarget(next.terminals.find(takesPrompts)?.name ?? "");
} catch (e) {
@@ -957,68 +1080,62 @@ export function AgenticGrid({
panes on every split, close, and wrap. With one flat container the
layout only ever changes numbers, and nothing moves in the DOM.
+ It used to be a CSS grid, which gave that property for free — but a grid
+ has ONE `grid-template-columns` shared by all of its rows, so two bands
+ could never have different column widths, and every pane in a band was
+ the same width whatever the user wanted. Fractional positioning inside
+ one container keeps the mounting guarantee and drops that ceiling.
+
The same reasoning covers maximizing: the other panes are HIDDEN with
- CSS, never removed, and the maximized one is told to span the whole
- grid instead of keeping its narrow cell.
+ CSS, never removed, and the maximized one is told to fill the container
+ instead of keeping its own rectangle.
*/}
<div
ref={gridRef}
data-testid="agentic-grid"
className={cn(
- "grid min-h-0 flex-1",
+ "relative min-h-0 flex-1",
// Scrolls only once the panes would be squeezed below a readable
// height. With a workspace that fits, this is `overflow-hidden`
// behaviour and nothing moves.
maximized !== null ? "overflow-hidden" : "overflow-y-auto scrollbar-jarvis",
+ // A drag across the grid would otherwise sweep a text selection over
+ // every header and label it crosses.
+ arrange.held !== null && "select-none",
)}
- style={{
- // Inline rather than a utility class so ONE number drives both the
- // rendered gap and the width the column count is computed from.
- gap: GRID_GAP_PX,
- padding: GRID_GAP_PX,
- // While one pane is maximized the grid IS that pane: a single track
- // filling exactly what the window shows. Spanning the full template
- // instead was wrong in a workspace large enough to scroll — the
- // tracks then add up to more than the window, so the maximized pane
- // was taller than the visible area and the terminal fitted itself to
- // rows nobody could see, putting the CLI's prompt box below the clip.
- // A grid that had been scrolled also kept its offset, so the pane
- // came up part-way past its own header.
- gridTemplateColumns:
- maximized !== null
- ? "minmax(0, 1fr)"
- : `repeat(${Math.max(1, grid.columns)}, minmax(0, 1fr))`,
- // A floor on row height, not a free 1fr. Panes used to share the
- // window height in equal parts however many there were, so a large
- // workspace ended up with three text rows per pane — readable width,
- // unusable height. Below the floor the grid grows and scrolls instead.
- gridTemplateRows:
- maximized !== null
- ? "minmax(0, 1fr)"
- : `repeat(${Math.max(1, grid.rows)}, minmax(${MIN_PANE_HEIGHT_PX}px, 1fr))`,
- }}
+ // Inline rather than a utility class so ONE number drives both the
+ // rendered outer margin and the width the column count is computed from.
+ style={{ padding: GRID_GAP_PX }}
+ >
+ {/*
+ The surface the fractions resolve against.
+
+ Separate from the scroller because the two have different heights on
+ purpose: the scroller is the window, this is the workspace, and a
+ workspace whose panes would fall below `MIN_PANE_HEIGHT_PX` grows past
+ the window and scrolls rather than shrinking them further.
+ */}
+ <div
+ ref={canvasRef}
+ data-testid="agentic-grid-canvas"
+ className="relative w-full"
+ style={{ height: canvasHeight || undefined }}
>
{session.terminals.map((term, index) => {
- const place = grid.placements[index];
+ const box = layout.boxes[index];
const isMaximized = maximized === term.name;
return (
<div
key={term.key}
+ ref={arrange.registerCell(term.name)}
data-testid={`pane-cell-${term.name}`}
className={cn(
- "relative min-h-0 min-w-0 rounded-lg",
+ "absolute min-h-0 min-w-0 rounded-lg",
selectedTerminals.has(term.name) &&
"ring-2 ring-primary ring-offset-2 ring-offset-background",
maximized !== null && !isMaximized && "hidden",
)}
- style={
- isMaximized
- ? { gridColumn: "1 / -1", gridRow: "1 / -1" }
- : {
- gridColumn: place?.column ?? 1,
- gridRow: `${place?.row ?? 1} / span ${place?.rowSpan ?? 1}`,
- }
- }
+ style={isMaximized ? MAXIMIZED_BOX : paneBoxStyle(box)}
>
<AgenticTerminal
name={term.name}
@@ -1067,9 +1184,49 @@ export function AgenticGrid({
onSplit={(direction, agent) => void split(term.name, direction, agent)}
onClose={() => setPendingClose(term.name)}
onAttachError={(message) => pushToast("error", message)}
+ // Picked up by its header, put down on another pane. Undefined
+ // rather than a disabled flag when rearranging is off, so the
+ // header goes back to being a plain header — no grab cursor
+ // promising a gesture that would do nothing.
+ onArrangeStart={
+ canArrange
+ ? (event) => arrange.start(term.name, event)
+ : undefined
+ }
+ arranging={arrange.held === term.name}
restartToken={restartTokens[term.name] ?? 0}
onRestart={() => restartPane(term.name)}
/>
+ {/* Where a drop on THIS pane would put the pane in hand. Every
+ other pane is outlined the moment a drag starts, so the grid
+ says "these are the places" before the cursor gets there, and
+ the one under the cursor fills in the half it would take. */}
+ {arrange.held !== null && arrange.held !== term.name && (
+ <div
+ data-testid={`pane-dropzone-${term.name}`}
+ data-zone={
+ arrange.hover?.target === term.name ? arrange.hover.zone : ""
+ }
+ className="pointer-events-none absolute inset-0 z-30 rounded-lg border-2 border-dashed border-primary/30"
+ >
+ {arrange.hover?.target === term.name && (
+ <>
+ <div
+ className={cn(
+ "absolute rounded-md bg-primary/25 ring-2 ring-primary transition-all",
+ ZONE_BOX[arrange.hover.zone],
+ )}
+ />
+ <span className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 whitespace-nowrap rounded-md bg-primary px-2 py-1 text-[11px] font-semibold text-primary-foreground shadow-lg">
+ {t(`agentic_grid.arrange.${arrange.hover.zone}`).replace(
+ "{0}",
+ term.name,
+ )}
+ </span>
+ </>
+ )}
+ </div>
+ )}
{selectionMode && (
<button
type="button"
@@ -1119,11 +1276,44 @@ export function AgenticGrid({
</div>
);
})}
+ {/*
+ The boundaries, and the whole reason they are their own elements.
+
+ A seam sits BETWEEN two panes rather than on the edge of one, because
+ that is the thing being moved: dragging it right widens the pane on
+ the left and narrows the one on the right by exactly as much, and no
+ other pane in the workspace changes at all. Three kinds — between two
+ columns, between two rows of columns, and between two panes stacked in
+ one column — all behave identically, which is the point.
+
+ Hidden while a pane is maximized (there is nothing to divide), while
+ panes are being selected or dragged (those gestures own the pointer),
+ and, naturally, when there is only one pane.
+ */}
+ {maximized === null &&
+ !selectionMode &&
+ arrange.held === null &&
+ layout.seams.map((seam) => (
+ <PaneResizer
+ key={seam.id}
+ testId={`pane-seam-${seam.id}`}
+ orientation={seam.orientation}
+ title={seam.label}
+ active={sizes.dragging === seam.id}
+ onPointerDown={(event) => sizes.startDrag(seam, event)}
+ onDoubleClick={() => sizes.even(seam)}
+ // An arrow key moves the seam the way it points, which for the
+ // vertical axis is the opposite of `PaneResizer`'s own sign: its
+ // default is written for a grip on a pane's own edge, where "up"
+ // means "give that pane more room".
+ onNudge={(delta) =>
+ sizes.nudge(seam, seam.orientation === "horizontal" ? -delta : delta)
+ }
+ style={seamStyle(seam)}
+ />
+ ))}
{session.terminals.length === 0 && (
- <div
- className="flex flex-col items-center justify-center gap-3 text-sm text-muted-foreground"
- style={{ gridColumn: "1 / -1", gridRow: "1 / -1" }}
- >
+ <div className="absolute inset-0 flex flex-col items-center justify-center gap-3 text-sm text-muted-foreground">
<span>Every terminal in this workspace is closed.</span>
<button
type="button"
@@ -1332,6 +1522,29 @@ export function AgenticGrid({
)}
</div>
)}
+
+ {/* The pane in hand, following the cursor.
+ A label rather than a copy of the terminal: an xterm canvas cannot be
+ cloned without a second WebSocket, and what the user needs to see mid-
+ drag is which pane they are carrying, not its output. */}
+ {arrange.held !== null && arrange.point !== null && (
+ <div
+ data-testid="agentic-arrange-ghost"
+ className="pointer-events-none fixed z-50 flex items-center gap-1.5 rounded-lg border border-primary/60 bg-card px-2.5 py-1.5 text-xs font-semibold shadow-xl"
+ style={{ left: arrange.point.x + 14, top: arrange.point.y + 14 }}
+ >
+ <GripVertical className="h-3.5 w-3.5 text-primary" />
+ {arrange.held}
+ <span className="font-normal text-muted-foreground">
+ {arrange.hover === null
+ ? t("agentic_grid.arrange.carrying")
+ : t(`agentic_grid.arrange.${arrange.hover.zone}`).replace(
+ "{0}",
+ arrange.hover.target,
+ )}
+ </span>
+ </div>
+ )}
</div>
);
}
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 a9d4028180..d675b9cfec 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
@@ -1,11 +1,15 @@
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
-import { afterEach, describe, expect, it, vi } from "vitest";
-import { TopBar } from "./TopBar";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { TopBar, TopBarActions } from "./TopBar";
+import { useEventStore } from "@/store/events";
vi.mock("@/hooks/useUpdate", () => ({
useUpdate: () => ({ status: { managed: false, update_available: false } }),
}));
+// The bar is section-aware now, so every test below states which screen it is
+// on rather than inheriting whatever a previous one left behind.
+beforeEach(() => useEventStore.setState({ activeSection: "chats" }));
afterEach(() => vi.restoreAllMocks());
describe("TopBar restart button", () => {
@@ -106,3 +110,38 @@ describe("TopBar restart button", () => {
});
});
});
+
+/*
+ * The one screen that renders these actions itself.
+ *
+ * The Agentic IDE is a wall of terminal output with a single header row, and a
+ * second full-width strip above it holding two buttons was the third horizontal
+ * band in a row. So the bar steps aside there — but the ACTIONS must not, and
+ * that is the half worth pinning: a frontend change only reaches the user
+ * through that Restart button, so a refactor that quietly drops it from the IDE
+ * would leave the section with no way to pick up its own rebuild.
+ */
+describe("TopBar in the Agentic IDE", () => {
+ it("renders no bar of its own there", () => {
+ useEventStore.setState({ activeSection: "agentic-ide" });
+
+ const { container } = render(<TopBar />);
+
+ expect(container.firstChild).toBeNull();
+ });
+
+ it("still offers the restart through the actions the IDE carries", () => {
+ useEventStore.setState({ activeSection: "agentic-ide" });
+
+ render(<TopBarActions />);
+
+ expect(screen.getByRole("button", { name: /^restart$/i })).toBeTruthy();
+ });
+
+ it("keeps its bar on every other screen", () => {
+ const { container } = render(<TopBar />);
+
+ expect(container.firstChild).not.toBeNull();
+ expect(screen.getByRole("button", { name: /^restart$/i })).toBeTruthy();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
index a8843788aa..560c77abda 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
@@ -27,10 +27,48 @@ import { CodingModeBadge } from "@/components/layout/CodingModeBadge";
* 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.
+ *
+ * **One section renders the bar itself.** The Agentic IDE is a wall of terminal
+ * output with a single header row of its own, and a second full-width bar above
+ * it holding two buttons cost that view ~40 px it had better uses for. So the
+ * IDE takes `TopBarActions` into its own row and this bar steps aside there —
+ * the actions are still on that screen, which is the rule that matters; what
+ * moved is the furniture around them. Every other view keeps the bar.
*/
const CONFIRM_TIMEOUT_MS = 4000;
export function TopBar() {
+ const activeSection = useEventStore((s) => s.activeSection);
+ if (activeSection === "agentic-ide") return null;
+
+ return (
+ <div className="flex h-10 shrink-0 items-center justify-end gap-2 border-b border-border bg-background/70 px-4 backdrop-blur-sm">
+ {/* Status, not an action — carries its own `mr-auto` so it sits at the
+ left end of this right-aligned bar and never crowds the buttons. */}
+ <CodingModeBadge />
+ <TopBarActions />
+ </div>
+ );
+}
+
+/**
+ * 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 (
+ <>
+ <UpdateButton />
+ <RestartButton />
+ </>
+ );
+}
+
+function RestartButton() {
const t = useT();
const pushToast = useEventStore((s) => s.pushToast);
const [confirming, setConfirming] = useState(false);
@@ -124,30 +162,24 @@ export function TopBar() {
: t("topbar.restart");
return (
- <div className="flex h-10 shrink-0 items-center justify-end gap-2 border-b border-border bg-background/70 px-4 backdrop-blur-sm">
- {/* Status, not an action — carries its own `mr-auto` so it sits at the
- left end of this right-aligned bar and never crowds the buttons. */}
- <CodingModeBadge />
- <UpdateButton />
- <button
- type="button"
- onClick={onClick}
- disabled={restarting}
- title={t("topbar.restart_hint")}
- className={cn(
- "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors disabled:cursor-default disabled:opacity-70",
- confirming || forceArmed
- ? "border-amber-500/60 bg-amber-500/10 text-amber-500 hover:bg-amber-500/20"
- : "border-border bg-secondary/40 text-muted-foreground hover:border-primary/50 hover:text-foreground",
- )}
- >
- <RotateCw
- aria-hidden
- className={cn("h-3.5 w-3.5", restarting && "animate-spin")}
- />
- {label}
- </button>
- </div>
+ <button
+ type="button"
+ onClick={onClick}
+ disabled={restarting}
+ title={t("topbar.restart_hint")}
+ className={cn(
+ "inline-flex shrink-0 items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors disabled:cursor-default disabled:opacity-70",
+ confirming || forceArmed
+ ? "border-amber-500/60 bg-amber-500/10 text-amber-500 hover:bg-amber-500/20"
+ : "border-border bg-secondary/40 text-muted-foreground hover:border-primary/50 hover:text-foreground",
+ )}
+ >
+ <RotateCw
+ aria-hidden
+ className={cn("h-3.5 w-3.5", restarting && "animate-spin")}
+ />
+ {label}
+ </button>
);
}