diff --git a/ui/src/components.css b/ui/src/components.css index 7fff023a0..bab45122b 100644 --- a/ui/src/components.css +++ b/ui/src/components.css @@ -282,20 +282,44 @@ svg.lucide { flex: none; stroke-width: var(--isw); } .ss-list.stick { overflow: clip; } .ss-list.stick>.ss-lh { position: sticky; top: var(--stick, 0px); z-index: 3; } .ss-list.stick>.ss-gh { position: sticky; top: calc(var(--stick, 0px) + 34px); z-index: 2; } -/* Update progress: a bar on the status card, a moving line under the row being updated, and a pop when a row finishes */ -.ss-update-icon { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 11px; background: var(--sunken); color: var(--ink); } +/* Update progress: a bar on the status card, a light that sweeps the status text of the row being updated, and a pop when a row finishes. + Those two are the only things that keep moving; icons stay still. */ +.ss-update-icon { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 11px; background: var(--sunken); color: var(--ink); transition: background-color .3s, color .3s; } .ss-update-icon.ok { background: var(--ok-bg); color: var(--ok); } .ss-update-icon.warn { background: var(--warn-bg); color: var(--warn); } -.ss-bar { position: relative; height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; } -.ss-bar>span { display: block; height: 100%; border-radius: inherit; background: var(--ink); transition: width .45s cubic-bezier(.3,.7,.3,1); } -.ss-bar.indet>span { width: 35%; animation: ss-indet 1.1s ease-in-out infinite; } +/* ProgressBar.tsx: ::before is a faint runner that shows work even at zero, the fill that covers it. */ +.ss-bar { position: relative; display: block; height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; transition: opacity .2s ease-out; } +.ss-bar::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 30%; border-radius: inherit; background: var(--ink); opacity: .18; transition: opacity .2s ease-out; animation: ss-indet 1.8s ease-in-out infinite; } +.ss-bar>i { position: absolute; inset: 0; border-radius: inherit; background: var(--ink); transition: transform .45s cubic-bezier(.3,.7,.3,1); } +/* Nothing to count: the runner alone, at full strength. */ +.ss-bar.indet::before { width: 35%; opacity: 1; } +/* Ended: the runner stops, the fill gets .6s to arrive and be seen, then the bar fades and its slot closes. */ +.ss-bar.end { opacity: 0; transition-delay: .6s; } +.ss-bar.end::before { opacity: 0; animation: none; } +.ss-bar.indet.end { transition-delay: 0s; } +.ss-barslot { display: grid; grid-template-rows: 1fr; margin-top: calc(-1 * var(--bar-gap, 0px)); transition: grid-template-rows .25s cubic-bezier(.3,.7,.3,1); } +.ss-barslot>span { display: block; min-height: 0; overflow: hidden; } +.ss-barslot .ss-bar { margin-top: var(--bar-gap, 0px); } +/* First in its column: the gap it takes back is the one below it. */ +.ss-barslot.lead { margin-top: 0; margin-bottom: calc(-1 * var(--bar-gap, 0px)); } +.ss-barslot.lead .ss-bar { margin-top: 0; margin-bottom: var(--bar-gap, 0px); } +.ss-barslot.shut { grid-template-rows: 0fr; transition-delay: .8s; } +.ss-barslot.shut:has(.indet) { transition-delay: .2s; } +/* A row status that is under way: an ink dot, no spinner. */ +.ss-st.on { font-weight: 600; } +.ss-st.on::before { background: var(--ink); } .ss-r.dim .nm { color: var(--ink-3); } .ss-r.updating { background: var(--sunken); } -.ss-rowbar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; overflow: hidden; } -.ss-rowbar::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 30%; background: var(--ink); animation: ss-indet 1s ease-in-out infinite; } +/* Text of something under way: a light sweeps across it, in step with the bar's runner. */ +.ss-shimmer { background: linear-gradient(90deg, var(--ink-2) 0 40%, var(--ink) 50%, var(--ink-2) 60% 100%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: ss-shimmer 1.8s linear infinite; } .ss-r.flash { animation: ss-flash 1.1s ease-out; } .ss-pop { animation: ss-pop .32s cubic-bezier(.22,.9,.24,1); } -@keyframes ss-indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } } +/* DrawnCheck.tsx: the check that ends a run draws itself once. */ +.ss-draw path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: ss-draw .32s cubic-bezier(.23,1,.32,1) .12s forwards; } +@keyframes ss-draw { to { stroke-dashoffset: 0; } } +@keyframes ss-indet { from { transform: translateX(-100%); } to { transform: translateX(340%); } } +@keyframes ss-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } } +@keyframes ss-breathe { 0%, 100% { opacity: .08; } 50% { opacity: .24; } } @keyframes ss-flash { from { background: var(--ok-bg); } to { background: transparent; } } @keyframes ss-pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } } /* Collapse a block to nothing: wrap it in .ss-collapse and add .shut */ @@ -316,8 +340,14 @@ svg.lucide { flex: none; stroke-width: var(--isw); } .ss-note.ok>svg { color: var(--ok); } .ss-note.live { position: relative; overflow: hidden; transition: background .45s; } @media (prefers-reduced-motion: reduce) { - .ss-bar.indet>span, .ss-rowbar::after, .ss-r.flash, .ss-pop { animation: none; } - .ss-bar>span, .ss-prog i, .ss-collapse, .ss-collapse .ss-r, .ss-note.live { transition: none; } + .ss-r.flash, .ss-pop { animation: none; } + .ss-shimmer { background: none; color: var(--ink); animation: none; } + /* Nothing travels: the track breathes instead, and the fill steps. */ + .ss-bar:not(.end)::before { width: 100%; animation: ss-breathe 1.4s ease-in-out infinite; } + .ss-draw path { stroke-dashoffset: 0; animation: none; } + /* The slot keeps its delay, so the finished bar is still seen before it goes. */ + .ss-barslot { transition-duration: 0s; } + .ss-bar>i, .ss-prog i, .ss-collapse, .ss-collapse .ss-r, .ss-note.live { transition: none; } } .ss-note { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); font-size: 13px; line-height: 1.5; } :root[data-theme="playful"] .ss-note { border: 2px solid var(--line); border-radius: 12px; } diff --git a/ui/src/components/ConfigInstallPanel.tsx b/ui/src/components/ConfigInstallPanel.tsx index f727c342c..fb1eaf3e7 100644 --- a/ui/src/components/ConfigInstallPanel.tsx +++ b/ui/src/components/ConfigInstallPanel.tsx @@ -1,6 +1,7 @@ import type { CSSProperties, ReactNode } from 'react'; -import { Check, CircleAlert, Download, FolderDown, GitBranch, Loader2, Puzzle, X } from 'lucide-react'; +import { Check, CircleAlert, Download, FolderDown, GitBranch, Puzzle, X } from 'lucide-react'; import Button from './Button'; +import ProgressBar from './ProgressBar'; import { parseRemoteURL } from '../lib/parseRemoteURL'; import { plural, useT } from '../i18n'; import { useInstallFromConfig } from '../hooks/useInstallFromConfig'; @@ -20,7 +21,7 @@ export default function ConfigInstallPanel() { let sub = t('install.fromConfig.hint', { items: contents }); let action: ReactNode = ; if (phase === 'running') { - icon = ; + icon = ; title = t('install.fromConfig.installing', { file }); sub = t('install.audited'); action = null; @@ -49,7 +50,7 @@ export default function ConfigInstallPanel() { {action} - {phase === 'running' &&
} +
{entries.map((e, i) => { @@ -64,12 +65,10 @@ export default function ConfigInstallPanel() { {e.tracked && tracked} {parseRemoteURL(e.source)?.ownerRepo ?? e.source} - {phase === 'running' && } {done && (bad ? : )} - {phase === 'running' && }
); })} diff --git a/ui/src/components/DrawnCheck.tsx b/ui/src/components/DrawnCheck.tsx new file mode 100644 index 000000000..f9680ab62 --- /dev/null +++ b/ui/src/components/DrawnCheck.tsx @@ -0,0 +1,8 @@ +/** The check that ends a run: drawn once, short arm first. Lucide's path runs the other way. */ +export default function DrawnCheck({ size = 20 }: { size?: number }) { + return ( + + ); +} diff --git a/ui/src/components/ProgressBar.tsx b/ui/src/components/ProgressBar.tsx new file mode 100644 index 000000000..ba205812a --- /dev/null +++ b/ui/src/components/ProgressBar.tsx @@ -0,0 +1,33 @@ +import { useState } from 'react'; + +/** + * Progress of a job on its status card. A faint runner shows work is going on even before the + * first item finishes; without a `value` the runner is all there is. When the job ends the fill + * is given time to arrive, then the bar fades and its slot closes, so it never needs unmounting. + * `className` sets `--bar-gap` to the parent's gap, which the closed slot then takes back. + */ +export default function ProgressBar({ active, value, max = 100, label, className = '' }: { + active: boolean; value?: number; max?: number; label?: string; className?: string; +}) { + // A new run gets a new bar, so its fill starts empty instead of sliding back from the last run. + const [run, setRun] = useState(0); + const [was, setWas] = useState(active); + if (was !== active) { + setWas(active); + if (active) setRun(run + 1); + } + // What kind of bar it was is kept while it leaves; a caller often drops `value` in the same render. + const [counted, setCounted] = useState(value !== undefined); + if (active && counted !== (value !== undefined)) setCounted(value !== undefined); + const part = counted && max > 0 ? Math.min(Math.max((value ?? 0) / max, 0), 1) : 0; + return ( + + + + {counted && } + + + + ); +} diff --git a/ui/src/components/plugins/PluginUpdateDialog.tsx b/ui/src/components/plugins/PluginUpdateDialog.tsx index b9d1854d5..b47717583 100644 --- a/ui/src/components/plugins/PluginUpdateDialog.tsx +++ b/ui/src/components/plugins/PluginUpdateDialog.tsx @@ -1,12 +1,14 @@ import { useState } from 'react'; -import { Check, CircleAlert, CircleArrowUp, Loader2, Package, X } from 'lucide-react'; +import { Check, CircleAlert, CircleArrowUp, Package, X } from 'lucide-react'; import { targetMap } from '../../api/plugins'; import type { PluginInventory, PluginPlan, PluginTarget } from '../../api/plugins'; import AgentIcon from '../AgentIcon'; import Button from '../Button'; import { Checkbox } from '../Checkbox'; import DialogShell from '../DialogShell'; +import DrawnCheck from '../DrawnCheck'; import IconButton from '../IconButton'; +import ProgressBar from '../ProgressBar'; import { plural, useT } from '../../i18n'; import { keyedMessage } from './outcomeText'; import { Toggle, VersionChange } from './PluginList'; @@ -176,7 +178,7 @@ function Running({ batch, busy, inventory, label, onRetry, onStop, onClose }: { const settled = batch.filter((i) => i.status !== 'waiting' && i.status !== 'running').length; const current = batch.find((i) => i.status === 'running'); const status = (item: BatchItem) => { - if (item.status === 'running') return {t('plugins.updateDialog.updating')}; + if (item.status === 'running') return {t('plugins.updateDialog.updating')}; if (item.status === 'waiting') return {t('plugins.updateDialog.waiting')}; if (item.status === 'done') return {t('plugins.updateDialog.done')}; if (item.status === 'skipped') return {t('plugins.outcome.skipped')}; @@ -185,15 +187,13 @@ function Running({ batch, busy, inventory, label, onRetry, onStop, onClose }: { return ( <> {busy - ? } busy={busy} onClose={onClose} sub={t('plugins.updateDialog.runningHelp')} + ? } busy={busy} onClose={onClose} sub={t('plugins.updateDialog.runningHelp')} title={<>{t('plugins.updateDialog.running', { done: Math.min(settled + 1, batch.length), total: batch.length })}{current && {current.name}}} /> : failed > 0 ? } tone="warn" busy={busy} onClose={onClose} title={t('plugins.updateDialog.doneFailed', { updated: done, failed })} sub={t('plugins.updateDialog.doneHelp')} /> - : } tone="ok" busy={busy} onClose={onClose} title={t(plural('plugins.updateDialog.updated', done), { count: done })} sub={t('plugins.updateDialog.doneHelp')} />} + : } tone="ok" busy={busy} onClose={onClose} title={t(plural('plugins.updateDialog.updated', done), { count: done })} sub={t('plugins.updateDialog.doneHelp')} />}
-
- -
+
{batch.map((item) => { // A row no check showed keeps the version it has. @@ -213,7 +213,6 @@ function Running({ batch, busy, inventory, label, onRetry, onStop, onClose }: { {status(item)} {(item.status === 'failed' || item.status === 'skipped') && !item.stale && !busy && } - {item.status === 'running' && }
); })} diff --git a/ui/src/pages/BackupPage.tsx b/ui/src/pages/BackupPage.tsx index 7f204ae2c..0dad00e60 100644 --- a/ui/src/pages/BackupPage.tsx +++ b/ui/src/pages/BackupPage.tsx @@ -11,6 +11,7 @@ import ConfirmDialog from '../components/ConfirmDialog'; import DialogShell from '../components/DialogShell'; import EmptyState from '../components/EmptyState'; import PageHeader from '../components/PageHeader'; +import ProgressBar from '../components/ProgressBar'; import { Select } from '../components/Select'; import Skeleton from '../components/Skeleton'; import Spinner from '../components/Spinner'; @@ -173,7 +174,7 @@ function FolderBackups({ creating }: { creating: boolean }) {
{t('backup.creating')} - +
)} diff --git a/ui/src/pages/DoctorPage.tsx b/ui/src/pages/DoctorPage.tsx index 6f0c43db4..b3d83b5a6 100644 --- a/ui/src/pages/DoctorPage.tsx +++ b/ui/src/pages/DoctorPage.tsx @@ -1,7 +1,7 @@ import { useMemo, useState } from 'react'; import { Link } from 'react-router-dom'; import { useQuery, useQueryClient } from '@tanstack/react-query'; -import { AlertTriangle, ArrowUpCircle, CheckCircle2, ChevronDown, ChevronRight, Info, Loader2, Pencil, RefreshCw, XCircle } from 'lucide-react'; +import { AlertTriangle, ArrowUpCircle, CheckCircle2, ChevronDown, ChevronRight, CircleDashed, Info, Pencil, RefreshCw, XCircle } from 'lucide-react'; import { api, type DoctorCheck } from '../api/client'; import Button from '../components/Button'; import CopyButton from '../components/CopyButton'; @@ -22,8 +22,8 @@ import { doctorFromChecks, doctorWithUpdatePolicy, withStreamedCheck } from '../ type Filter = 'all' | 'error' | 'warning' | 'pass'; const FILTERS: Filter[] = ['all', 'error', 'warning', 'pass']; -const ICON = { pass: CheckCircle2, warning: AlertTriangle, error: XCircle, info: Info, pending: Loader2 } as const; -const TONE = { pass: 'text-ok', warning: 'text-warn', error: 'text-bad', info: 'text-accent', pending: 'animate-spin text-ink-3' } as const; +const ICON = { pass: CheckCircle2, warning: AlertTriangle, error: XCircle, info: Info, pending: CircleDashed } as const; +const TONE = { pass: 'text-ok', warning: 'text-warn', error: 'text-bad', info: 'text-accent', pending: 'text-ink-3' } as const; /** Check names come from the CLI; a missing translation still reads as a phrase. */ const checkLabel = (name: string) => name.replace(/_/g, ' ').replace(/^./, (c) => c.toUpperCase()); diff --git a/ui/src/pages/UpdatePage.tsx b/ui/src/pages/UpdatePage.tsx index 6e435e9c4..3f69941d7 100644 --- a/ui/src/pages/UpdatePage.tsx +++ b/ui/src/pages/UpdatePage.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import type { CSSProperties, ReactNode } from 'react'; import { useQuery, useQueryClient } from '@tanstack/react-query'; -import { Bot, Check, CircleAlert, CircleArrowUp, CircleCheck, Download, FolderX, GitBranch, Link, Loader2, Puzzle, RefreshCw, ShieldAlert, Trash2, X } from 'lucide-react'; +import { Bot, Check, CircleAlert, CircleArrowUp, CircleCheck, Download, FolderX, GitBranch, Link, Puzzle, RefreshCw, ShieldAlert, Trash2, X } from 'lucide-react'; import { Link as RouterLink } from 'react-router-dom'; import { resourceHref } from '../lib/resourceNames'; import { api } from '../api/client'; @@ -13,6 +13,8 @@ import { folderOf, formatTrackedRepoName } from '../lib/resourceNames'; import { repoOf } from '../lib/resourceGrouping'; import { formatRelativeTime, plural, useI18n, useT } from '../i18n'; import Button from '../components/Button'; +import DrawnCheck from '../components/DrawnCheck'; +import ProgressBar from '../components/ProgressBar'; import { Checkbox } from '../components/Checkbox'; import EmptyState from '../components/EmptyState'; import SyncPreviewModal from '../components/SyncPreviewModal'; @@ -434,7 +436,7 @@ export default function UpdatePage({ kind }: { kind: Kind }) { const c = unitCheck(statuses, unit); switch (c.status) { case 'checking': - return {t('update.check.checking')}; + return {t('update.check.checking')}; case 'behind': return {c.behind ? t('update.check.behind', { count: c.behind }) : t('update.check.behindFallback')}; case 'update-available': @@ -465,7 +467,7 @@ export default function UpdatePage({ kind }: { kind: Kind }) { case 'pending': return {t('update.status.pending')}; case 'in-progress': - return {r.message ?? t('update.status.updating')}; + return {r.message ?? t('update.status.updating')}; case 'success': return {t('update.status.updated')}; case 'up-to-date': @@ -515,10 +517,10 @@ export default function UpdatePage({ kind }: { kind: Kind }) { let hero: { icon: ReactNode; tone: string; title: ReactNode; sub: ReactNode }; if (checking) { - hero = { icon: , tone: '', title: t('update.tab.checking'), sub: t('update.tab.audited') }; + hero = { icon: , tone: '', title: t('update.tab.checking'), sub: t('update.tab.audited') }; } else if (running) { hero = { - icon: , + icon: , tone: '', title: <>{t('update.hero.running', { current: Math.min(runDone + 1, run.size), total: run.size })}{current && {current.label}}, sub: tallyText || t('update.tab.audited'), @@ -526,7 +528,7 @@ export default function UpdatePage({ kind }: { kind: Kind }) { } else if (showDone) { const troubled = tally.blocked + tally.error > 0; hero = { - icon: troubled ? : , + icon: troubled ? : , tone: troubled ? 'warn' : 'ok', title: <>{t('update.done.subtitle')} {tallyText}, sub: !checkSync || diff.isError ? t('update.tab.audited') @@ -583,11 +585,7 @@ export default function UpdatePage({ kind }: { kind: Kind }) {
)} - {busy && ( -
- -
- )} + )} @@ -597,12 +595,12 @@ export default function UpdatePage({ kind }: { kind: Kind }) { return (
- {missing.phase === 'running' ? + {missing.phase === 'running' ? : done ? (failed ? : ) : }
{missing.phase === 'running' ? ( - <>{t('install.fromConfig.installing', { file: missing.file })} {t('install.audited')} + <>{t('install.fromConfig.installing', { file: missing.file })} {t('install.audited')} ) : done ? ( <>{summary}. {t(failed ? 'install.fromConfig.failedHint' : 'install.fromConfig.syncHint', { file: missing.file })} ) : ( @@ -618,7 +616,6 @@ export default function UpdatePage({ kind }: { kind: Kind }) { {t(done ? 'install.preview.retry' : 'update.missingEntries.install')} )} - {missing.phase === 'running' && }
); @@ -652,7 +649,7 @@ export default function UpdatePage({ kind }: { kind: Kind }) { {unitName(unit)}
{p ? ( - {t('update.updating.purging')} + {t('update.updating.purging')} ) : ( <> {t('update.check.stale')} @@ -660,7 +657,6 @@ export default function UpdatePage({ kind }: { kind: Kind }) { )}
- {p && }
); @@ -780,7 +776,6 @@ export default function UpdatePage({ kind }: { kind: Kind }) { )} {statusCell(unit)} - {rowState === 'updating' && } ); })}