From 30896a31711b1f1c2a8a3c55154ed3cdb571e6f9 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 24 Apr 2026 16:28:16 +0100 Subject: [PATCH] Unify viewer metrics panel --- frontend/src/app.ts | 7 +++-- src/repixelizer/gui_static/app.js | 7 +++-- src/repixelizer/gui_static/index.html | 21 ++++++-------- src/repixelizer/gui_static/styles.css | 41 ++++++++------------------- 4 files changed, 31 insertions(+), 45 deletions(-) diff --git a/frontend/src/app.ts b/frontend/src/app.ts index 4707314..7952b50 100644 --- a/frontend/src/app.ts +++ b/frontend/src/app.ts @@ -428,9 +428,11 @@ function renderInference(): void { } function renderMetrics(): void { - metricsPanel.innerHTML = ""; + metricsPanel.querySelectorAll("[data-dynamic='true']").forEach((node) => { + node.remove(); + }); const frame = getSelectedFrame(); - const items: Array<[string, string]> = [["Stage", state.currentStage]]; + const items: Array<[string, string]> = []; if (frame) { items.push(["Loss", frame.loss === null ? "n/a" : formatNumber(frame.loss, 4)]); for (const [key, value] of Object.entries(frame.terms)) { @@ -447,6 +449,7 @@ function renderMetrics(): void { for (const [label, value] of items) { const node = document.createElement("div"); node.className = "metric-chip"; + node.dataset.dynamic = "true"; node.innerHTML = `${label}${value}`; metricsPanel.appendChild(node); } diff --git a/src/repixelizer/gui_static/app.js b/src/repixelizer/gui_static/app.js index 7c9122e..0b6ef35 100644 --- a/src/repixelizer/gui_static/app.js +++ b/src/repixelizer/gui_static/app.js @@ -327,9 +327,11 @@ function renderInference() { } } function renderMetrics() { - metricsPanel.innerHTML = ""; + metricsPanel.querySelectorAll("[data-dynamic='true']").forEach((node) => { + node.remove(); + }); const frame = getSelectedFrame(); - const items = [["Stage", state.currentStage]]; + const items = []; if (frame) { items.push(["Loss", frame.loss === null ? "n/a" : formatNumber(frame.loss, 4)]); for (const [key, value] of Object.entries(frame.terms)) { @@ -347,6 +349,7 @@ function renderMetrics() { for (const [label, value] of items) { const node = document.createElement("div"); node.className = "metric-chip"; + node.dataset.dynamic = "true"; node.innerHTML = `${label}${value}`; metricsPanel.appendChild(node); } diff --git a/src/repixelizer/gui_static/index.html b/src/repixelizer/gui_static/index.html index d8e986c..ada11eb 100644 --- a/src/repixelizer/gui_static/index.html +++ b/src/repixelizer/gui_static/index.html @@ -146,19 +146,16 @@ -
-
-
- Idle -

Waiting for input.

-
-
- - - No frames yet -
+
+
+ Idle +

Waiting for input.

+
+
+ + + No frames yet
-
diff --git a/src/repixelizer/gui_static/styles.css b/src/repixelizer/gui_static/styles.css index 531a113..c64a007 100644 --- a/src/repixelizer/gui_static/styles.css +++ b/src/repixelizer/gui_static/styles.css @@ -262,9 +262,7 @@ p { .brand, .brand-lockup, .copy-stack, -.viewer-heading, -.viewer-metrics, -.metrics-status { +.viewer-heading { display: grid; gap: 10px; } @@ -544,22 +542,6 @@ p { align-content: start; } -.viewer-metrics { - gap: 12px; -} - -.metrics-toolbar { - display: grid; - grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); - gap: 16px 20px; - align-items: start; -} - -.metrics-status { - min-width: 0; - align-content: start; -} - .metrics-status-text { max-width: 42ch; } @@ -632,6 +614,17 @@ p { gap: 10px; } +.metric-status-block { + display: grid; + gap: 8px; + align-content: start; +} + +.metric-scrubber { + min-width: 0; + grid-column: 1 / -1; +} + .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } @@ -772,21 +765,11 @@ select:focus-visible { outline-offset: 2px; } -@media (min-width: 1500px) { - .metrics-toolbar { - grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); - } -} - @media (max-width: 1200px) { .app-grid, .editor-stage { grid-template-columns: 1fr; } - - .metrics-toolbar { - grid-template-columns: 1fr; - } } @media (max-width: 940px) {