From e841997399ddc97663c0bb9eaf58fbaaa044378e Mon Sep 17 00:00:00 2001 From: Jos Vooges | STH Date: Tue, 8 Sep 2026 02:05:33 +0200 Subject: [PATCH] Show download speed in MB/s instead of Mbps. Co-authored-by: Cursor --- apps/admin-ui/src/app/downloads/page.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/admin-ui/src/app/downloads/page.tsx b/apps/admin-ui/src/app/downloads/page.tsx index 74cf83f..74f0ada 100644 --- a/apps/admin-ui/src/app/downloads/page.tsx +++ b/apps/admin-ui/src/app/downloads/page.tsx @@ -86,13 +86,15 @@ function targetLabel(t?: string): string { return TARGET_OPTIONS.find((o) => o.id === t)?.label || t || "4K"; } -function formatMbps(bps: number | null | undefined): string { +function formatSpeed(bps: number | null | undefined): string { if (bps == null || bps < 0) return "—"; - if (bps === 0) return "0 Mbps"; - const mbps = (bps * 8) / 1_000_000; - if (mbps >= 10) return `${mbps.toFixed(0)} Mbps`; - if (mbps >= 1) return `${mbps.toFixed(1)} Mbps`; - return `${(mbps * 1000).toFixed(0)} Kbps`; + if (bps === 0) return "0 MB/s"; + const mbs = bps / 1_000_000; + if (mbs >= 10) return `${mbs.toFixed(1)} MB/s`; + if (mbs >= 1) return `${mbs.toFixed(2)} MB/s`; + const kbs = bps / 1000; + if (kbs >= 1) return `${kbs.toFixed(0)} KB/s`; + return `${bps.toFixed(0)} B/s`; } function progressLabel(job: JobRow): string { @@ -102,7 +104,7 @@ function progressLabel(job: JobRow): string { if (!p) return "…"; const parts: string[] = []; if (p.percent != null) parts.push(`${p.percent % 1 === 0 ? p.percent.toFixed(0) : p.percent.toFixed(1)}%`); - parts.push(formatMbps(p.speedBps)); + parts.push(formatSpeed(p.speedBps)); return parts.join(" · "); }