Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(ui): make the update button a quiet icon with a details panel

rubenluetke10-beep0ae526baa506
diff --git a/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsx b/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsx
index 894fdb04be..ac87276c0f 100644
--- a/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsx
+++ b/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsx
@@ -1,7 +1,11 @@
/**
* The TopBar update button: it renders ONLY when the backend reports a managed
- * install with an available update, shows the new version, and stays hidden on
- * an unmanaged checkout (the dev-tree safety guard surfaced in the UI).
+ * install with an available update, and stays hidden on an unmanaged checkout
+ * (the dev-tree safety guard surfaced in the UI).
+ *
+ * At rest it is a quiet icon with an accent dot; the version, the release notes
+ * and the one action live in a panel the icon opens. A single click on the icon
+ * must never start an update — only the panel's "Update & restart" does.
*/
import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
@@ -23,6 +27,12 @@ function mockUpdateStatus(body: Record<string, unknown>): void {
);
}
+/** Open the panel from the title-strip icon, then press its install action. */
+async function openAndInstall(): Promise<void> {
+ fireEvent.click(await screen.findByRole("button", { name: /update available/i }));
+ fireEvent.click(await screen.findByRole("button", { name: "Update & restart" }));
+}
+
describe("TopBar update button", () => {
beforeEach(() => {
// The front page hides this bar; these tests need the global chrome.
@@ -47,8 +57,90 @@ describe("TopBar update button", () => {
published_at: null,
});
render(<TopBar />);
- await waitFor(() => expect(screen.getByText("Update available")).toBeTruthy());
- expect(screen.getByText("v1.0.2")).toBeTruthy();
+ const button = await screen.findByRole("button", { name: /update available/i });
+ // The version rides in the accessible name; the strip itself shows no text.
+ expect(button.getAttribute("aria-label")).toContain("v1.0.2");
+ expect(screen.queryByText("Update available")).toBeNull();
+ expect(screen.getByTestId("update-dot")).toBeTruthy();
+ });
+
+ it("opens a panel with version, current version and notes on click", async () => {
+ mockUpdateStatus({
+ managed: true,
+ current: "1.0.1",
+ latest: "1.0.2",
+ update_available: true,
+ notes: "## What's new\n- **Faster** startup\n- Fixed `voice` lag",
+ published_at: null,
+ });
+ render(<TopBar />);
+ fireEvent.click(await screen.findByRole("button", { name: /update available/i }));
+
+ const panel = await screen.findByRole("dialog", { name: "Update available" });
+ expect(panel.textContent).toContain("v1.0.2");
+ expect(panel.textContent).toContain("You have v1.0.1");
+ // Markdown punctuation is stripped, the words stay.
+ expect(panel.textContent).toContain("What's new");
+ expect(panel.textContent).toContain("• Faster startup");
+ expect(panel.textContent).toContain("Fixed voice lag");
+ expect(panel.textContent).not.toContain("##");
+ expect(panel.textContent).not.toContain("**");
+ });
+
+ it("never starts an update from the icon click alone", async () => {
+ const fetchMock = vi.fn(async (url: string) => {
+ if (url.startsWith("/api/update/status")) {
+ return {
+ ok: true,
+ status: 200,
+ json: async () => ({
+ managed: true,
+ current: "1.0.1",
+ latest: "1.0.2",
+ update_available: true,
+ notes: null,
+ }),
+ };
+ }
+ return { ok: true, status: 200, json: async () => ({}) };
+ });
+ vi.stubGlobal("fetch", fetchMock);
+ render(<TopBar />);
+ fireEvent.click(await screen.findByRole("button", { name: /update available/i }));
+ await screen.findByRole("dialog");
+ await new Promise((resolve) => setTimeout(resolve, 20));
+
+ const urls = fetchMock.mock.calls.map((call) => String(call[0]));
+ expect(urls.some((url) => url.startsWith("/api/update/apply"))).toBe(false);
+ expect(urls.some((url) => url.startsWith("/api/settings/restart-app"))).toBe(false);
+ });
+
+ it("closes the panel on Later, on Escape and on an outside click", async () => {
+ mockUpdateStatus({
+ managed: true,
+ current: "1.0.1",
+ latest: "1.0.2",
+ update_available: true,
+ notes: null,
+ published_at: null,
+ });
+ render(<TopBar />);
+ const button = await screen.findByRole("button", { name: /update available/i });
+
+ fireEvent.click(button);
+ fireEvent.click(await screen.findByRole("button", { name: "Later" }));
+ expect(screen.queryByRole("dialog")).toBeNull();
+
+ fireEvent.click(button);
+ await screen.findByRole("dialog");
+ fireEvent.keyDown(document, { key: "Escape" });
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+
+ fireEvent.click(button);
+ await screen.findByRole("dialog");
+ fireEvent.pointerDown(document.body);
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ expect(button.getAttribute("aria-expanded")).toBe("false");
});
it("hides the Update button on an unmanaged checkout (dev-tree guard)", async () => {
@@ -111,9 +203,7 @@ describe("TopBar update button", () => {
);
render(<TopBar />);
- fireEvent.click(
- await screen.findByRole("button", { name: /update available/i }),
- );
+ await openAndInstall();
await waitFor(() => {
expect(
@@ -161,9 +251,7 @@ describe("TopBar update button", () => {
);
render(<TopBar />);
- fireEvent.click(
- await screen.findByRole("button", { name: /update available/i }),
- );
+ await openAndInstall();
// Three restart attempts with a retry pause happen before the verdict.
await waitFor(
@@ -194,8 +282,11 @@ describe("TopBar update button", () => {
pending_update: { version: "1.0.12", target_revision: "b".repeat(40) },
});
render(<TopBar />);
- await waitFor(() => expect(screen.getByText("Finish update")).toBeTruthy());
- expect(screen.getByText("v1.0.12")).toBeTruthy();
+ const button = await screen.findByRole("button", { name: /finish update/i });
+ expect(button.getAttribute("aria-label")).toContain("v1.0.12");
+ fireEvent.click(button);
+ const panel = await screen.findByRole("dialog", { name: "Finish update" });
+ expect(panel.textContent).toContain("v1.0.12");
});
it("announces a rolled-back update instead of failing silently", async () => {
@@ -254,9 +345,7 @@ describe("TopBar update button", () => {
);
render(<TopBar />);
- fireEvent.click(
- await screen.findByRole("button", { name: /update available/i }),
- );
+ await openAndInstall();
await waitFor(() => {
expect(
@@ -270,4 +359,99 @@ describe("TopBar update button", () => {
).toBe(true);
});
});
+
+ it("never restarts on top of a native installer that already took over", async () => {
+ const urls: string[] = [];
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(async (url: string) => {
+ urls.push(url);
+ if (url.startsWith("/api/update/status")) {
+ return {
+ ok: true,
+ status: 200,
+ json: async () => ({
+ managed: true,
+ current: "1.5.3",
+ latest: "1.6.0",
+ update_available: true,
+ notes: null,
+ }),
+ };
+ }
+ if (url.startsWith("/api/update/apply")) {
+ return {
+ ok: true,
+ status: 200,
+ json: async () => ({ ok: true, kind: "frozen", restart_required: false, quitting: true }),
+ };
+ }
+ return { ok: true, status: 200, json: async () => ({}) };
+ }),
+ );
+
+ render(<TopBar />);
+ await openAndInstall();
+
+ await waitFor(() => expect(screen.getByText("Restarting…")).toBeTruthy());
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ // On a frozen build a second restart would race the installer for the
+ // program files - the server is already closing the app.
+ expect(urls.some((url) => url.startsWith("/api/settings/restart-app"))).toBe(false);
+ });
+
+ it("arms the mission override when the install itself is refused", async () => {
+ const urls: string[] = [];
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(async (url: string) => {
+ urls.push(url);
+ if (url.startsWith("/api/update/status")) {
+ return {
+ ok: true,
+ status: 200,
+ json: async () => ({
+ managed: true,
+ current: "1.5.3",
+ latest: "1.6.0",
+ update_available: true,
+ notes: null,
+ }),
+ };
+ }
+ if (url === "/api/update/apply") {
+ return {
+ ok: false,
+ status: 409,
+ json: async () => ({
+ detail: { error: "missions_running", missions: [{ id: "m-1" }, { id: "m-2" }] },
+ }),
+ };
+ }
+ if (url === "/api/update/apply?force=true") {
+ return {
+ ok: true,
+ status: 200,
+ json: async () => ({ ok: true, restart_required: false }),
+ };
+ }
+ return { ok: true, status: 200, json: async () => ({}) };
+ }),
+ );
+
+ render(<TopBar />);
+ await openAndInstall();
+
+ await waitFor(() =>
+ expect(
+ useEventStore
+ .getState()
+ .toasts.some((toast) => toast.kind === "warning" && toast.message.startsWith("2 ")),
+ ).toBe(true),
+ );
+ fireEvent.click(await screen.findByRole("button", { name: "Restart anyway?" }));
+
+ await waitFor(() => expect(urls).toContain("/api/update/apply?force=true"));
+ expect(urls.some((url) => url.startsWith("/api/settings/restart-app"))).toBe(false);
+ });
});
diff --git a/jarvis/ui/web/frontend/src/__tests__/topbarUpdateProgress.test.tsx b/jarvis/ui/web/frontend/src/__tests__/topbarUpdateProgress.test.tsx
index a14950ff0f..b8ee6cb74e 100644
--- a/jarvis/ui/web/frontend/src/__tests__/topbarUpdateProgress.test.tsx
+++ b/jarvis/ui/web/frontend/src/__tests__/topbarUpdateProgress.test.tsx
@@ -1,10 +1,11 @@
/**
* The update button as a progress bar.
*
- * While an update runs, the button IS the progress indicator: it shows the
- * percentage the backend reports, fills proportionally, and finishes on the one
- * phase nothing can measure — the restart, announced by the UI itself because
- * the server reporting it is the process shutting down.
+ * While an update runs, the title-strip icon becomes a progress ring and the
+ * update panel shows the percentage the backend reports, fills its bar
+ * proportionally, and finishes on the one phase nothing can measure — the
+ * restart, announced by the UI itself because the server reporting it is the
+ * process shutting down.
*
* What these tests defend is honesty. A bar that animates on a timer, rewinds,
* or sticks at a number after the update failed is worse than no bar at all:
@@ -80,9 +81,10 @@ function mockBackend(opts: {
return calls;
}
+/** Open the update panel from the title-strip icon, then start the update. */
async function clickUpdate(): Promise<void> {
- const button = await screen.findByText("Update available");
- button.click();
+ (await screen.findByRole("button", { name: /update available/i })).click();
+ (await screen.findByRole("button", { name: "Update & restart" })).click();
}
function fillWidth(): string | undefined {
@@ -148,7 +150,7 @@ describe("TopBar update progress", () => {
it("is not a progress bar before an update starts", async () => {
mockBackend({ progress: () => progressBody(0) });
render(<TopBar />);
- await screen.findByText("Update available");
+ await screen.findByRole("button", { name: /update available/i });
// A stray role here would announce a bar frozen at 0 % on every launch.
expect(screen.queryByRole("progressbar")).toBeNull();
diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
index 764ce4f91e..d7d1b9277d 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
@@ -376,15 +376,89 @@ function withDetail(message: string, detail: string | null): string {
return `${message} (${trimmed.slice(0, 180)})`;
}
+
+/**
+ * Release notes arrive as GitHub Markdown. The panel shows them as plain
+ * prose, so heading hashes, bold markers and list bullets are dropped rather
+ * than printed as literal punctuation.
+ */
+function plainNotes(notes: string): string {
+ return notes
+ .replace(/\r\n/g, "\n")
+ .split("\n")
+ .map((line) =>
+ line
+ .replace(/^\s{0,3}#{1,6}\s+/, "")
+ .replace(/^\s*[-*+]\s+/, "• ")
+ .replace(/\*\*(.+?)\*\*/g, "$1")
+ .replace(/`([^`]+)`/g, "$1"),
+ )
+ .join("\n")
+ .replace(/\n{3,}/g, "\n\n")
+ .trim()
+ .slice(0, 800);
+}
+
+/** Geometry of the progress ring that replaces the icon while an update runs. */
+const RING_RADIUS = 6.5;
+const RING_LENGTH = 2 * Math.PI * RING_RADIUS;
+
/**
- * Shown when the backend reports a managed install with a newer published
- * release (``status.update_available``) — or with a staged-but-not-installed
- * transaction (``status.pending_update``) left behind by an earlier attempt.
- * One click stages the new code (`POST /api/update/apply`) and then restarts
- * to install it, reusing the same mission-guard (409 → force) flow as the
- * restart button. Hovering reveals the release notes. On a dev tree / manual
- * clone the status is ``managed: false``, so this renders nothing and can
- * never trigger a self-update.
+ * A 16 px ring that fills with the update percentage — the whole progress
+ * indicator the title strip needs, at the size of the icon it replaces, so a
+ * running update never pushes the neighbouring buttons around.
+ */
+function ProgressRing({ percent, spinning }: { percent: number; spinning: boolean }) {
+ const clamped = Math.min(100, Math.max(0, percent));
+ return (
+ <svg
+ aria-hidden
+ viewBox="0 0 16 16"
+ className={cn("h-4 w-4 -rotate-90", spinning && "animate-spin")}
+ >
+ <circle
+ cx="8"
+ cy="8"
+ r={RING_RADIUS}
+ fill="none"
+ strokeWidth="2"
+ className="stroke-border-strong"
+ />
+ <circle
+ cx="8"
+ cy="8"
+ r={RING_RADIUS}
+ fill="none"
+ strokeWidth="2"
+ strokeLinecap="round"
+ className="stroke-accent transition-[stroke-dashoffset] duration-300 ease-out"
+ strokeDasharray={RING_LENGTH}
+ strokeDashoffset={RING_LENGTH * (1 - clamped / 100)}
+ />
+ </svg>
+ );
+}
+
+/**
+ * The update entry point in the title strip.
+ *
+ * At rest it is one more quiet icon among theme, detach and restart: a download
+ * glyph with a small accent dot. That is the whole announcement — an update is
+ * good news, not an alarm, and most of the time the user is busy with
+ * something else. Clicking opens a small panel with the version, the release
+ * notes and the one action, so a stray click can never start a restart.
+ *
+ * It renders only when the backend reports a managed install with a newer
+ * published release (``status.update_available``) — or with a
+ * staged-but-not-installed transaction (``status.pending_update``) left behind
+ * by an earlier attempt. "Update & restart" stages the new code
+ * (`POST /api/update/apply`) and then restarts to install it, reusing the same
+ * mission-guard (409 → force) flow as the restart button. On a dev tree or
+ * manual clone the status is ``managed: false``, so this renders nothing and
+ * can never trigger a self-update.
+ *
+ * While the update runs, the icon becomes a progress ring and the panel (if
+ * open) shows the percentage, the server's sub-status and a thin bar.
*/
function UpdateButton() {
const t = useT();
@@ -392,11 +466,12 @@ function UpdateButton() {
const { status } = useUpdate();
const [busy, setBusy] = useState(false);
const [forceArmed, setForceArmed] = useState(false);
- const [showNotes, setShowNotes] = useState(false);
+ const [open, setOpen] = useState(false);
const [progress, setProgress] = useState<UpdateProgress | null>(null);
const [restarting, setRestarting] = useState(false);
const resetTimer = useRef<number | null>(null);
const rollbackNotified = useRef<string | null>(null);
+ const rootRef = useRef<HTMLDivElement | null>(null);
// Poll the progress side channel for as long as the apply request is in
// flight. It stops on its own when the button leaves the busy state, and a
@@ -417,6 +492,27 @@ function UpdateButton() {
};
}, [busy]);
+ // The panel closes on a click outside it or on Escape, like every other
+ // floating layer — but never mid-update by accident: the progress lives
+ // there, and the ring on the button keeps reporting either way.
+ useEffect(() => {
+ if (!open) return;
+ const onPointerDown = (event: PointerEvent) => {
+ const root = rootRef.current;
+ if (root && event.target instanceof Node && root.contains(event.target)) return;
+ setOpen(false);
+ };
+ const onKeyDown = (event: KeyboardEvent) => {
+ if (event.key === "Escape") setOpen(false);
+ };
+ document.addEventListener("pointerdown", onPointerDown);
+ document.addEventListener("keydown", onKeyDown);
+ return () => {
+ document.removeEventListener("pointerdown", onPointerDown);
+ document.removeEventListener("keydown", onKeyDown);
+ };
+ }, [open]);
+
const clearResetTimer = useCallback(() => {
if (resetTimer.current !== null) {
clearTimeout(resetTimer.current);
@@ -456,23 +552,51 @@ function UpdateButton() {
if (!hasOffer && !hasStaged) return null;
const shownVersion = status.latest ?? status.pending_update?.version ?? null;
+ // The mission guard refused (a quit would kill live missions): surface the
+ // count and arm a force override, so the next click is the user's explicit
+ // decision — never a silent kill.
+ function armForce(count: number) {
+ setBusy(false);
+ setProgress(null);
+ setForceArmed(true);
+ setOpen(true);
+ clearResetTimer();
+ resetTimer.current = window.setTimeout(() => {
+ setForceArmed(false);
+ resetTimer.current = null;
+ }, CONFIRM_TIMEOUT_MS);
+ pushToast("warning", `${count} ${t("topbar.restart_missions_running")}`);
+ }
+
async function run(force: boolean) {
clearResetTimer();
setBusy(true);
setRestarting(false);
setProgress(null);
- setShowNotes(false);
// 1. Stage the new code. The server re-verifies the managed-install guard,
// so a spoofed client can't force a reset on an unmanaged checkout. This is
// idempotent — with a transaction already staged it succeeds even offline.
try {
- const applyRes = await fetch("/api/update/apply", { method: "POST" });
+ const applyRes = await fetch(
+ force ? "/api/update/apply?force=true" : "/api/update/apply",
+ { method: "POST" },
+ );
const applyBody = (await applyRes.json().catch(() => ({}))) as {
- detail?: string;
+ detail?: unknown;
+ restart_required?: boolean;
deps_warning?: string | null;
desktop_integration_warning?: string | null;
};
+ const missionGuard = applyBody.detail as
+ | { error?: string; missions?: unknown[] }
+ | undefined;
+ if (applyRes.status === 409 && missionGuard?.error === "missions_running") {
+ // A native install quits for the installer, so the server runs the
+ // mission guard BEFORE downloading. Same override as the restart.
+ armForce(missionGuard.missions?.length ?? 0);
+ return;
+ }
if (!applyRes.ok) {
// 403 unmanaged / 409 nothing newer / 502 git or GitHub failure — the
// backend's detail says WHICH, and the user must get to see it.
@@ -483,7 +607,9 @@ function UpdateButton() {
"error",
withDetail(
t("topbar.update_failed"),
- applyBody.detail ?? `HTTP ${applyRes.status}`,
+ typeof applyBody.detail === "string"
+ ? applyBody.detail
+ : `HTTP ${applyRes.status}`,
),
);
return;
@@ -494,6 +620,14 @@ function UpdateButton() {
if (applyBody.desktop_integration_warning) {
pushToast("warning", t("topbar.update_desktop_warning"));
}
+ if (applyBody.restart_required === false) {
+ // A native installer took over and the server is already closing
+ // this app; the new version starts by itself once it is gone. A
+ // restart on top would race the installer for the program files.
+ setRestarting(true);
+ pushToast("info", t("topbar.update_restarting"));
+ return;
+ }
} catch {
setBusy(false);
setProgress(null);
@@ -524,18 +658,7 @@ function UpdateButton() {
} catch {
/* malformed body — still arm the override */
}
- setBusy(false);
- setProgress(null);
- setForceArmed(true);
- clearResetTimer();
- resetTimer.current = window.setTimeout(() => {
- setForceArmed(false);
- resetTimer.current = null;
- }, CONFIRM_TIMEOUT_MS);
- pushToast(
- "warning",
- `${count} ${t("topbar.restart_missions_running")}`,
- );
+ armForce(count);
return;
}
if (restartRes.ok) {
@@ -570,7 +693,7 @@ function UpdateButton() {
);
}
- function onClick() {
+ function onInstall() {
if (busy) return;
void run(forceArmed);
}
@@ -579,78 +702,134 @@ function UpdateButton() {
// the restart — the one phase nothing can measure, because the thing that
// would report it is the thing shutting down.
const percent = restarting ? 100 : (progress?.percent ?? 0);
- const label = restarting
+ const busyLabel = restarting
? t("topbar.update_restarting")
- : busy
- ? fill(t("topbar.updating_percent"), { percent })
- : forceArmed
- ? t("topbar.restart_force")
- : hasOffer
- ? t("topbar.update_available")
- : t("topbar.update_finish_restart");
+ : fill(t("topbar.updating_percent"), { percent });
+ const title = hasOffer ? t("topbar.update_available") : t("topbar.update_finish_restart");
+ const buttonLabel = busy
+ ? busyLabel
+ : shownVersion
+ ? `${title} · v${shownVersion}`
+ : title;
+ const actionLabel = forceArmed
+ ? t("topbar.restart_force")
+ : hasOffer
+ ? t("topbar.update_now")
+ : t("topbar.update_finish_restart");
+ const notes = status.notes ? plainNotes(status.notes) : "";
return (
- <div
- className="relative"
- onMouseEnter={() => !busy && status.notes && setShowNotes(true)}
- onMouseLeave={() => setShowNotes(false)}
- >
+ <div ref={rootRef} className="relative">
<button
type="button"
- onClick={onClick}
- disabled={busy}
- title={busy ? (progress?.detail ?? label) : t("topbar.update_hint")}
- // The button doubles as the progress bar while it runs, so it carries
- // the ARIA role of one — a screen reader announces the same percentage
- // the fill shows. Outside an update those attributes must be absent,
- // not zeroed, or it reads as a bar stuck at 0 %.
+ onClick={() => setOpen((v) => !v)}
+ title={busy ? (progress?.detail ?? busyLabel) : buttonLabel}
+ aria-label={buttonLabel}
+ aria-haspopup="dialog"
+ aria-expanded={open}
+ data-testid="update-button"
+ // While it runs, the button carries the ARIA role of the progress bar
+ // its ring draws — a screen reader announces the same percentage.
+ // Outside an update those attributes must be absent, not zeroed, or it
+ // reads as a bar stuck at 0 %.
role={busy ? "progressbar" : undefined}
aria-valuemin={busy ? 0 : undefined}
aria-valuemax={busy ? 100 : undefined}
aria-valuenow={busy ? percent : undefined}
className={clsx(
CHROME_BUTTON,
- "relative overflow-hidden px-3",
- // The one offer in the bar, so it is the one thing here with a fill
- // of its own: an object on the chrome, answering the pointer one
- // step up. It used to be accent-tinted TEXT on an accent-tinted
- // wash, which put the loudest ink in the window on a button most
- // users never need.
- forceArmed ? CHROME_ARMED : "bg-card text-foreground hover:bg-secondary",
+ "relative w-8 justify-center px-0",
+ open ? "bg-secondary text-foreground" : CHROME_QUIET,
)}
>
- {busy && (
- <span
- aria-hidden
- data-testid="update-progress-fill"
- // The bar is the next surface UP from the button's own, so it
- // stays readable whether the button is resting or hovered — and
- // it is a named token, not a tint of one.
- className="absolute inset-y-0 left-0 bg-popover transition-[width] duration-300 ease-out"
- style={{ width: `${percent}%` }}
- />
- )}
- <Download
- aria-hidden
- className={cn("relative h-4 w-4", busy && "animate-pulse")}
- />
- <span className="relative tabular-nums">{label}</span>
- {!busy && !forceArmed && shownVersion && (
- <span className="relative rounded-full bg-secondary px-1.5 text-micro tabular-nums text-muted-foreground">
- v{shownVersion}
- </span>
+ {busy ? (
+ <ProgressRing percent={percent} spinning={restarting} />
+ ) : (
+ <>
+ <Download aria-hidden className="h-4 w-4" />
+ {/* The whole announcement: one accent dot, like an unread mark. */}
+ <span
+ aria-hidden
+ data-testid="update-dot"
+ className="absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full bg-accent"
+ />
+ </>
)}
</button>
- {showNotes && status.notes && (
+ {open && (
// A floating layer: the float surface, the float shadow, and no border
// of its own — the shadow already carries the rim.
- <div className="absolute right-0 top-full z-50 mt-2 w-80 rounded-lg bg-popover p-block text-left shadow-float">
- <div className="mb-2 text-title font-semibold text-foreground-strong">
- {t("topbar.update_available")} · v{shownVersion}
- </div>
- <div className="max-h-64 overflow-y-auto whitespace-pre-wrap text-meta text-muted-foreground">
- {status.notes.slice(0, 800)}
+ <div
+ role="dialog"
+ aria-label={title}
+ data-testid="update-panel"
+ className="absolute right-0 top-full z-50 mt-1.5 w-72 rounded-lg bg-popover p-3 text-left shadow-float"
+ >
+ <div className="flex items-baseline justify-between gap-3">
+ <span className="text-meta font-semibold text-foreground-strong">
+ {busy ? busyLabel : title}
+ </span>
+ {shownVersion && (
+ <span className="shrink-0 text-micro tabular-nums text-muted-foreground">
+ v{shownVersion}
+ </span>
+ )}
</div>
+ {busy ? (
+ <>
+ <div className="mt-2.5 h-1 overflow-hidden rounded-full bg-secondary">
+ <div
+ aria-hidden
+ data-testid="update-progress-fill"
+ className="h-full rounded-full bg-accent transition-[width] duration-300 ease-out"
+ style={{ width: `${percent}%` }}
+ />
+ </div>
+ {progress?.detail && !restarting && (
+ <div className="mt-1.5 truncate text-micro tabular-nums text-muted-foreground">
+ {progress.detail}
+ </div>
+ )}
+ </>
+ ) : (
+ <>
+ <div className="mt-0.5 text-micro text-muted-foreground">
+ {fill(t("topbar.update_current_version"), { version: status.current })}
+ </div>
+ {notes && (
+ <div className="mt-2.5 max-h-48 overflow-y-auto whitespace-pre-wrap border-t border-border pt-2.5 text-micro leading-relaxed text-muted-foreground">
+ {notes}
+ </div>
+ )}
+ <div className="mt-3 flex flex-wrap items-center justify-between gap-x-2 gap-y-2">
+ <span className="min-w-0 text-micro text-muted-foreground">
+ {t("topbar.update_restart_note")}
+ </span>
+ <div className="ml-auto flex shrink-0 items-center gap-1.5">
+ <button
+ type="button"
+ onClick={() => setOpen(false)}
+ className="h-7 rounded-md px-2.5 text-micro 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"
+ >
+ {t("topbar.update_later")}
+ </button>
+ <button
+ type="button"
+ onClick={onInstall}
+ data-testid="update-install"
+ className={clsx(
+ "h-7 rounded-md px-2.5 text-micro font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ forceArmed
+ ? CHROME_ARMED
+ : "bg-primary text-primary-foreground hover:bg-primary/90",
+ )}
+ >
+ {actionLabel}
+ </button>
+ </div>
+ </div>
+ </>
+ )}
</div>
)}
</div>
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 4e6e9b125d..a98020c77a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -108,6 +108,10 @@
"update_staged_restart_failed": "Update heruntergeladen — starte {name} neu, um die Installation abzuschließen",
"update_rolled_back": "Das letzte Update konnte nicht installiert werden — {name} wurde auf die vorherige Version zurückgesetzt",
"update_network_error": "Netzwerkfehler",
+ "update_now": "Aktualisieren & neu starten",
+ "update_later": "Später",
+ "update_current_version": "Installiert: v{version}",
+ "update_restart_note": "{name} startet einmal neu.",
"detach": "Eigenes Fenster",
"detach_hint": "Diese Ansicht in einem eigenen Fenster öffnen",
"detach_failed": "Eigenes Fenster konnte nicht geöffnet werden",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 09557ebf77..bcfbf15b2a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -108,6 +108,10 @@
"update_staged_restart_failed": "Update downloaded — restart {name} to finish installing it",
"update_rolled_back": "The last update could not be installed — {name} was rolled back to the previous version",
"update_network_error": "network error",
+ "update_now": "Update & restart",
+ "update_later": "Later",
+ "update_current_version": "You have v{version}",
+ "update_restart_note": "{name} restarts once.",
"detach": "Own window",
"detach_hint": "Open this view in its own window",
"detach_failed": "Could not open a separate window",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 6b02de9c64..9467b5192a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -108,6 +108,10 @@
"update_staged_restart_failed": "Actualización descargada — reinicia {name} para terminar la instalación",
"update_rolled_back": "La última actualización no se pudo instalar — {name} volvió a la versión anterior",
"update_network_error": "error de red",
+ "update_now": "Actualizar y reiniciar",
+ "update_later": "Más tarde",
+ "update_current_version": "Tienes la v{version}",
+ "update_restart_note": "{name} se reinicia una vez.",
"detach": "Ventana propia",
"detach_hint": "Abrir esta vista en su propia ventana",
"detach_failed": "No se pudo abrir una ventana separada",