Factory recreate mode; chunked uploads with progress everywhere

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Sonnet 5.5 committed 2026-11-18 13:49:16 +01:00
1 parent 771c6f5245
commit b309778be8
17 files changed
+477 -47

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
import { useT } from "../i18n";
import { closeUploadBatch, useUploads } from "../uploads";
import { Icon } from "./Icon";
import { formatSize } from "./FileFigure";
/** Progress of running uploads: one box per batch with a bar for the total and one per file. */
export function UploadPanel() {
const t = useT();
const batches = useUploads();
if (!batches.length) return null;
return (
<div className="uploads" role="status" aria-live="polite">
{batches.map((b) => {
const total = b.items.reduce((a, i) => a + i.size, 0);
const sent = b.items.reduce((a, i) => a + i.sent, 0);
const finished = b.items.filter((i) => i.status === "done" || i.status === "error").length;
const running = finished < b.items.length;
const pct = (a: number, z: number) => (z ? Math.min(100, Math.round((a / z) * 100)) : 100);
return (
<div key={b.id} className="upload-batch">
<div className="upload-head">
<strong>{running ? t("upload.running", { done: finished, n: b.items.length }) : t("upload.finished", { n: b.items.length })}</strong>
<span className="hint">
{formatSize(sent)} / {formatSize(total)}
</span>
<button className="small ghost" onClick={() => closeUploadBatch(b.id)} aria-label={t("common.close")}>
<Icon name="close" />
</button>
</div>
<div className="upload-bar total" title={`${pct(sent, total)} %`}>
<i style={{ width: `${pct(sent, total)}%` }} />
</div>
<div className="upload-files">
{b.items.map((i) => (
<div key={i.id} className={`upload-file ${i.status}`}>
<span className="name" title={i.name}>
{i.name}
</span>
<span className="hint">{i.status === "error" ? i.error : i.status === "wait" ? formatSize(i.size) : `${pct(i.sent, i.size)} %`}</span>
<div className="upload-bar">
<i style={{ width: `${pct(i.sent, i.size)}%` }} />
</div>
</div>
))}
</div>
</div>
);
})}
</div>
);
}