diff --git a/ui/src/components/OperationPanel.jsx b/ui/src/components/OperationPanel.jsx index c17d057..846879f 100644 --- a/ui/src/components/OperationPanel.jsx +++ b/ui/src/components/OperationPanel.jsx @@ -483,6 +483,21 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se return { ...prev, [key]: { field, raw: cur ? raw : '' } } }) + // A running total across the walk, in the primary measure. The lines sum to + // Adjustable, and without this you are adding eight-digit numbers in your + // head to check that they do. + // + // Value only: a cumulative price is meaningless -- prices do not add -- and a + // second running column for units doubles the width to say something the + // value column already implies. + const runningByKey = (() => { + const out = new Map() + let acc = 0 + for (const e of lines) { acc += e.value || 0; out.set(e.key, acc) } + return out + })() + const showRunning = !!valueCol && lines.length > 1 + const numCell = 'text-right font-mono tabular-nums whitespace-nowrap px-2' const rule =
@@ -498,6 +513,11 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se {m.hint && · {m.hint}} ))} + {showRunning && ( + + running + + )} @@ -521,7 +541,7 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se ))} {exclLines.length > 0 && ( - {rule}{measures.map(m =>
)} + {rule}{measures.map(m =>
)}{showRunning &&
} )} {/* the walk from baseline to current, by initiative */} @@ -537,10 +557,13 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se {m.key === 'price' ? fmtNum(priceOf(e), m.dp) : fmtNum(e[m.key], m.dp)} ))} + {showRunning && ( + {fmtNum(runningByKey.get(e.key), 0)} + )} ))} - {rule}{measures.map(m =>
)} + {rule}{measures.map(m =>
)}{showRunning &&
} @@ -549,6 +572,9 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se {measures.map(m => ( {fmtNum(m.current, m.dp)} ))} + {showRunning && ( + {fmtNum(total.value, 0)} + )} @@ -571,14 +597,14 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se silently below. */} {nothingToAdjust && ( - + Nothing in this selection can be adjusted — all of it is {exclName}, loaded as {(currentTotals?.excludedIters || []).join(' / ') || 'reference'}. )} - {rule}{measures.map(m =>
)} + {rule}{measures.map(m =>
)}{showRunning &&
} {/* the edit — three equivalent ways to say the same thing */} {FIELDS.map(([field, label]) => ( @@ -605,7 +631,7 @@ function ScaleLedger({ currentTotals, scaleInputs, setScaleInputs, scalePlug, se {outcome && ( <> - {rule}{measures.map(m =>
)} + {rule}{measures.map(m =>
)}{showRunning &&
} Result {measures.map(m => (