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(nav): one icon rail for the deck and the collapsed sidebar — steady, silent

Haraldd69e901863d0
diff --git a/jarvis/ui/web/frontend/src/components/deck/DeckDock.test.tsx b/jarvis/ui/web/frontend/src/components/deck/DeckDock.test.tsx
deleted file mode 100644
index 4d9fb72a26..0000000000
--- a/jarvis/ui/web/frontend/src/components/deck/DeckDock.test.tsx
+++ /dev/null
@@ -1,135 +0,0 @@
-import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
-
-import { DECK_DOCK_GEOMETRY, DeckDock } from "@/components/deck/DeckDock";
-import { NAV_GROUPS } from "@/components/layout/navGroups";
-import { useEventStore } from "@/store/events";
-
-// usePluginAttention polls /api/marketplace/plugins; the dock's attention pip
-// is not under test here, so keep it quiet.
-vi.mock("@/hooks/usePluginAttention", () => ({
- usePluginAttention: () => ({ count: 0, names: [] }),
-}));
-
-// The tick is WebAudio; here only WHEN it fires matters.
-const soundMock = vi.hoisted(() => ({ playDockTick: vi.fn() }));
-vi.mock("@/lib/sound", () => ({ playDockTick: soundMock.playDockTick }));
-
-const ITEMS = NAV_GROUPS.flat();
-const { BASE, GAP, PAD_TOP } = DECK_DOCK_GEOMETRY;
-
-/** clientY that lands on the centre of icon `i` (jsdom rects sit at 0,0). */
-function centreOf(i: number): number {
- return PAD_TOP + GAP + i * (BASE + GAP) + BASE / 2;
-}
-
-/** jsdom has no PointerEvent; a MouseEvent under the pointer name carries the
- * clientY the dock reads. */
-function moveTo(rail: HTMLElement, clientY: number) {
- act(() => {
- rail.dispatchEvent(new MouseEvent("pointermove", { bubbles: true, clientY }));
- });
-}
-function leave(rail: HTMLElement) {
- act(() => {
- // React derives onPointerLeave from pointerout + relatedTarget.
- rail.dispatchEvent(
- new MouseEvent("pointerout", { bubbles: true, relatedTarget: document.body }),
- );
- });
-}
-
-function renderDock() {
- const client = new QueryClient({
- defaultOptions: { queries: { retry: false }, mutations: { retry: false } },
- });
- return render(
- <QueryClientProvider client={client}>
- <DeckDock />
- </QueryClientProvider>,
- );
-}
-
-describe("DeckDock", () => {
- beforeEach(() => {
- soundMock.playDockTick.mockClear();
- useEventStore.setState({ activeSection: "chats", conversations: [] });
- });
- afterEach(() => cleanup());
-
- test("shows every section of the sidebar's NAV_GROUPS as one named button", () => {
- renderDock();
- for (const item of ITEMS) {
- expect(screen.getByTestId(`deck-dock-${item.id}`)).toBeTruthy();
- }
- expect(screen.getAllByRole("button")).toHaveLength(ITEMS.length);
- expect(screen.getByTestId("deck-dock-chats").getAttribute("aria-current")).toBe("page");
- // No native title: the dock draws its own label, and a browser tooltip on
- // top of it would be a second, late label.
- expect(screen.getByTestId("deck-dock-chats").getAttribute("title")).toBeNull();
- });
-
- test("hovering names exactly one icon, and crossing to the next one ticks once", () => {
- renderDock();
- const rail = screen.getByTestId("deck-dock-rail");
-
- expect(screen.queryByTestId("deck-dock-label")).toBeNull();
-
- moveTo(rail, centreOf(2));
- let labels = screen.getAllByTestId("deck-dock-label");
- expect(labels).toHaveLength(1);
- expect(labels[0].textContent).toContain(
- screen.getByTestId(`deck-dock-${ITEMS[2].id}`).getAttribute("aria-label"),
- );
- expect(soundMock.playDockTick).toHaveBeenCalledTimes(1);
- expect(soundMock.playDockTick).toHaveBeenLastCalledWith("hover");
-
- // Moving WITHIN the same icon is not a notch.
- moveTo(rail, centreOf(2) + 6);
- expect(soundMock.playDockTick).toHaveBeenCalledTimes(1);
-
- moveTo(rail, centreOf(3));
- labels = screen.getAllByTestId("deck-dock-label");
- expect(labels).toHaveLength(1);
- expect(labels[0].textContent).toContain(
- screen.getByTestId(`deck-dock-${ITEMS[3].id}`).getAttribute("aria-label"),
- );
- expect(soundMock.playDockTick).toHaveBeenCalledTimes(2);
- });
-
- test("leaving the rail takes the label away without a tick", async () => {
- renderDock();
- const rail = screen.getByTestId("deck-dock-rail");
- moveTo(rail, centreOf(1));
- expect(screen.getAllByTestId("deck-dock-label")).toHaveLength(1);
- leave(rail);
- await waitFor(() => expect(screen.queryByTestId("deck-dock-label")).toBeNull(), {
- timeout: 2000,
- });
- expect(soundMock.playDockTick).toHaveBeenCalledTimes(1);
- });
-
- test("picking an icon jumps to its section with the firmer tick", () => {
- renderDock();
- act(() => {
- fireEvent.click(screen.getByTestId("deck-dock-tasks"));
- });
- expect(useEventStore.getState().activeSection).toBe("tasks");
- expect(soundMock.playDockTick).toHaveBeenLastCalledWith("select");
- });
-
- test("keyboard focus names the icon too, so the rail is not a row of blank glyphs", () => {
- renderDock();
- act(() => {
- fireEvent.focus(screen.getByTestId("deck-dock-docs"));
- });
- const labels = screen.getAllByTestId("deck-dock-label");
- expect(labels).toHaveLength(1);
- expect(labels[0].textContent).toContain(
- screen.getByTestId("deck-dock-docs").getAttribute("aria-label"),
- );
- // Focus is not a notch.
- expect(soundMock.playDockTick).not.toHaveBeenCalled();
- });
-});
diff --git a/jarvis/ui/web/frontend/src/components/layout/DockRail.test.tsx b/jarvis/ui/web/frontend/src/components/layout/DockRail.test.tsx
new file mode 100644
index 0000000000..43e2b59b9f
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/layout/DockRail.test.tsx
@@ -0,0 +1,151 @@
+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+
+import { DOCK_RAIL_GEOMETRY, DockRail } from "@/components/layout/DockRail";
+import { NAV_GROUPS } from "@/components/layout/navGroups";
+import { useEventStore } from "@/store/events";
+
+// usePluginAttention polls /api/marketplace/plugins; the test drives it.
+const pluginAttentionMock = vi.hoisted(() => ({ needsReconnect: false }));
+vi.mock("@/hooks/usePluginAttention", () => ({
+ usePluginAttention: () =>
+ pluginAttentionMock.needsReconnect
+ ? { count: 1, names: ["Cloudflare"] }
+ : { count: 0, names: [] },
+}));
+
+const ITEMS = NAV_GROUPS.flat();
+const { BASE, GAP, PAD_TOP } = DOCK_RAIL_GEOMETRY;
+
+/** clientY that lands on the centre of icon `i` (jsdom rects sit at 0,0). */
+function centreOf(i: number): number {
+ return PAD_TOP + GAP + i * (BASE + GAP) + BASE / 2;
+}
+
+/** jsdom has no PointerEvent; a MouseEvent under the pointer name carries the
+ * clientY the rail reads. */
+function moveTo(rail: HTMLElement, clientY: number) {
+ act(() => {
+ rail.dispatchEvent(new MouseEvent("pointermove", { bubbles: true, clientY }));
+ });
+}
+function leave(rail: HTMLElement) {
+ act(() => {
+ // React derives onPointerLeave from pointerout + relatedTarget.
+ rail.dispatchEvent(
+ new MouseEvent("pointerout", { bubbles: true, relatedTarget: document.body }),
+ );
+ });
+}
+
+function renderRail() {
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false }, mutations: { retry: false } },
+ });
+ return render(
+ <QueryClientProvider client={client}>
+ <DockRail />
+ </QueryClientProvider>,
+ );
+}
+
+describe("DockRail", () => {
+ beforeEach(() => {
+ pluginAttentionMock.needsReconnect = false;
+ useEventStore.setState({ activeSection: "chats", conversations: [] });
+ });
+ afterEach(() => cleanup());
+
+ test("shows every section of the sidebar's NAV_GROUPS as one named button", () => {
+ renderRail();
+ for (const item of ITEMS) {
+ expect(screen.getByTestId(`nav-row-${item.id}`)).toBeTruthy();
+ }
+ expect(screen.getAllByRole("button")).toHaveLength(ITEMS.length);
+ expect(screen.getByTestId("nav-row-chats").getAttribute("aria-current")).toBe("page");
+ // No native title: the rail draws its own label, and a browser tooltip on
+ // top of it would be a second, late label.
+ expect(screen.getByTestId("nav-row-chats").getAttribute("title")).toBeNull();
+ });
+
+ test("keeps the active control on the app's glass surface", () => {
+ renderRail();
+ expect(screen.getByTestId("nav-row-chats").classList).toContain("jarvis-message-surface");
+ expect(screen.getByTestId("nav-row-tasks").classList).not.toContain(
+ "jarvis-message-surface",
+ );
+ });
+
+ test("hovering names exactly one icon, and crossing to the next one renames it", () => {
+ renderRail();
+ const rail = screen.getByTestId("dock-rail");
+
+ expect(screen.queryByTestId("dock-label")).toBeNull();
+
+ moveTo(rail, centreOf(2));
+ let labels = screen.getAllByTestId("dock-label");
+ expect(labels).toHaveLength(1);
+ expect(labels[0].textContent).toContain(
+ screen.getByTestId(`nav-row-${ITEMS[2].id}`).getAttribute("aria-label"),
+ );
+
+ moveTo(rail, centreOf(3));
+ labels = screen.getAllByTestId("dock-label");
+ expect(labels).toHaveLength(1);
+ expect(labels[0].textContent).toContain(
+ screen.getByTestId(`nav-row-${ITEMS[3].id}`).getAttribute("aria-label"),
+ );
+ });
+
+ test("leaving the rail takes the label away", async () => {
+ renderRail();
+ const rail = screen.getByTestId("dock-rail");
+ moveTo(rail, centreOf(1));
+ expect(screen.getAllByTestId("dock-label")).toHaveLength(1);
+ leave(rail);
+ await waitFor(() => expect(screen.queryByTestId("dock-label")).toBeNull(), {
+ timeout: 2000,
+ });
+ });
+
+ test("picking an icon jumps to its section", () => {
+ renderRail();
+ act(() => {
+ fireEvent.click(screen.getByTestId("nav-row-tasks"));
+ });
+ expect(useEventStore.getState().activeSection).toBe("tasks");
+ });
+
+ test("keyboard focus names the icon too, so the rail is not a row of blank glyphs", () => {
+ renderRail();
+ act(() => {
+ fireEvent.focus(screen.getByTestId("nav-row-docs"));
+ });
+ const labels = screen.getAllByTestId("dock-label");
+ expect(labels).toHaveLength(1);
+ expect(labels[0].textContent).toContain(
+ screen.getByTestId("nav-row-docs").getAttribute("aria-label"),
+ );
+ });
+
+ test("a plugin that needs a reconnect lights Skills amber and sends the click to Plugins", () => {
+ pluginAttentionMock.needsReconnect = true;
+ renderRail();
+ const pip = screen.getByTestId("nav-warn-skills");
+ expect(pip.getAttribute("aria-label")).toContain("Cloudflare");
+ act(() => {
+ fireEvent.click(screen.getByTestId("nav-row-skills"));
+ });
+ expect(useEventStore.getState().activeSection).toBe("plugins");
+ });
+
+ test("no amber pip when every plugin is healthy, and Skills lands on Skills", () => {
+ renderRail();
+ expect(screen.queryByTestId("nav-warn-skills")).toBeNull();
+ act(() => {
+ fireEvent.click(screen.getByTestId("nav-row-skills"));
+ });
+ expect(useEventStore.getState().activeSection).toBe("skills");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/deck/DeckDock.tsx b/jarvis/ui/web/frontend/src/components/layout/DockRail.tsx
similarity index 59%
rename from jarvis/ui/web/frontend/src/components/deck/DeckDock.tsx
rename to jarvis/ui/web/frontend/src/components/layout/DockRail.tsx
index eef24e4e76..fbb1972460 100644
--- a/jarvis/ui/web/frontend/src/components/deck/DeckDock.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/DockRail.tsx
@@ -19,27 +19,25 @@ import {
layoutDock,
type DockLayout,
} from "@/lib/dockMagnify";
-import { playDockTick } from "@/lib/sound";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
/**
- * The deck's section dock — every section of the app as one icon, on the
- * left edge, with the magnification desktop docks made familiar.
+ * The icon rail — every section of the app as one icon, on the left edge,
+ * with a gentle magnification under the pointer.
*
- * It replaces the sidebar ONLY while the deck is on screen (App.tsx): the
- * sections appear once, not twice, and the rigid list becomes the smooth
- * one. Clicking an icon jumps to that section, where the ordinary sidebar is
- * waiting; the deck's own dock is not a second navigation, it IS the
- * navigation for this one surface.
+ * ONE rail for the whole app: the mission deck's dock and the collapsed
+ * sidebar are the same component, so a section reads the same wherever the
+ * user is — the maintainer found it jarring that leaving the deck dropped the
+ * icons back to a plain list. The list is the sidebar's own `NAV_GROUPS` — one
+ * source, so a section added there appears here without anyone remembering to
+ * add it twice (AP-4). The attention signals are shared too: a provider error
+ * lights API Keys red, a plugin that needs a reconnect lights Skills amber, and
+ * clicking Skills while a plugin needs attention lands on the Plugins tab, the
+ * same shortcut the expanded sidebar takes.
*
- * The list is the sidebar's own `NAV_GROUPS` — one source, so a section added
- * there appears here without anyone remembering to add it twice (AP-4). The
- * attention signals are the sidebar's too: a provider error lights API Keys,
- * a plugin that needs a reconnect lights Plugins.
- *
- * How the motion is built — the same recipe as the well-known Framer Motion
- * docks, with one deliberate difference:
+ * How the motion is built — the recipe of the well-known Framer Motion docks,
+ * with two deliberate differences:
*
* - The column is RIGID. No icon ever leaves its place: the hill is a hill of
* sizes only, each icon growing around its own rest centre, neighbours a
@@ -47,22 +45,22 @@ import { useT } from "@/i18n";
* make room; the maintainer found that shuffle distracting, so it is gone.
* Boxes may overlap by a few px at the peak — only the hovered box paints a
* surface, and it is drawn on top, so nothing shows.
- * - Nothing about the pointer goes through React state. The pointer writes a
- * motion value; the whole layout is ONE derived motion value; every icon
- * binds its box to that. Re-rendering twenty-odd buttons on every mouse
- * event, and then letting a CSS transition chase the result, is what made
- * the first version stutter and trail the mouse.
- * - The hill follows the pointer instantly; only its HEIGHT is sprung. Enter
- * the rail and the hill rises in place under the pointer; leave it and it
- * settles back where it was — no pop on entry, no jump on exit, no lag.
+ * - The hill is STEADY under a moving pointer. It sits on the hovered icon's
+ * centre, not on the pointer itself: moving within an icon changes nothing
+ * (a pointer that wanders by a pixel used to make every neighbour re-render
+ * at a fractional size, and thin line icons re-rasterised at fractional
+ * sizes read as vibration). Crossing to the next icon glides the hill over
+ * on a critically damped spring, in step with the label.
+ * - Nothing about the pointer goes through React state. The pointer writes
+ * motion values; the whole layout is ONE derived motion value; every icon
+ * binds its box to that.
+ * - The hill's HEIGHT is sprung too: enter the rail and it rises in place
+ * under the pointer; leave it and it settles back where it was.
* - Geometry is pure math in `lib/dockMagnify.ts`.
* - Exactly one label: the hovered icon's, gliding from icon to icon at a
- * fixed distance from the rail, fading in and out. Three labels at once,
- * popping in and out on a size threshold, read as noise.
- * - A soft detent tick each time the pointer crosses onto another icon, and a
- * firmer one on the pick — the ratchet of a picker wheel, quiet.
+ * fixed distance from the rail, fading in and out.
*
- * Users who asked for less motion get the label and the tick but no hill.
+ * Users who asked for less motion get the label but no hill.
*/
const BASE = 30; // px — icon box at rest
const GAP = 8; // px — between icon boxes at rest
@@ -75,26 +73,26 @@ const RAIL_WIDTH = 64; // px — Tailwind w-16, the column the icons centre in
const PAD_TOP = 12;
const PAD_BOTTOM = 12;
/** The rest geometry, for tests that need to aim a pointer at an icon. */
-export const DECK_DOCK_GEOMETRY = { BASE, GAP, PAD_TOP } as const;
-/** Enter/leave: quick, a hair under critical damping so it never wobbles. */
+export const DOCK_RAIL_GEOMETRY = { BASE, GAP, PAD_TOP } as const;
+/** Rise/settle of the hill: quick, a hair under critical damping. */
const HILL_SPRING = { stiffness: 600, damping: 45, mass: 1 };
+/**
+ * The glide from icon to icon — hill and label alike: critically damped, so
+ * it settles in ~40 ms and never overshoots the icon it lands on.
+ */
+const GLIDE_SPRING = { stiffness: 900, damping: 60, mass: 1 };
/**
* Where the label's left edge sits: a fixed distance beyond the fully grown
* icon, so it does not creep sideways while the icon grows under it.
*/
const LABEL_LEFT = RAIL_WIDTH / 2 + (BASE * DOCK_MAX_SCALE) / 2 + 12;
-/**
- * The label glides from icon to icon instead of hopping — critically damped,
- * so it settles in ~40 ms and never overshoots the icon it names.
- */
-const LABEL_SPRING = { stiffness: 900, damping: 60, mass: 1 };
interface DockFrame {
layout: DockLayout;
hovered: number;
}
-export function DeckDock({ className }: { className?: string }) {
+export function DockRail({ className }: { className?: string }) {
const t = useT();
const activeSection = useEventStore((s) => s.activeSection);
const setActiveSection = useEventStore((s) => s.setActiveSection);
@@ -106,7 +104,7 @@ export function DeckDock({ className }: { className?: string }) {
const items = useMemo(() => NAV_GROUPS.flat(), []);
const groupBreaks = useMemo(() => {
// Index of the first item of every group after the first — a hairline is
- // drawn above these so the dock keeps the sidebar's grouping.
+ // drawn above these so the rail keeps the sidebar's grouping.
const breaks = new Set<number>();
let n = 0;
for (let g = 0; g < NAV_GROUPS.length; g++) {
@@ -116,10 +114,21 @@ export function DeckDock({ className }: { className?: string }) {
return breaks;
}, []);
+ // A provider that is set up but failing — surfaced app-wide as a red pip on
+ // API Keys. The amber "needs setup" state is deliberately NOT shown: on a
+ // fresh install every unconfigured section would light up.
const apikeysError = useMemo(
() => Object.values(health).some((h) => h?.status === "error"),
[health],
);
+ const pluginsNeedReconnect = pluginAttention.count > 0;
+ const pluginWarnHint = pluginAttention.names.length
+ ? `${t("sidebar.plugins_reconnect_alert")}: ${pluginAttention.names.join(", ")}`
+ : t("sidebar.plugins_reconnect_alert");
+
+ // Rest geometry — positions never move, so this is a plain number.
+ const rest = useMemo(() => layoutDock(items.length, BASE, GAP, null), [items.length]);
+ const blockHeight = PAD_TOP + rest.extent + PAD_BOTTOM;
// --- pointer → motion values (no React state on the hot path) -----------
const scrollerRef = useRef<HTMLDivElement | null>(null);
@@ -127,9 +136,11 @@ export function DeckDock({ className }: { className?: string }) {
const hoveredRef = useRef(-1);
const [hovered, setHovered] = useState(-1);
- /** Pointer position along the rail, in the REST layout's coordinates. */
- const hillY = useMotionValue(0);
- /** 0 = rail at rest, 1 = hill fully up. Sprung; the position is not. */
+ /** Centre of the hill along the rail, in the rest layout's coordinates —
+ * the hovered icon's centre, glided to on `GLIDE_SPRING`. */
+ const hillYTarget = useMotionValue(0);
+ const hillY = useSpring(hillYTarget, GLIDE_SPRING);
+ /** 0 = rail at rest, 1 = hill fully up. */
const hillTarget = useMotionValue(0);
const hill = useSpring(hillTarget, HILL_SPRING);
const hoveredMV = useMotionValue(-1);
@@ -149,9 +160,6 @@ export function DeckDock({ className }: { className?: string }) {
hovered: h,
};
});
- // Rest geometry — positions never move, so this is a plain number.
- const rest = useMemo(() => layoutDock(items.length, BASE, GAP, null), [items.length]);
- const blockHeight = PAD_TOP + rest.extent + PAD_BOTTOM;
// --- the one label ------------------------------------------------------
// The last position is kept so the label fades out where it was rather than
@@ -165,27 +173,28 @@ export function DeckDock({ className }: { className?: string }) {
lastLabelTop.current = top;
return top;
});
- const labelTopSmooth = useSpring(labelTopRaw, LABEL_SPRING);
+ const labelTopSmooth = useSpring(labelTopRaw, GLIDE_SPRING);
const labelTop = reduced ? labelTopRaw : labelTopSmooth;
const setHoveredSlot = useCallback(
- (slot: number, tick: boolean) => {
+ (slot: number) => {
const prev = hoveredRef.current;
if (slot === prev) return;
hoveredRef.current = slot;
hoveredMV.set(slot);
setHovered(slot);
- if (prev < 0 && slot >= 0) {
- // A fresh label appears AT its icon; only a label that is already on
- // screen glides. Without this it would fly in from wherever the last
- // one faded out.
- labelTopSmooth.jump(
- PAD_TOP + rest.items[slot].center - (scrollerRef.current?.scrollTop ?? 0),
- );
+ if (slot < 0) return;
+ const center = rest.items[slot].center;
+ if (prev < 0) {
+ // A fresh hover appears AT its icon; only a hill (and label) that is
+ // already up glides. Without this they would fly in from wherever the
+ // last hover faded out.
+ hillY.jump(center);
+ labelTopSmooth.jump(PAD_TOP + center - (scrollerRef.current?.scrollTop ?? 0));
}
- if (tick && slot >= 0) playDockTick("hover");
+ hillYTarget.set(center);
},
- [hoveredMV, labelTopSmooth, rest],
+ [hillY, hillYTarget, hoveredMV, labelTopSmooth, rest],
);
const track = useCallback(
@@ -193,11 +202,12 @@ export function DeckDock({ className }: { className?: string }) {
const el = scrollerRef.current;
if (!el) return;
const y = clientY - el.getBoundingClientRect().top + el.scrollTop - PAD_TOP;
- hillY.set(y);
- hillTarget.set(reduced ? 0 : 1);
- setHoveredSlot(dockSlotAt(y, items.length, BASE, GAP), true);
+ const slot = dockSlotAt(y, items.length, BASE, GAP);
+ setHoveredSlot(slot);
+ // Off the row (the padding, or past the last icon) counts as away.
+ hillTarget.set(slot >= 0 && !reduced ? 1 : 0);
},
- [hillY, hillTarget, items.length, reduced, setHoveredSlot],
+ [hillTarget, items.length, reduced, setHoveredSlot],
);
const onPointerMove = useCallback(
@@ -210,7 +220,7 @@ export function DeckDock({ className }: { className?: string }) {
const onPointerLeave = useCallback(() => {
lastClientY.current = null;
hillTarget.set(0);
- setHoveredSlot(-1, false);
+ setHoveredSlot(-1);
}, [hillTarget, setHoveredSlot]);
// Wheel-scrolling under a still pointer moves the icons under it — re-aim.
const onScroll = useCallback(() => {
@@ -228,19 +238,25 @@ export function DeckDock({ className }: { className?: string }) {
const hoveredItem = hovered >= 0 ? items[hovered] : null;
const hoveredCount = hoveredItem?.id === "chats" ? conversations.length : 0;
+ const hoveredHint =
+ hoveredItem?.id === "apikeys" && apikeysError
+ ? t("sidebar.apikeys_alert")
+ : hoveredItem?.id === "skills" && pluginsNeedReconnect
+ ? pluginWarnHint
+ : null;
return (
<nav
aria-label={t("deck.sections")}
- className={cn("relative z-10 flex h-full w-16 shrink-0 flex-col", className)}
+ className={cn("relative z-10 flex min-h-0 w-16 shrink-0 flex-col", className)}
>
<div
ref={scrollerRef}
- data-testid="deck-dock-rail"
+ data-testid="dock-rail"
onPointerMove={onPointerMove}
onPointerLeave={onPointerLeave}
onScroll={onScroll}
- className="deck-dock-scroller relative h-full w-full overflow-y-auto overflow-x-hidden"
+ className="dock-rail-scroller relative min-h-0 w-full flex-1 overflow-y-auto overflow-x-hidden"
>
<div className="relative w-full" style={{ height: blockHeight }}>
{items.map((item, i) => (
@@ -254,19 +270,23 @@ export function DeckDock({ className }: { className?: string }) {
active={activeSection === item.id || !!item.matchIds?.includes(activeSection)}
hovered={hovered === i}
live={item.id === "chats" && conversations.length > 0}
- attention={
- (item.id === "apikeys" && apikeysError) ||
- (item.id === "skills" && pluginAttention.count > 0)
- }
+ alert={item.id === "apikeys" && apikeysError}
+ alertTitle={t("sidebar.apikeys_alert")}
+ warn={item.id === "skills" && pluginsNeedReconnect}
+ warnTitle={pluginWarnHint}
groupBreak={groupBreaks.has(i)}
- onSelect={() => {
- playDockTick("select");
- setActiveSection(item.id);
- }}
- onFocus={() => setHoveredSlot(i, false)}
+ // A plugin problem sends the Skills icon straight into the
+ // Plugins tab (where the banner + jump button are), so one click
+ // lands on the fix instead of the default Skills tab.
+ onSelect={() =>
+ setActiveSection(
+ item.id === "skills" && pluginsNeedReconnect ? "plugins" : item.id,
+ )
+ }
+ onFocus={() => setHoveredSlot(i)}
onBlur={() => {
if (hoveredRef.current === i && lastClientY.current === null) {
- setHoveredSlot(-1, false);
+ setHoveredSlot(-1);
}
}}
/>
@@ -282,17 +302,25 @@ export function DeckDock({ className }: { className?: string }) {
<motion.div
key="label"
aria-hidden
- data-testid="deck-dock-label"
+ data-testid="dock-label"
initial={{ opacity: 0, x: -6 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -4 }}
transition={reduced ? { duration: 0 } : { duration: 0.12, ease: "easeOut" }}
style={{ top: labelTop, left: LABEL_LEFT, y: "-50%" }}
- className="pointer-events-none absolute whitespace-nowrap rounded-md border border-border bg-background/95 px-2 py-1 text-xs text-foreground shadow-md backdrop-blur"
+ className="pointer-events-none absolute flex items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-background/95 px-2 py-1 text-xs text-foreground shadow-md backdrop-blur"
>
{resolveNavLabel(t, hoveredItem)}
+ {hoveredItem.beta && (
+ <span className="rounded-full border border-primary/30 bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-primary">
+ {t("nav.agentic_ide_beta")}
+ </span>
+ )}
{hoveredCount > 0 && (
- <span className="ml-1.5 font-mono text-[10px] text-primary">{hoveredCount}</span>
+ <span className="font-mono text-[10px] text-primary">{hoveredCount}</span>
+ )}
+ {hoveredHint && (
+ <span className="max-w-[28ch] truncate text-muted-foreground">— {hoveredHint}</span>
)}
</motion.div>
)}
@@ -310,7 +338,10 @@ function DockIcon({
active,
hovered,
live,
- attention,
+ alert,
+ alertTitle,
+ warn,
+ warnTitle,
groupBreak,
onSelect,
onFocus,
@@ -326,8 +357,12 @@ function DockIcon({
hovered: boolean;
/** Something is going on in this section (a pip in the accent colour). */
live: boolean;
- /** Something needs the user in this section (a pip in the alert colour). */
- attention: boolean;
+ /** A section this icon fronts has a provider that is set up but failing. */
+ alert: boolean;
+ alertTitle: string;
+ /** Softer "needs attention" — e.g. a plugin whose token needs a reconnect. */
+ warn: boolean;
+ warnTitle: string;
groupBreak: boolean;
onSelect: () => void;
onFocus: () => void;
@@ -353,7 +388,7 @@ function DockIcon({
)}
<motion.button
type="button"
- data-testid={`deck-dock-${item.id}`}
+ data-testid={`nav-row-${item.id}`}
onClick={onSelect}
onFocus={onFocus}
onBlur={onBlur}
@@ -365,8 +400,10 @@ function DockIcon({
// On top while hovered: at the peak its box overlaps the neighbours'
// (transparent) boxes by a few px, and it must win that overlap.
hovered && "z-10",
+ // The active control is the app's glass surface with the accent on
+ // the glyph — the same language as the expanded sidebar's row.
active
- ? "border-primary/50 bg-primary/15 text-primary"
+ ? "jarvis-message-surface border-primary/40 text-primary"
: hovered
? "border-border/60 bg-card/40 text-foreground"
: "border-transparent text-muted-foreground",
@@ -381,15 +418,28 @@ function DockIcon({
<Icon className="h-full w-full" />
</motion.span>
- {(live || attention) && (
+ {/* Pips ride on the icon's corner. The signal is the point, not the
+ row — and there is no room for anything beside a 30 px box. */}
+ {alert ? (
+ <span
+ data-testid={`nav-alert-${item.id}`}
+ role="status"
+ aria-label={alertTitle}
+ className="absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-destructive ring-2 ring-background"
+ />
+ ) : warn ? (
+ <span
+ data-testid={`nav-warn-${item.id}`}
+ role="status"
+ aria-label={warnTitle}
+ className="absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-amber-500 ring-2 ring-background"
+ />
+ ) : live ? (
<span
aria-hidden
- className={cn(
- "absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full ring-2 ring-background",
- attention ? "bg-destructive" : "bg-primary",
- )}
+ className="absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-primary ring-2 ring-background"
/>
- )}
+ ) : null}
</motion.button>
</>
);
diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx
index 12155466e5..ab1b39cab5 100644
--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx
@@ -512,12 +512,20 @@ describe("Sidebar icon rail", () => {
test("keeps every destination named once its label is off the screen", () => {
renderSidebar(SIDEBAR_RAIL_WIDTH);
- // The label survives as the accessible name and as the hover text — it is
- // off the screen, not gone. Both non-empty is the assertion; WHAT they say
- // is the locale's business.
+ // The label survives as the accessible name, and the rail draws its own
+ // label beside the icon on hover — it is off the row, not gone. (No native
+ // title: a browser tooltip on top of the rail's label would be a second,
+ // late label.) WHAT they say is the locale's business.
const row = screen.getByTestId("nav-row-agentic-ide");
expect(row.getAttribute("aria-label")).toBeTruthy();
- expect(row.getAttribute("title")).toBeTruthy();
+ expect(row.getAttribute("title")).toBeNull();
+ act(() => {
+ row.focus();
+ row.dispatchEvent(new FocusEvent("focusin", { bubbles: true }));
+ });
+ expect(screen.getByTestId("dock-label").textContent).toContain(
+ row.getAttribute("aria-label"),
+ );
});
test("still switches section on a click", () => {
diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
index 0c58bb64b6..59f1a2c20a 100644
--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
@@ -9,6 +9,7 @@ import {
resolveNavLabel,
type NavItem,
} from "@/components/layout/navGroups";
+import { DockRail } from "@/components/layout/DockRail";
import { useEventStore } from "@/store/events";
import { useVoiceReadiness } from "@/hooks/useVoiceReadiness";
import { useVoiceMode } from "@/hooks/useVoiceMode";
@@ -71,7 +72,10 @@ export const SIDEBAR_DEFAULT_WIDTH = 280;
* label — so in the Agentic IDE, where a workspace of a dozen terminals wants
* every pixel, a fifth of the window stayed spent on a list nobody was reading.
* The rail keeps navigation one click away (the icons are still there, each
- * with its label on hover) while giving that space back to the panes.
+ * with its label on hover) while giving that space back to the panes. The
+ * rail IS the deck's dock (`DockRail`) — same icons, same magnification, same
+ * signals — so leaving the deck never drops the navigation back to a plainer
+ * list.
*/
export const SIDEBAR_RAIL_WIDTH = 64;
@@ -198,11 +202,14 @@ export function Sidebar({
return (
// No right border: the draggable seam beside it draws that line now, and
// two 1px lines three pixels apart read as a rendering fault.
+ // z-20: above the main area (z-10). The rail's hover label flies out past
+ // the sidebar's edge, and it must paint over the page rather than under it;
+ // the app-wide layers (toasts, docks, dialogs) all sit at z-40 and above.
<aside
style={{ width: railed ? SIDEBAR_RAIL_WIDTH : width }}
data-testid="sidebar"
data-railed={railed ? "true" : "false"}
- className="jarvis-nav-surface relative isolate flex h-full shrink-0 flex-col"
+ className="jarvis-nav-surface relative isolate z-20 flex h-full shrink-0 flex-col"
>
<div className={cn("border-b border-border", railed ? "px-2 py-3" : "px-4 py-4")}>
<div
@@ -323,47 +330,48 @@ export function Sidebar({
)}
</div>
- <nav
- className={cn(
- "flex-1 overflow-y-auto scrollbar-jarvis",
- railed ? "px-1.5 py-2" : "p-2",
- )}
- >
- {NAV_GROUPS.map((group, groupIndex) => (
- <ul
- key={groupIndex}
- className={cn(
- "space-y-0.5",
- // Thin divider + breathing room above every group after the first.
- groupIndex > 0 && "mt-2 border-t border-border/40 pt-2",
- )}
- >
- {group.map((item) => (
- <NavRow
- key={item.id}
- item={item}
- railed={railed}
- label={resolveNavLabel(t, item)}
- active={item.matchIds ? item.matchIds.includes(active) : item.id === active}
- badge={item.id === "agents" ? agentsCount : undefined}
- betaLabel={item.beta ? t("nav.agentic_ide_beta") : undefined}
- alert={item.id === "apikeys" ? apikeysHasError : false}
- alertTitle={t("sidebar.apikeys_alert")}
- warn={item.id === "skills" ? pluginsNeedReconnect : false}
- warnTitle={pluginWarnTitle}
- // A plugin problem sends the "Skills & Tools" row straight into
- // the Plugins tab (where the banner + jump button are), so one
- // click lands on the fix instead of the default Skills tab.
- onClick={() =>
- setActive(
- item.id === "skills" && pluginsNeedReconnect ? "plugins" : item.id,
- )
- }
- />
- ))}
- </ul>
- ))}
- </nav>
+ {railed ? (
+ // The rail is the app-wide icon dock: it carries the same signals (the
+ // API-Keys error pip, the plugin reconnect pip, the Skills → Plugins
+ // shortcut) from its own sources, so nothing here has to be threaded in.
+ <DockRail className="min-h-0 flex-1" />
+ ) : (
+ <nav className="flex-1 overflow-y-auto scrollbar-jarvis p-2">
+ {NAV_GROUPS.map((group, groupIndex) => (
+ <ul
+ key={groupIndex}
+ className={cn(
+ "space-y-0.5",
+ // Thin divider + breathing room above every group after the first.
+ groupIndex > 0 && "mt-2 border-t border-border/40 pt-2",
+ )}
+ >
+ {group.map((item) => (
+ <NavRow
+ key={item.id}
+ item={item}
+ label={resolveNavLabel(t, item)}
+ active={item.matchIds ? item.matchIds.includes(active) : item.id === active}
+ badge={item.id === "agents" ? agentsCount : undefined}
+ betaLabel={item.beta ? t("nav.agentic_ide_beta") : undefined}
+ alert={item.id === "apikeys" ? apikeysHasError : false}
+ alertTitle={t("sidebar.apikeys_alert")}
+ warn={item.id === "skills" ? pluginsNeedReconnect : false}
+ warnTitle={pluginWarnTitle}
+ // A plugin problem sends the "Skills & Tools" row straight into
+ // the Plugins tab (where the banner + jump button are), so one
+ // click lands on the fix instead of the default Skills tab.
+ onClick={() =>
+ setActive(
+ item.id === "skills" && pluginsNeedReconnect ? "plugins" : item.id,
+ )
+ }
+ />
+ ))}
+ </ul>
+ ))}
+ </nav>
+ )}
<div className={cn("border-t border-border", railed ? "p-1.5" : "p-3")}>
<button
@@ -425,7 +433,6 @@ function NavRow({
alertTitle,
warn = false,
warnTitle,
- railed = false,
onClick,
}: {
item: NavItem;
@@ -445,28 +452,19 @@ function NavRow({
warn?: boolean;
/** Plain-language hover text for the warn dot. */
warnTitle?: string;
- /** Icon-only row — the sidebar has been dragged down to its rail. */
- railed?: boolean;
onClick: () => void;
}) {
const Icon = item.icon;
- // On the rail the label is gone from the screen, so it has to survive
- // somewhere: as the hover text and as the accessible name. Without both, the
- // narrow sidebar would be a column of unlabelled glyphs. The beta pill has no
- // room on the rail either, so it folds into the same hover text.
const hint = alert ? alertTitle : warn ? warnTitle : undefined;
- const fullLabel = betaLabel ? `${label} (${betaLabel})` : label;
return (
<li>
<button
type="button"
data-testid={`nav-row-${item.id}`}
onClick={onClick}
- aria-label={railed ? fullLabel : undefined}
- title={railed ? (hint ? `${fullLabel} — ${hint}` : fullLabel) : hint}
+ title={hint}
className={cn(
- "group relative flex w-full items-center rounded-lg text-sm transition-all",
- railed ? "justify-center px-0 py-2" : "gap-3 px-3 py-2",
+ "group relative flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm transition-all",
"hover:bg-background/20",
active
? "jarvis-message-surface text-foreground shadow-[inset_2px_0_0_hsl(var(--primary))]"
@@ -479,30 +477,23 @@ function NavRow({
active ? "text-primary" : "text-muted-foreground group-hover:text-foreground",
)}
/>
- {!railed && (
- <span className="flex flex-1 items-center gap-1.5 text-left">
- {label}
- {betaLabel && (
- <span
- data-testid={`nav-beta-${item.id}`}
- className="shrink-0 rounded-full border border-primary/30 bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-primary"
- >
- {betaLabel}
- </span>
- )}
- </span>
- )}
- {/* On the rail the status dots ride ON the icon rather than after the
- label there is no room for — the signal is the point, not the row. */}
+ <span className="flex flex-1 items-center gap-1.5 text-left">
+ {label}
+ {betaLabel && (
+ <span
+ data-testid={`nav-beta-${item.id}`}
+ className="shrink-0 rounded-full border border-primary/30 bg-primary/10 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-primary"
+ >
+ {betaLabel}
+ </span>
+ )}
+ </span>
{alert && (
<span
data-testid={`nav-alert-${item.id}`}
role="status"
aria-label={alertTitle}
- className={cn(
- "h-2 w-2 shrink-0 rounded-full bg-destructive ring-2 ring-background",
- railed && "absolute right-1.5 top-1.5",
- )}
+ className="h-2 w-2 shrink-0 rounded-full bg-destructive ring-2 ring-background"
/>
)}
{!alert && warn && (
@@ -510,13 +501,10 @@ function NavRow({
data-testid={`nav-warn-${item.id}`}
role="status"
aria-label={warnTitle}
- className={cn(
- "h-2 w-2 shrink-0 rounded-full bg-amber-500 ring-2 ring-background",
- railed && "absolute right-1.5 top-1.5",
- )}
+ className="h-2 w-2 shrink-0 rounded-full bg-amber-500 ring-2 ring-background"
/>
)}
- {badge !== undefined && badge > 0 && !railed && (
+ {badge !== undefined && badge > 0 && (
<span className="rounded-full bg-primary/20 px-1.5 py-0.5 text-[10px] font-semibold text-primary">
{badge}
</span>
diff --git a/jarvis/ui/web/frontend/src/index.css b/jarvis/ui/web/frontend/src/index.css
index 2f08faf5fa..ba6402d036 100644
--- a/jarvis/ui/web/frontend/src/index.css
+++ b/jarvis/ui/web/frontend/src/index.css
@@ -359,15 +359,16 @@
height: 0;
}
-/* The mission deck's dock scrolls when the window is shorter than its column
- of icons, but shows no bar: a 10 px thumb inside a 64 px rail would sit on
- the icons themselves. Top-level for the same reason as the rules above. */
-.deck-dock-scroller {
+/* The icon rail (the deck's dock and the collapsed sidebar) scrolls when the
+ window is shorter than its column of icons, but shows no bar: a 10 px thumb
+ inside a 64 px rail would sit on the icons themselves. Top-level for the
+ same reason as the rules above. */
+.dock-rail-scroller {
overscroll-behavior: contain;
scrollbar-width: none;
}
-.deck-dock-scroller::-webkit-scrollbar {
+.dock-rail-scroller::-webkit-scrollbar {
width: 0;
height: 0;
}
diff --git a/jarvis/ui/web/frontend/src/lib/sound.test.ts b/jarvis/ui/web/frontend/src/lib/sound.test.ts
index 83b3a0bd53..f92bdff717 100644
--- a/jarvis/ui/web/frontend/src/lib/sound.test.ts
+++ b/jarvis/ui/web/frontend/src/lib/sound.test.ts
@@ -83,72 +83,3 @@ describe("playDropConfirm", () => {
expect(fake.ctorSpy).not.toHaveBeenCalled();
});
});
-
-describe("playDockTick", () => {
- beforeEach(() => {
- vi.resetModules();
- delete (window as unknown as { AudioContext?: unknown }).AudioContext;
- delete (window as unknown as { webkitAudioContext?: unknown })
- .webkitAudioContext;
- delete (navigator as unknown as { userActivation?: unknown }).userActivation;
- try {
- localStorage.removeItem("jarvis.ui.sound");
- } catch {
- /* ignore */
- }
- });
-
- it("is a no-op and never throws when WebAudio is unavailable", async () => {
- const { playDockTick } = await import("./sound");
- expect(() => playDockTick()).not.toThrow();
- expect(() => playDockTick("select")).not.toThrow();
- });
-
- it("plays one short body voice per tick, even on an engine without buffers", async () => {
- const fake = installFakeAudio();
- const { playDockTick } = await import("./sound");
- playDockTick("hover");
- expect(fake.ctorSpy).toHaveBeenCalledTimes(1);
- expect(fake.oscillators.length).toBe(1);
- expect(fake.started.length).toBe(1);
- // Sub-40 ms: a detent, not a note.
- expect(fake.stopped[0]).toBeLessThan(0.05);
- });
-
- it("rate-limits: two ticks on the same audio clock play once", async () => {
- const fake = installFakeAudio();
- const { playDockTick } = await import("./sound");
- playDockTick("hover");
- playDockTick("hover");
- expect(fake.oscillators.length).toBe(1);
- });
-
- it("gives the pick a lower voice than the pass", async () => {
- const fake = installFakeAudio();
- const { playDockTick } = await import("./sound");
- playDockTick("select");
- const osc = fake.oscillators[0] as { frequency: { setValueAtTime: ReturnType<typeof vi.fn> } };
- const start = osc.frequency.setValueAtTime.mock.calls[0][0] as number;
- // 1300 Hz ± 4 % jitter — well under the 2100 Hz hover voice.
- expect(start).toBeGreaterThan(1200);
- expect(start).toBeLessThan(1400);
- });
-
- it("does not even create a context before the page has seen a gesture", async () => {
- const fake = installFakeAudio();
- (navigator as unknown as { userActivation: unknown }).userActivation = {
- hasBeenActive: false,
- };
- const { playDockTick } = await import("./sound");
- playDockTick();
- expect(fake.ctorSpy).not.toHaveBeenCalled();
- });
-
- it("stays silent when the user muted UI sound", async () => {
- const fake = installFakeAudio();
- localStorage.setItem("jarvis.ui.sound", "off");
- const { playDockTick } = await import("./sound");
- playDockTick();
- expect(fake.ctorSpy).not.toHaveBeenCalled();
- });
-});
diff --git a/jarvis/ui/web/frontend/src/lib/sound.ts b/jarvis/ui/web/frontend/src/lib/sound.ts
index b0b7fc41a4..3af38f3f77 100644
--- a/jarvis/ui/web/frontend/src/lib/sound.ts
+++ b/jarvis/ui/web/frontend/src/lib/sound.ts
@@ -1,12 +1,11 @@
/**
- * Tiny, dependency-free UI sounds: the JarvisDock "mission captured" chime and
- * the deck dock's detent tick. WebAudio is a browser built-in, so this works on
- * any cloud-first client and adds nothing to the bundle.
+ * A tiny, dependency-free confirmation chime for UI affordances (currently the
+ * JarvisDock "mission captured" feedback). WebAudio is a browser built-in, so
+ * this works on any cloud-first client and adds nothing to the bundle.
*
- * Brief from the product: quiet and smooth. The chime is two soft sine voices
- * a gentle interval apart, a low peak gain, a short attack and a smooth
- * exponential release — a "tding", never a beep. The tick is a sub-40 ms
- * detent, the sound a picker wheel makes as it passes a notch.
+ * Brief from the product: quiet and smooth. Two soft sine voices a gentle
+ * interval apart, a low peak gain, a short attack and a smooth exponential
+ * release — a "tding", never a beep.
*
* Every call is safe from any event handler: it is a no-op (never throws) when
* WebAudio is unavailable (headless / jsdom) or the user muted UI sounds via
@@ -49,19 +48,6 @@ function getCtx(): AudioContext | null {
return sharedCtx;
}
-/**
- * Has the page seen a user gesture yet? Browsers refuse to start audio before
- * one, and a context created too early logs a warning and stays suspended.
- * Unknown (older engines, jsdom) counts as yes — the play paths still guard
- * against a suspended context.
- */
-function hadUserGesture(): boolean {
- if (typeof navigator === "undefined") return true;
- const ua = (navigator as unknown as { userActivation?: { hasBeenActive?: boolean } })
- .userActivation;
- return ua?.hasBeenActive !== false;
-}
-
/**
* Play the soft "mission captured" confirmation chime. No-op when WebAudio is
* unavailable or UI sound is muted; any audio quirk is swallowed so it can
@@ -107,113 +93,3 @@ export function playDropConfirm(): void {
// Never let an audio hiccup surface to the interaction.
}
}
-
-/** Two flavours of the dock tick: passing a notch, and picking one. */
-export type DockTick = "hover" | "select";
-
-/** Fastest the tick may repeat; a sweep across the dock still reads as a
- * ratchet, but two pointer events on one frame never double-fire. */
-const TICK_MIN_INTERVAL_S = 0.024;
-let lastTickAt = -Infinity;
-let noiseBuffer: AudioBuffer | null = null;
-
-interface TickVoice {
- /** Sine sweep: start and end frequency (Hz) and how long the glide takes. */
- from: number;
- to: number;
- sweep: number;
- /** Peak gain and how long the body rings. */
- peak: number;
- decay: number;
- /** Band-passed noise transient: centre frequency and peak gain. */
- click: number;
- clickPeak: number;
-}
-
-// The hover tick is short and bright, the pick a shade lower, longer and
-// firmer — same family, so the two read as one mechanism.
-const TICK_VOICES: Record<DockTick, TickVoice> = {
- hover: { from: 2100, to: 700, sweep: 0.018, peak: 0.035, decay: 0.03, click: 3200, clickPeak: 0.02 },
- select: { from: 1300, to: 420, sweep: 0.03, peak: 0.06, decay: 0.05, click: 2200, clickPeak: 0.03 },
-};
-
-function noiseFor(ctx: AudioContext): AudioBuffer | null {
- if (typeof ctx.createBuffer !== "function") return null;
- if (!noiseBuffer || noiseBuffer.sampleRate !== ctx.sampleRate) {
- const length = Math.max(1, Math.round(ctx.sampleRate * 0.03));
- noiseBuffer = ctx.createBuffer(1, length, ctx.sampleRate);
- const data = noiseBuffer.getChannelData(0);
- for (let i = 0; i < data.length; i++) data[i] = Math.random() * 2 - 1;
- }
- return noiseBuffer;
-}
-
-/**
- * Play one detent tick of the deck dock — the pointer moved onto another icon
- * (`hover`) or picked one (`select`). No-op when WebAudio is unavailable, the
- * page has not been interacted with yet, UI sound is muted, or the last tick
- * was under `TICK_MIN_INTERVAL_S` ago; any audio quirk is swallowed so it can
- * never break the hover it accompanies.
- */
-export function playDockTick(kind: DockTick = "hover"): void {
- if (!soundEnabled() || !hadUserGesture()) return;
- const ctx = getCtx();
- if (!ctx) return;
- try {
- if (ctx.state === "suspended") {
- // A hover is not a gesture; the page has had one, so this may succeed.
- // The tick itself is skipped: scheduling into a suspended context would
- // fire every queued tick at once when it finally starts.
- if (typeof ctx.resume === "function") void ctx.resume();
- return;
- }
- const now = ctx.currentTime;
- if (now - lastTickAt < TICK_MIN_INTERVAL_S) return;
- lastTickAt = now;
- const v = TICK_VOICES[kind];
-
- // Body: a short downward sine glide with a near-instant attack — the
- // "tock" of a notch. A few percent of pitch jitter keeps a fast sweep
- // from sounding like a machine.
- const jitter = 1 + (Math.random() - 0.5) * 0.08;
- const osc = ctx.createOscillator();
- osc.type = "sine";
- osc.frequency.setValueAtTime(v.from * jitter, now);
- osc.frequency.exponentialRampToValueAtTime(v.to * jitter, now + v.sweep);
- const body = ctx.createGain();
- body.gain.setValueAtTime(0.0001, now);
- body.gain.exponentialRampToValueAtTime(v.peak, now + 0.0015);
- body.gain.exponentialRampToValueAtTime(0.0001, now + v.decay);
- osc.connect(body);
- body.connect(ctx.destination);
- osc.start(now);
- osc.stop(now + v.decay + 0.01);
-
- // Transient: a few milliseconds of band-passed noise on top gives the
- // click its "tick" — without it the sine alone is a blip. Optional: an
- // engine without buffers or filters still gets the body.
- const noise = noiseFor(ctx);
- if (noise && typeof ctx.createBufferSource === "function") {
- const src = ctx.createBufferSource();
- src.buffer = noise;
- let tail: AudioNode = src;
- if (typeof ctx.createBiquadFilter === "function") {
- const band = ctx.createBiquadFilter();
- band.type = "bandpass";
- band.frequency.value = v.click;
- band.Q.value = 1.2;
- src.connect(band);
- tail = band;
- }
- const clickGain = ctx.createGain();
- clickGain.gain.setValueAtTime(v.clickPeak, now);
- clickGain.gain.exponentialRampToValueAtTime(0.0001, now + 0.012);
- tail.connect(clickGain);
- clickGain.connect(ctx.destination);
- src.start(now);
- src.stop(now + 0.02);
- }
- } catch {
- // Never let an audio hiccup surface to the interaction.
- }
-}
diff --git a/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx b/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx
index e6f3489d68..06d6b2211a 100644
--- a/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx
+++ b/jarvis/ui/web/frontend/src/views/MissionDeckView.tsx
@@ -3,7 +3,7 @@ import { useEventStore, type VoiceState } from "@/store/events";
import { useDeckStore } from "@/store/deck";
import { VoiceWaveform, type WaveformPhase } from "@/components/overlay/VoiceWaveform";
import { voiceInputLevelRef } from "@/lib/voiceInputLevel";
-import { DeckDock } from "@/components/deck/DeckDock";
+import { DockRail } from "@/components/layout/DockRail";
import { DeckOrb } from "@/components/deck/DeckOrb";
import { HudLamp } from "@/components/deck/HudFrame";
import {
@@ -180,7 +180,7 @@ export function MissionDeckView({
{/* Stage */}
<div className="flex min-h-0 flex-1">
- <DeckDock />
+ <DockRail />
<div className="grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-y-auto p-3 lg:grid-cols-[minmax(200px,3fr)_minmax(0,6fr)_minmax(240px,4fr)] lg:grid-rows-[minmax(0,1fr)_minmax(0,0.6fr)] lg:overflow-hidden">
{/* LEFT top: the log — the terminal of the session */}