Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(updates): bottom-right UpdateCard with progress, minimize, restart

enes322b11dbbe58
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index d1a58197f..099db198e 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -49,7 +49,7 @@ import { SettingsPanel } from '../components/SettingsPanel'
import { SourceControlPanel } from '../components/SourceControlPanel'
import { WelcomeScreen } from '../components/WelcomeScreen'
import { ShortcutsPanel } from '../components/ShortcutsPanel'
-import { UpdateBanner } from '../components/UpdateBanner'
+import { UpdateCard } from '../components/UpdateCard'
import { AnnouncementBanner } from '../components/AnnouncementBanner'
import { ConfirmDialog } from '../components/ConfirmDialog'
import { NotifyConsentDialog } from '../components/NotifyConsentDialog'
@@ -1426,9 +1426,9 @@ export function Canvas() {
/>
<div className="top-banners">
- <UpdateBanner />
<AnnouncementBanner />
</div>
+ <UpdateCard />
<div className="controls-cluster">
<button
diff --git a/src/renderer/components/UpdateBanner.tsx b/src/renderer/components/UpdateBanner.tsx
deleted file mode 100644
index 4a4ddea9c..000000000
--- a/src/renderer/components/UpdateBanner.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import { useEffect, useState } from 'react'
-
-// Thin strip under the tab bar that announces a newer version. While the update downloads
-// it shows "Downloading…"; once ready it offers "Restart to update" (→ updates.restart()).
-// In dev the main process never emits these events, so the banner stays hidden.
-export function UpdateBanner(): JSX.Element | null {
- const [version, setVersion] = useState<string | null>(null)
- const [ready, setReady] = useState(false)
- const [dismissed, setDismissed] = useState(false)
-
- useEffect(() => {
- const offAvailable = window.nodeTerminal.updates.onAvailable((info) => {
- setVersion(info.version)
- setReady(false)
- setDismissed(false)
- })
- const offDownloaded = window.nodeTerminal.updates.onDownloaded((info) => {
- setVersion(info.version)
- setReady(true)
- })
- return () => {
- offAvailable()
- offDownloaded()
- }
- }, [])
-
- if (!version || dismissed) return null
-
- return (
- <div className="update-banner">
- <span className="update-banner__dot" />
- <span className="update-banner__text">
- {ready
- ? `nodeterm ${version} is ready to install`
- : `Downloading nodeterm ${version}…`}
- </span>
- {ready && (
- <button
- className="update-banner__btn"
- onClick={() => window.nodeTerminal.updates.restart()}
- >
- Restart to update
- </button>
- )}
- <button
- className="update-banner__close"
- title="Dismiss"
- onClick={() => setDismissed(true)}
- >
- ✕
- </button>
- </div>
- )
-}
diff --git a/src/renderer/components/UpdateCard.tsx b/src/renderer/components/UpdateCard.tsx
new file mode 100644
index 000000000..9ce503c11
--- /dev/null
+++ b/src/renderer/components/UpdateCard.tsx
@@ -0,0 +1,167 @@
+import { useEffect, useRef, useState } from 'react'
+import type { UpdateProgress } from '@shared/types'
+
+// The full updater lifecycle as one status union, driving a fixed bottom-right card.
+// `checking` is only ever shown for a user-initiated manual check; automatic checks stay
+// silent until they produce an `available` (or, for a manual check, `upToDate`/`error`).
+type Status =
+ | { kind: 'idle' }
+ | { kind: 'checking' }
+ | { kind: 'available'; version: string; percent: number }
+ | { kind: 'downloaded'; version: string }
+ | { kind: 'upToDate' }
+ | { kind: 'error'; message: string }
+
+const RELEASES_URL = 'https://nodeterm.dev/releases'
+
+export function UpdateCard(): JSX.Element | null {
+ const [status, setStatus] = useState<Status>({ kind: 'idle' })
+ const [minimized, setMinimized] = useState(false)
+ const upToDateTimer = useRef<number | null>(null)
+
+ useEffect(() => {
+ const offAvailable = window.nodeTerminal.updates.onAvailable((info) => {
+ setStatus({ kind: 'available', version: info.version, percent: 0 })
+ setMinimized(false)
+ })
+ const offProgress = window.nodeTerminal.updates.onProgress((p: UpdateProgress) => {
+ setStatus((s) => (s.kind === 'available' ? { ...s, percent: p.percent } : s))
+ })
+ const offDownloaded = window.nodeTerminal.updates.onDownloaded((info) => {
+ setStatus({ kind: 'downloaded', version: info.version })
+ setMinimized(false)
+ })
+ const offNotAvailable = window.nodeTerminal.updates.onNotAvailable(() => {
+ setStatus({ kind: 'upToDate' })
+ setMinimized(false)
+ if (upToDateTimer.current) window.clearTimeout(upToDateTimer.current)
+ upToDateTimer.current = window.setTimeout(() => setStatus({ kind: 'idle' }), 4000)
+ })
+ const offError = window.nodeTerminal.updates.onError((message) => {
+ setStatus({ kind: 'error', message })
+ setMinimized(false)
+ })
+ return () => {
+ offAvailable()
+ offProgress()
+ offDownloaded()
+ offNotAvailable()
+ offError()
+ if (upToDateTimer.current) window.clearTimeout(upToDateTimer.current)
+ }
+ }, [])
+
+ // Dev-only: drive the card through its states from the console without packaging, e.g.
+ // __simulateUpdate({ kind: 'available', version: '0.3.0', percent: 42 })
+ useEffect(() => {
+ ;(window as unknown as { __simulateUpdate?: (s: Status) => void }).__simulateUpdate = (s) =>
+ setStatus(s)
+ return () => {
+ delete (window as unknown as { __simulateUpdate?: unknown }).__simulateUpdate
+ }
+ }, [])
+
+ if (status.kind === 'idle') return null
+
+ const openReleases = () => window.open(RELEASES_URL, '_blank', 'noopener')
+ const dismiss = () => setStatus({ kind: 'idle' })
+
+ if (minimized) {
+ const label =
+ status.kind === 'available'
+ ? `${Math.round(status.percent)}%`
+ : status.kind === 'downloaded'
+ ? 'Ready'
+ : status.kind === 'error'
+ ? '!'
+ : '…'
+ return (
+ <button
+ className="update-card update-card--pill"
+ title="Show update"
+ onClick={() => setMinimized(false)}
+ >
+ <span className="update-card__dot" />
+ {label}
+ </button>
+ )
+ }
+
+ const title =
+ status.kind === 'checking'
+ ? 'Checking for updates…'
+ : status.kind === 'available'
+ ? 'Downloading Update'
+ : status.kind === 'downloaded'
+ ? 'Update ready'
+ : status.kind === 'upToDate'
+ ? "You're up to date"
+ : 'Update failed'
+
+ const canMinimize = status.kind === 'available' || status.kind === 'downloaded'
+ const canDismiss =
+ status.kind === 'downloaded' || status.kind === 'upToDate' || status.kind === 'error'
+
+ return (
+ <div className="update-card">
+ <div className="update-card__head">
+ <span className="update-card__title">{title}</span>
+ {canMinimize && (
+ <button className="update-card__icon" title="Minimize" onClick={() => setMinimized(true)}>
+ —
+ </button>
+ )}
+ {canDismiss && (
+ <button className="update-card__icon" title="Dismiss" onClick={dismiss}>
+ ✕
+ </button>
+ )}
+ </div>
+
+ {status.kind === 'checking' && (
+ <p className="update-card__body">Looking for a newer version…</p>
+ )}
+
+ {status.kind === 'available' && (
+ <>
+ <p className="update-card__body">nodeterm v{status.version} is downloading.</p>
+ <button className="update-card__link" onClick={openReleases}>
+ Release notes
+ </button>
+ <div className="update-card__bar">
+ <div className="update-card__bar-fill" style={{ width: `${status.percent}%` }} />
+ </div>
+ <p className="update-card__pct">Downloading… {Math.round(status.percent)}%</p>
+ </>
+ )}
+
+ {status.kind === 'downloaded' && (
+ <>
+ <p className="update-card__body">nodeterm v{status.version} is ready to install.</p>
+ <button className="update-card__link" onClick={openReleases}>
+ Release notes
+ </button>
+ <button
+ className="update-card__btn"
+ onClick={() => window.nodeTerminal.updates.restart()}
+ >
+ Restart to update
+ </button>
+ </>
+ )}
+
+ {status.kind === 'upToDate' && (
+ <p className="update-card__body">nodeterm is on the latest version.</p>
+ )}
+
+ {status.kind === 'error' && (
+ <>
+ <p className="update-card__body">{status.message}</p>
+ <button className="update-card__link" onClick={openReleases}>
+ Download manually
+ </button>
+ </>
+ )}
+ </div>
+ )
+}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 308b81f2f..f4606995f 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -1342,6 +1342,131 @@ body,
background: rgba(255, 255, 255, 0.08);
}
+/* Bottom-right auto-update card (download progress + restart). */
+.update-card {
+ position: fixed;
+ right: 20px;
+ bottom: 20px;
+ z-index: 40;
+ width: 340px;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ padding: 18px 20px;
+ background: rgba(28, 28, 30, 0.98);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ border-radius: 14px;
+ box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
+ color: var(--text);
+ -webkit-app-region: no-drag;
+}
+
+.update-card__head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+}
+
+.update-card__title {
+ font-size: 15px;
+ font-weight: 600;
+}
+
+.update-card__icon {
+ width: 24px;
+ height: 24px;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ background: transparent;
+ border: none;
+ border-radius: 6px;
+ color: var(--text-dim, rgba(255, 255, 255, 0.6));
+ font-size: 13px;
+ cursor: pointer;
+}
+
+.update-card__icon:hover {
+ background: rgba(255, 255, 255, 0.08);
+}
+
+.update-card__body {
+ margin: 0;
+ font-size: 13.5px;
+ color: var(--text-dim, rgba(255, 255, 255, 0.75));
+}
+
+.update-card__link {
+ align-self: flex-start;
+ padding: 0;
+ background: none;
+ border: none;
+ color: var(--text-dim, rgba(255, 255, 255, 0.7));
+ font-size: 13px;
+ text-decoration: underline;
+ cursor: pointer;
+}
+
+.update-card__link:hover {
+ color: var(--text);
+}
+
+.update-card__bar {
+ height: 6px;
+ border-radius: 3px;
+ background: rgba(255, 255, 255, 0.12);
+ overflow: hidden;
+}
+
+.update-card__bar-fill {
+ height: 100%;
+ background: var(--text, #fff);
+ border-radius: 3px;
+ transition: width 0.2s ease;
+}
+
+.update-card__pct {
+ margin: 0;
+ font-size: 12.5px;
+ color: var(--text-dim, rgba(255, 255, 255, 0.6));
+}
+
+.update-card__btn {
+ align-self: flex-start;
+ padding: 6px 14px;
+ background: var(--accent);
+ border: none;
+ border-radius: 8px;
+ color: #fff;
+ font-size: 13px;
+ font-weight: 600;
+ cursor: pointer;
+}
+
+.update-card__btn:hover {
+ background: var(--accent-hover);
+}
+
+.update-card--pill {
+ flex-direction: row;
+ align-items: center;
+ gap: 8px;
+ width: auto;
+ padding: 8px 14px;
+ font-size: 13px;
+ font-weight: 600;
+ cursor: pointer;
+}
+
+.update-card__dot {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: var(--accent);
+ box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
+}
+
/* In-app announcements strip (news from the website feed). */
.announce-banner {
display: flex;