From 885cbaa89443c2c6568fcd0bbd5204786f1db385 Mon Sep 17 00:00:00 2001 From: xRangerDE Date: Mon, 11 May 2026 05:04:07 +0200 Subject: [PATCH] =?UTF-8?q?cleanup:=20stats=20size-bucket=20histogram=20?= =?UTF-8?q?=E2=80=94=20extract=20inline=20styles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Final piece of the renderer-stats.ts extraction. The recording-size distribution histogram (6 buckets: <100MB ... >10GB) was rendering each bucket-row as a 5-inline-style template — same shape as the top-streamers list (margin row, flex meta header, two spans, bar track, bar fill). Extracted to a .stats-bucket-* family in styles.css: - .stats-bucket-row + .stats-bucket-row:last-child margin trim - .stats-bucket-meta + .stats-bucket-meta-sub for the flex label/ count header - .stats-bucket-bar-track + .stats-bucket-bar-fill for the horizontal bar (with width-transition so the bar fills animate on data refresh) That completes the Statistik tab pass — 26 inline styles -> 22 CSS class assignments + 4 truly-dynamic width/height percent overrides for the bar fills. Tabular numerics, hover states, and data refresh animations all flow from the central stylesheet now. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/renderer-stats.ts | 12 ++++++------ src/styles.css | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/renderer-stats.ts b/src/renderer-stats.ts index b418d27..b80d7f9 100644 --- a/src/renderer-stats.ts +++ b/src/renderer-stats.ts @@ -143,20 +143,20 @@ function renderStatsSizeBuckets(buckets: ArchiveStatsBucket[]): void { const maxCount = buckets.reduce((m, b) => Math.max(m, b.count), 0); if (maxCount === 0) { - applyHtml(container, `
${escapeStatsHtml(UI_TEXT.static.statsEmpty)}
`); + applyHtml(container, `
${escapeStatsHtml(UI_TEXT.static.statsEmpty)}
`); return; } applyHtml(container, buckets.map((b) => { const pct = b.count > 0 ? Math.max(2, Math.round((b.count / maxCount) * 100)) : 0; return ` -
-
+
+
${escapeStatsHtml(b.label)} - ${b.count} · ${formatBytesForStats(b.bytes)} + ${b.count} · ${formatBytesForStats(b.bytes)}
-
-
+
+
`; diff --git a/src/styles.css b/src/styles.css index f9086b5..c6cd14c 100644 --- a/src/styles.css +++ b/src/styles.css @@ -2361,6 +2361,42 @@ select option { font-variant-numeric: tabular-nums; } +/* Recording-size distribution buckets — one row per size bucket, + count + total bytes on the right, horizontal bar below. */ +.stats-bucket-row { + margin-bottom: 8px; +} + +.stats-bucket-row:last-child { + margin-bottom: 0; +} + +.stats-bucket-meta { + display: flex; + justify-content: space-between; + font-size: 13px; + margin-bottom: 3px; + gap: 8px; +} + +.stats-bucket-meta-sub { + color: var(--text-secondary); + font-variant-numeric: tabular-nums; +} + +.stats-bucket-bar-track { + background: var(--bg-elevated); + border-radius: 3px; + height: 12px; + overflow: hidden; +} + +.stats-bucket-bar-fill { + height: 100%; + background: var(--accent, #9146ff); + transition: width 0.4s ease-out; +} + /* Old generic scrollbar rules were dead — superseded by the purple-themed *::-webkit-scrollbar block further down the file. Removed to avoid confusion when someone greps for scrollbar styles. */