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.

Revert "feat(update): "What's new" preview modal before applying an update"

Ruben Lütke47bbc50ac341
diff --git a/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsx b/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsx
index 6e21171c13..ec7ba46b9c 100644
--- a/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsx
+++ b/jarvis/ui/web/frontend/src/__tests__/topbarUpdateButton.test.tsx
@@ -3,13 +3,7 @@
* 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).
*/
-import {
- cleanup,
- fireEvent,
- render,
- screen,
- waitFor,
-} from "@testing-library/react";
+import { cleanup, render, screen, waitFor } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { TopBar } from "@/components/layout/TopBar";
@@ -50,28 +44,6 @@ describe("TopBar update button", () => {
expect(screen.getByText("v1.0.2")).toBeTruthy();
});
- it("opens the What's-new preview modal with the release notes on click", async () => {
- mockUpdateStatus({
- managed: true,
- current: "1.0.1",
- latest: "1.0.2",
- update_available: true,
- notes: "### Fixed\n\n- The stubborn bug is finally gone",
- published_at: null,
- release_url:
- "https://github.com/PersonalJarvis/PersonalJarvis/releases/tag/v1.0.2",
- });
- render(<TopBar />);
- const btn = await screen.findByRole("button", { name: /Update available/ });
- // The button only PREVIEWS — it must not update on its own.
- fireEvent.click(btn);
- await waitFor(() => expect(screen.getByText("What's new")).toBeTruthy());
- expect(screen.getByText(/The stubborn bug is finally gone/)).toBeTruthy();
- // The confirm action lives inside the modal, not on the top bar.
- expect(screen.getByText("Update now")).toBeTruthy();
- expect(screen.getByText("Later")).toBeTruthy();
- });
-
it("hides the Update button on an unmanaged checkout (dev-tree guard)", async () => {
mockUpdateStatus({
managed: false,
diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
index 06895e3af5..df30ee2ed4 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
@@ -5,7 +5,6 @@ import { useEventStore } from "@/store/events";
import { useUpdate } from "@/hooks/useUpdate";
import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
-import { WhatsNewModal } from "./WhatsNewModal";
/**
* Global top bar rendered above every view (see App.tsx). It carries the app-
@@ -150,21 +149,19 @@ export function TopBar() {
/**
* Shown ONLY when the backend reports a managed install with a newer published
- * release (``status.update_available``). A click opens the "What's new" modal
- * (``WhatsNewModal``) that previews the full release notes; the user confirms
- * there with "Update now", which pulls the new code (`POST /api/update/apply`)
- * and restarts to load it, reusing the same mission-guard (409 → force) flow as
- * the restart button. On a dev tree / manual clone the status is
- * ``managed: false``, so this renders nothing and can never trigger a
- * self-update.
+ * release (``status.update_available``). One click pulls the new code
+ * (`POST /api/update/apply`) and then restarts to load 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.
*/
function UpdateButton() {
const t = useT();
const pushToast = useEventStore((s) => s.pushToast);
const { status } = useUpdate();
- const [open, setOpen] = useState(false);
const [busy, setBusy] = useState(false);
const [forceArmed, setForceArmed] = useState(false);
+ const [showNotes, setShowNotes] = useState(false);
const resetTimer = useRef<number | null>(null);
const clearResetTimer = useCallback(() => {
@@ -180,6 +177,7 @@ function UpdateButton() {
async function run(force: boolean) {
clearResetTimer();
setBusy(true);
+ setShowNotes(false);
try {
// 1. Pull the new code. The server re-verifies the managed-install guard,
// so a spoofed client can't force a reset on an unmanaged checkout.
@@ -206,8 +204,6 @@ function UpdateButton() {
} catch {
/* malformed body — still arm the override */
}
- // Keep the modal OPEN so the next "Update now" click is the user's
- // explicit override — mirrors the restart button's 409 → force flow.
setBusy(false);
setForceArmed(true);
clearResetTimer();
@@ -220,7 +216,7 @@ function UpdateButton() {
}
if (!restartRes.ok) throw new Error(`restart-failed:${restartRes.status}`);
// Success — the code is pulled and the window goes away shortly; keep the
- // busy state so the modal never flips back before the app dies.
+ // busy state so the button never flips back before the app dies.
pushToast("info", t("topbar.updating"));
} catch {
// apply failed (403 on an unmanaged host, 502/500 on a git error) or the
@@ -231,41 +227,56 @@ function UpdateButton() {
}
}
- function closeModal() {
- if (busy) return; // never dismiss mid-update
- setOpen(false);
- setForceArmed(false);
- clearResetTimer();
+ function onClick() {
+ if (busy) return;
+ void run(forceArmed);
}
+ const label = busy
+ ? t("topbar.updating")
+ : forceArmed
+ ? t("topbar.restart_force")
+ : t("topbar.update_available");
+
return (
- <>
+ <div
+ className="relative"
+ onMouseEnter={() => !busy && status.notes && setShowNotes(true)}
+ onMouseLeave={() => setShowNotes(false)}
+ >
<button
type="button"
- onClick={() => setOpen(true)}
+ onClick={onClick}
+ disabled={busy}
title={t("topbar.update_hint")}
className={cn(
- "inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",
- "border-primary/50 bg-primary/10 text-primary hover:bg-primary/20",
+ "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",
+ forceArmed
+ ? "border-amber-500/60 bg-amber-500/10 text-amber-500 hover:bg-amber-500/20"
+ : "border-primary/50 bg-primary/10 text-primary hover:bg-primary/20",
)}
>
- <Download aria-hidden className="h-3.5 w-3.5" />
- {t("topbar.update_available")}
- {status.latest && (
+ <Download
+ aria-hidden
+ className={cn("h-3.5 w-3.5", busy && "animate-pulse")}
+ />
+ {label}
+ {!busy && !forceArmed && status.latest && (
<span className="rounded bg-primary/20 px-1 text-[10px] tabular-nums">
v{status.latest}
</span>
)}
</button>
- {open && (
- <WhatsNewModal
- status={status}
- busy={busy}
- forceArmed={forceArmed}
- onApply={() => void run(forceArmed)}
- onClose={closeModal}
- />
+ {showNotes && status.notes && (
+ <div className="absolute right-0 top-full z-50 mt-1 w-80 rounded-md border border-border bg-background p-3 text-left shadow-lg">
+ <div className="mb-1 text-xs font-semibold text-foreground">
+ {t("topbar.update_available")} · v{status.latest}
+ </div>
+ <div className="max-h-64 overflow-y-auto whitespace-pre-wrap text-[11px] leading-relaxed text-muted-foreground">
+ {status.notes.slice(0, 800)}
+ </div>
+ </div>
)}
- </>
+ </div>
);
}
diff --git a/jarvis/ui/web/frontend/src/components/layout/WhatsNewModal.tsx b/jarvis/ui/web/frontend/src/components/layout/WhatsNewModal.tsx
deleted file mode 100644
index c8efd9b6b3..0000000000
--- a/jarvis/ui/web/frontend/src/components/layout/WhatsNewModal.tsx
+++ /dev/null
@@ -1,287 +0,0 @@
-/**
- * "What's new" preview modal — opened from the TopBar update button BEFORE the
- * update is applied. It shows the full release notes of the newer published
- * version (grouped Added / Fixed / Changed …) so the user sees exactly what the
- * update brings, then confirms with "Update now" (which runs the same
- * apply + restart flow the button used to run directly) or dismisses with
- * "Later".
- *
- * The notes come from GET /api/update/status (`status.notes`), which is the
- * GitHub Release body — Keep-a-Changelog markdown. It is rendered with the same
- * `react-markdown` the wiki uses, so no new dependency is pulled in.
- *
- * The modal is a centered overlay with rounded corners, matching the app's
- * FrontierSwitchModal chrome. It closes on the overlay click, on Escape, and on
- * "Later"; it never closes on its own while an update is in flight (`busy`).
- */
-import { useEffect } from "react";
-import { createPortal } from "react-dom";
-import ReactMarkdown from "react-markdown";
-import { Download, ExternalLink, Sparkles, X } from "lucide-react";
-
-import type { UpdateStatus } from "@/hooks/useUpdate";
-import { cn } from "@/lib/utils";
-import { useT } from "@/i18n";
-
-interface WhatsNewModalProps {
- status: UpdateStatus;
- busy: boolean;
- forceArmed: boolean;
- onApply: () => void;
- onClose: () => void;
-}
-
-/** Extract the plain text of a markdown heading's children (for colour-coding). */
-function headingText(children: React.ReactNode): string {
- if (typeof children === "string") return children;
- if (Array.isArray(children)) return children.map(headingText).join("");
- return "";
-}
-
-/**
- * A left-border accent per changelog category, so "Added / Fixed / Changed …"
- * read at a glance. Word-matched (not locale-specific) against the English
- * section names the release body always uses.
- */
-function categoryAccent(text: string): string {
- const t = text.toLowerCase();
- if (t.includes("add") || t.includes("new") || t.includes("highlight"))
- return "border-emerald-500/70";
- if (t.includes("fix")) return "border-sky-500/70";
- if (t.includes("chang") || t.includes("improv")) return "border-amber-500/70";
- if (t.includes("remov") || t.includes("deprecat")) return "border-rose-500/70";
- if (t.includes("security")) return "border-violet-500/70";
- return "border-primary/60";
-}
-
-function formatDate(iso: string | null): string | null {
- if (!iso) return null;
- const d = new Date(iso);
- if (Number.isNaN(d.getTime())) return null;
- return d.toLocaleDateString(undefined, {
- year: "numeric",
- month: "long",
- day: "numeric",
- });
-}
-
-export function WhatsNewModal({
- status,
- busy,
- forceArmed,
- onApply,
- onClose,
-}: WhatsNewModalProps) {
- const t = useT();
- const released = formatDate(status.published_at);
-
- // Escape closes the modal (but never mid-update).
- useEffect(() => {
- const onKey = (e: KeyboardEvent) => {
- if (e.key === "Escape" && !busy) onClose();
- };
- window.addEventListener("keydown", onKey);
- return () => window.removeEventListener("keydown", onKey);
- }, [busy, onClose]);
-
- const applyLabel = busy
- ? t("topbar.update_installing")
- : forceArmed
- ? t("topbar.update_force")
- : t("topbar.update_now");
-
- // Portal to <body>: the TopBar (this modal's React parent) carries a
- // `backdrop-blur`, and a backdrop-filter makes its element the containing
- // block for `position: fixed` descendants — which would pin the overlay to
- // the 40px-tall bar instead of the viewport. Rendering through a portal
- // escapes that stacking context so `inset-0` means the full screen again.
- return createPortal(
- <div
- className={cn(
- "fixed inset-0 z-[70] flex items-center justify-center",
- "bg-background/80 p-4 backdrop-blur-sm",
- "animate-in fade-in duration-200",
- )}
- role="dialog"
- aria-modal="true"
- aria-labelledby="whats-new-title"
- onClick={() => !busy && onClose()}
- >
- <div
- onClick={(e) => e.stopPropagation()}
- className={cn(
- "flex max-h-[82vh] w-full max-w-xl flex-col",
- "rounded-2xl border border-primary/40 bg-card",
- "shadow-[0_0_60px_rgba(255,214,10,0.18)]",
- "animate-in zoom-in-95 fade-in duration-200",
- )}
- >
- {/* Header — fixed */}
- <div className="flex items-start gap-3 border-b border-border px-6 py-5">
- <div className="mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary">
- <Sparkles className="h-5 w-5" />
- </div>
- <div className="min-w-0 flex-1">
- <h2
- id="whats-new-title"
- className="text-base font-semibold text-foreground"
- >
- {t("topbar.update_whats_new")}
- </h2>
- <div className="mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
- {status.latest && (
- <span className="rounded bg-primary/20 px-1.5 py-0.5 font-medium tabular-nums text-primary">
- v{status.latest}
- </span>
- )}
- {status.current && status.current !== "unknown" && (
- <span className="tabular-nums">
- v{status.current} → v{status.latest}
- </span>
- )}
- {released && (
- <span>
- · {t("topbar.update_released")} {released}
- </span>
- )}
- </div>
- </div>
- <button
- type="button"
- onClick={() => !busy && onClose()}
- disabled={busy}
- aria-label={t("topbar.update_later")}
- className="shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground disabled:opacity-50"
- >
- <X className="h-4 w-4" />
- </button>
- </div>
-
- {/* Body — scrolls */}
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-4">
- {status.notes ? (
- <ReactMarkdown
- components={{
- h1: ({ children }) => (
- <h3
- className={cn(
- "mb-2 mt-5 border-l-2 pl-2 text-[13px] font-semibold uppercase tracking-wider text-foreground first:mt-0",
- categoryAccent(headingText(children)),
- )}
- >
- {children}
- </h3>
- ),
- h2: ({ children }) => (
- <h3
- className={cn(
- "mb-2 mt-5 border-l-2 pl-2 text-[13px] font-semibold uppercase tracking-wider text-foreground first:mt-0",
- categoryAccent(headingText(children)),
- )}
- >
- {children}
- </h3>
- ),
- h3: ({ children }) => (
- <h3
- className={cn(
- "mb-2 mt-5 border-l-2 pl-2 text-[13px] font-semibold uppercase tracking-wider text-foreground first:mt-0",
- categoryAccent(headingText(children)),
- )}
- >
- {children}
- </h3>
- ),
- p: ({ children }) => (
- <p className="my-2 text-sm leading-relaxed text-muted-foreground">
- {children}
- </p>
- ),
- ul: ({ children }) => (
- <ul className="my-2 list-disc space-y-1 pl-5 text-sm text-muted-foreground">
- {children}
- </ul>
- ),
- li: ({ children }) => (
- <li className="leading-relaxed">{children}</li>
- ),
- strong: ({ children }) => (
- <strong className="font-semibold text-foreground">
- {children}
- </strong>
- ),
- a: ({ href, children }) => (
- <a
- href={href}
- target="_blank"
- rel="noopener noreferrer"
- className="text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary"
- >
- {children}
- </a>
- ),
- code: ({ children }) => (
- <code className="rounded bg-background px-1 py-0.5 font-mono text-[11px] text-muted-foreground">
- {children}
- </code>
- ),
- hr: () => <hr className="my-4 border-border" />,
- }}
- >
- {status.notes}
- </ReactMarkdown>
- ) : (
- <p className="py-6 text-center text-sm text-muted-foreground">
- {t("topbar.update_no_notes")}
- </p>
- )}
- </div>
-
- {/* Footer — fixed */}
- <div className="flex items-center justify-between gap-3 border-t border-border px-6 py-4">
- {status.release_url ? (
- <a
- href={status.release_url}
- target="_blank"
- rel="noopener noreferrer"
- className="inline-flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground"
- >
- <ExternalLink className="h-3.5 w-3.5" />
- {t("topbar.update_view_online")}
- </a>
- ) : (
- <span />
- )}
- <div className="flex items-center gap-2">
- <button
- type="button"
- onClick={() => !busy && onClose()}
- disabled={busy}
- className="rounded-md border border-border bg-secondary/40 px-3 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50"
- >
- {t("topbar.update_later")}
- </button>
- <button
- type="button"
- onClick={onApply}
- disabled={busy}
- className={cn(
- "inline-flex items-center gap-1.5 rounded-md border px-4 py-1.5 text-sm font-semibold transition-colors disabled:cursor-default disabled:opacity-70",
- forceArmed
- ? "border-amber-500/60 bg-amber-500/10 text-amber-500 hover:bg-amber-500/20"
- : "border-primary bg-primary text-primary-foreground hover:opacity-90",
- )}
- >
- <Download
- aria-hidden
- className={cn("h-4 w-4", busy && "animate-pulse")}
- />
- {applyLabel}
- </button>
- </div>
- </div>
- </div>
- </div>,
- document.body,
- );
-}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 3e9f1499d6..aed11c369b 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -24,16 +24,8 @@
"update_available": "Update verfügbar",
"updating": "{name} wird aktualisiert…",
"update_failed": "Update fehlgeschlagen",
- "update_hint": "Ansehen, was neu ist, und installieren",
- "update_deps_warning": "Aktualisiert — einige Komponenten brauchen evtl. eine manuelle Neuinstallation",
- "update_whats_new": "Was ist neu",
- "update_now": "Jetzt aktualisieren",
- "update_later": "Später",
- "update_force": "Trotzdem aktualisieren?",
- "update_released": "Veröffentlicht",
- "update_view_online": "Auf GitHub ansehen",
- "update_no_notes": "Für diese Version liegen keine Detailangaben vor.",
- "update_installing": "Wird aktualisiert…"
+ "update_hint": "Neue Version herunterladen und installieren",
+ "update_deps_warning": "Aktualisiert — einige Komponenten brauchen evtl. eine manuelle Neuinstallation"
},
"nav": {
"chats": "Chats",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 9c51dc2772..de1cab7b56 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -24,16 +24,8 @@
"update_available": "Update available",
"updating": "Updating {name}…",
"update_failed": "Update failed",
- "update_hint": "See what's new and install",
- "update_deps_warning": "Updated — some components may need a manual reinstall",
- "update_whats_new": "What's new",
- "update_now": "Update now",
- "update_later": "Later",
- "update_force": "Update anyway?",
- "update_released": "Released",
- "update_view_online": "View on GitHub",
- "update_no_notes": "No release notes available for this version.",
- "update_installing": "Updating…"
+ "update_hint": "Download and install the new version",
+ "update_deps_warning": "Updated — some components may need a manual reinstall"
},
"nav": {
"chats": "Chats",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 5a2e7fc402..364af440cc 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -24,16 +24,8 @@
"update_available": "Actualización disponible",
"updating": "Actualizando {name}…",
"update_failed": "Error al actualizar",
- "update_hint": "Ver las novedades e instalar",
- "update_deps_warning": "Actualizado — algunos componentes pueden requerir reinstalación manual",
- "update_whats_new": "Novedades",
- "update_now": "Actualizar ahora",
- "update_later": "Más tarde",
- "update_force": "¿Actualizar de todos modos?",
- "update_released": "Publicado",
- "update_view_online": "Ver en GitHub",
- "update_no_notes": "No hay notas de la versión para esta actualización.",
- "update_installing": "Actualizando…"
+ "update_hint": "Descargar e instalar la nueva versión",
+ "update_deps_warning": "Actualizado — algunos componentes pueden requerir reinstalación manual"
},
"nav": {
"chats": "Chats",