Move viewer status into metrics area

This commit is contained in:
Meta Vens 2026-04-24 16:21:40 +01:00
commit f9082979f6
4 changed files with 45 additions and 101 deletions

View file

@ -94,7 +94,6 @@ const statusText = byId<HTMLParagraphElement>("statusText");
const inferenceSummary = byId<HTMLDivElement>("inferenceSummary");
const candidateList = byId<HTMLDivElement>("candidateList");
const eventLog = byId<HTMLDivElement>("eventLog");
const viewerTitle = byId<HTMLHeadingElement>("viewerTitle");
const stepSlider = byId<HTMLInputElement>("stepSlider");
const stepValue = byId<HTMLSpanElement>("stepValue");
const lossCanvas = byId<HTMLCanvasElement>("lossCanvas");
@ -158,7 +157,7 @@ const state: AppState = {
file: null,
jobId: null,
status: "idle",
statusText: "Drop a fake sprite in here and let the machine explain itself for once.",
statusText: "Waiting for input.",
inputPreviewImage: null,
sourceImage: null,
preprocessedImage: null,
@ -431,9 +430,8 @@ function renderInference(): void {
function renderMetrics(): void {
metricsPanel.innerHTML = "";
const frame = getSelectedFrame();
const items: Array<[string, string]> = [];
const items: Array<[string, string]> = [["Stage", state.currentStage]];
if (frame) {
items.push(["Frame", `${frame.step}/${frame.totalSteps}`]);
items.push(["Loss", frame.loss === null ? "n/a" : formatNumber(frame.loss, 4)]);
for (const [key, value] of Object.entries(frame.terms)) {
items.push([key.replaceAll("_", " "), formatNumber(value, 4)]);
@ -445,8 +443,6 @@ function renderMetrics(): void {
formatNumber(readNestedNumber(state.runSummary, ["source_fidelity", "final_output", "score"])),
]);
items.push(["Source color ratio", formatNumber(readNestedNumber(state.runSummary, ["output_colors_from_source_ratio"]))]);
} else {
items.push(["Status", state.currentStage]);
}
for (const [label, value] of items) {
const node = document.createElement("div");
@ -485,7 +481,6 @@ async function renderViewer(): Promise<void> {
let leftLabel = "Source";
let middleLabel = "Edge Scout";
let rightLabel = "Output";
let title = state.currentStage;
if (state.latticeImage) {
leftAsset = state.latticeImage;
@ -502,16 +497,13 @@ async function renderViewer(): Promise<void> {
leftLabel = "Sampling Overlay";
middleLabel = "Displacement";
rightLabel = "Current Output";
title = frame.step === 0 ? "Initial nearest-sample placement" : `Solver step ${frame.step} / ${frame.totalSteps}`;
} else if (state.cleanupImage) {
middleAsset = state.heatmapImage ?? middleAsset;
middleLabel = "Cleanup Heatmap";
rightAsset = state.cleanupImage;
rightLabel = "Cleaned Output";
title = state.finalOutputImage ? "Finalized output" : "Cleanup pass";
}
viewerTitle.textContent = title;
leftVizLabel.textContent = leftLabel;
middleVizLabel.textContent = middleLabel;
rightVizLabel.textContent = rightLabel;

View file

@ -17,7 +17,6 @@ const statusText = byId("statusText");
const inferenceSummary = byId("inferenceSummary");
const candidateList = byId("candidateList");
const eventLog = byId("eventLog");
const viewerTitle = byId("viewerTitle");
const stepSlider = byId("stepSlider");
const stepValue = byId("stepValue");
const lossCanvas = byId("lossCanvas");
@ -77,7 +76,7 @@ const state = {
file: null,
jobId: null,
status: "idle",
statusText: "Drop a fake sprite in here and let the machine explain itself for once.",
statusText: "Waiting for input.",
inputPreviewImage: null,
sourceImage: null,
preprocessedImage: null,
@ -330,9 +329,8 @@ function renderInference() {
function renderMetrics() {
metricsPanel.innerHTML = "";
const frame = getSelectedFrame();
const items = [];
const items = [["Stage", state.currentStage]];
if (frame) {
items.push(["Frame", `${frame.step}/${frame.totalSteps}`]);
items.push(["Loss", frame.loss === null ? "n/a" : formatNumber(frame.loss, 4)]);
for (const [key, value] of Object.entries(frame.terms)) {
items.push([key.replaceAll("_", " "), formatNumber(value, 4)]);
@ -346,9 +344,6 @@ function renderMetrics() {
]);
items.push(["Source color ratio", formatNumber(readNestedNumber(state.runSummary, ["output_colors_from_source_ratio"]))]);
}
else {
items.push(["Status", state.currentStage]);
}
for (const [label, value] of items) {
const node = document.createElement("div");
node.className = "metric-chip";
@ -384,7 +379,6 @@ async function renderViewer() {
let leftLabel = "Source";
let middleLabel = "Edge Scout";
let rightLabel = "Output";
let title = state.currentStage;
if (state.latticeImage) {
leftAsset = state.latticeImage;
leftLabel = "Lattice Prep";
@ -400,16 +394,13 @@ async function renderViewer() {
leftLabel = "Sampling Overlay";
middleLabel = "Displacement";
rightLabel = "Current Output";
title = frame.step === 0 ? "Initial nearest-sample placement" : `Solver step ${frame.step} / ${frame.totalSteps}`;
}
else if (state.cleanupImage) {
middleAsset = state.heatmapImage ?? middleAsset;
middleLabel = "Cleanup Heatmap";
rightAsset = state.cleanupImage;
rightLabel = "Cleaned Output";
title = state.finalOutputImage ? "Finalized output" : "Cleanup pass";
}
viewerTitle.textContent = title;
leftVizLabel.textContent = leftLabel;
middleVizLabel.textContent = middleLabel;
rightVizLabel.textContent = rightLabel;

View file

@ -127,24 +127,8 @@
<main class="workspace page-content">
<section class="hero viewer-panel">
<div class="card-head viewer-head">
<div class="viewer-head-summary">
<div class="copy-stack card-copy viewer-title-block">
<p class="eyebrow">Algorithm View</p>
<h2 id="viewerTitle">Pipeline Stages</h2>
</div>
<div class="viewer-status-panel">
<span class="viewer-status-label">Instrument Panel</span>
<div class="viewer-status-row">
<strong id="statusBadge" class="status-badge">Idle</strong>
</div>
<p id="statusText" class="status-text">Drop a fake sprite in here and let the machine explain itself for once.</p>
<p class="muted viewer-status-note">Watch inference, edge scouting, field prep, solver drift, cleanup, then patch any stubborn pixels yourself.</p>
</div>
</div>
<div class="scrubber">
<label for="stepSlider">Solver Step</label>
<input id="stepSlider" type="range" min="0" max="0" step="1" value="0" disabled />
<span id="stepValue" class="step-value">No frames yet</span>
<div class="copy-stack card-copy viewer-heading">
<h2 id="viewerTitle">Pipeline Stages</h2>
</div>
</div>
<canvas id="lossCanvas" class="loss-canvas" width="800" height="120"></canvas>
@ -162,7 +146,20 @@
<canvas id="rightCanvas"></canvas>
</figure>
</div>
<div id="metricsPanel" class="metrics-panel stats-grid"></div>
<div class="viewer-metrics">
<div class="metrics-toolbar">
<div class="metrics-status">
<strong id="statusBadge" class="status-badge">Idle</strong>
<p id="statusText" class="status-text metrics-status-text">Waiting for input.</p>
</div>
<div class="scrubber">
<label for="stepSlider">Solver Step</label>
<input id="stepSlider" type="range" min="0" max="0" step="1" value="0" disabled />
<span id="stepValue" class="step-value">No frames yet</span>
</div>
</div>
<div id="metricsPanel" class="metrics-panel stats-grid"></div>
</div>
</section>
<section class="card editor-panel">

View file

@ -262,8 +262,9 @@ p {
.brand,
.brand-lockup,
.copy-stack,
.viewer-head-summary,
.viewer-status-panel {
.viewer-heading,
.viewer-metrics,
.metrics-status {
display: grid;
gap: 10px;
}
@ -532,54 +533,35 @@ p {
}
.viewer-head {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
gap: 18px 24px;
align-items: start;
}
.viewer-head-summary {
display: grid;
grid-template-columns: minmax(220px, 260px) minmax(320px, 1fr);
gap: 18px 24px;
min-width: 0;
align-items: start;
}
.viewer-title-block {
align-content: start;
display: flex;
justify-content: space-between;
align-items: flex-end;
gap: 12px;
}
.viewer-status-panel {
align-content: start;
gap: 8px;
.viewer-heading {
min-width: 0;
padding-left: 20px;
border-left: 3px solid rgba(255, 216, 74, 0.22);
align-content: start;
}
.viewer-status-row {
display: flex;
align-items: center;
gap: 10px;
.viewer-metrics {
gap: 12px;
}
.viewer-status-label {
font-size: 0.74rem;
line-height: 1;
color: var(--ui-text-muted);
text-transform: uppercase;
.metrics-toolbar {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
gap: 16px 20px;
align-items: start;
}
.status-text {
max-width: 26ch;
.metrics-status {
min-width: 0;
align-content: start;
}
.viewer-status-note {
font-size: 1rem;
line-height: 1.12;
max-width: 34ch;
.metrics-status-text {
max-width: 42ch;
}
.scrubber {
@ -587,8 +569,6 @@ p {
display: grid;
gap: 10px;
align-content: start;
padding-left: 20px;
border-left: 3px solid rgba(255, 216, 74, 0.22);
}
.step-value {
@ -793,9 +773,8 @@ select:focus-visible {
}
@media (min-width: 1500px) {
.viewer-head-summary {
grid-template-columns: minmax(240px, auto) minmax(300px, 1fr);
align-items: start;
.metrics-toolbar {
grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
}
}
@ -805,16 +784,9 @@ select:focus-visible {
grid-template-columns: 1fr;
}
.viewer-head {
.metrics-toolbar {
grid-template-columns: 1fr;
}
.scrubber {
padding-left: 0;
padding-top: 14px;
border-left: 0;
border-top: 3px solid rgba(255, 216, 74, 0.22);
}
}
@media (max-width: 940px) {
@ -827,16 +799,8 @@ select:focus-visible {
flex-wrap: wrap;
}
.viewer-head-summary {
grid-template-columns: 1fr;
gap: 14px;
}
.viewer-status-panel {
padding-left: 0;
padding-top: 12px;
border-left: 0;
border-top: 3px solid rgba(255, 216, 74, 0.22);
.viewer-head {
align-items: flex-start;
}
.brand-lockup {