feat(web): three-phase progress with live download % on The Floor

Replace the misleading 6-micro-step progress bar with three honest
phases (Searching -> Downloading -> Finishing). Downloading now shows
a live determinate percentage sourced from job.downloadProgress (Slice
A), with a "NN% · done/total tracks" caption when the track count is
known. Searching and Finishing stay indeterminate.

- status.ts: describeJob collapses to {label, kind}; drop step/totalSteps
  and the STAGES array.
- progress-bar.tsx: ProgressBar takes {kind, indeterminate?, percent?,
  caption?} instead of step/total/stageLabel.
- job-row.tsx: JobRow takes a `bar?: ReactNode` slot instead of
  step/total/indeterminate/stageLabel props.
- queue.tsx: builds the per-state bar + meta; downloading meta drops
  the track count (now shown in the bar). Retry button + error note
  from the retry feature preserved exactly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan
2026-07-13 23:29:33 +02:00
parent 9d5e1ff58a
commit 9561e6e196
5 changed files with 52 additions and 61 deletions
+9 -11
View File
@@ -1,19 +1,17 @@
import type { Kind } from "./status";
/** A thin ruled progress bar. `indeterminate` for open-ended stages (searching);
* otherwise a discrete step/total fill with a step readout. */
/** A thin ruled progress bar. `indeterminate` for open-ended phases (searching,
* finishing); otherwise a determinate fill to `percent` with a live readout. */
export function ProgressBar({
kind,
step,
total,
indeterminate,
stageLabel,
percent,
caption,
}: {
kind: Kind;
step: number;
total: number;
indeterminate?: boolean;
stageLabel?: string;
percent?: number;
caption?: string;
}) {
if (indeterminate) {
return (
@@ -21,17 +19,17 @@ export function ProgressBar({
<div className="bar indet">
<span />
</div>
<div className="pct muted">searching</div>
<div className="pct muted">{caption ?? "…"}</div>
</div>
);
}
const pct = total > 0 ? Math.round((step / total) * 100) : 0;
const pct = Math.min(100, Math.max(0, percent ?? 0));
return (
<div className="prog">
<div className="bar">
<span style={{ width: `${pct}%` }} />
</div>
<div className="pct">{stageLabel ? `${stageLabel} · step ${step} of ${total}` : `${step}/${total}`}</div>
<div className="pct">{caption ?? `${Math.round(percent ?? 0)}%`}</div>
</div>
);
}