money chart: drop the caveat caption and the history-start legend note
The operator removed all caveats from the finance chart. Gone: the money-caption element, the caveat/stale/errors caption rendering, the .legend 'history begins' suffix and the orphaned CSS. Chart, legend keys, series and toggles untouched; balance_history_start stays in the payload. Harness now asserts no caveat text renders in any mode.
This commit is contained in:
1 parent
02fdd9f51c
commit
2904a4c2f8
2 files changed
+18
-16
No files matched your search
+5
-14
@@ -307,13 +307,11 @@ PAGE_HTML = """<!DOCTYPE html>
|
|||||||
.chart-tip .tip-row { display: flex; justify-content: space-between; gap: 14px; }
|
.chart-tip .tip-row { display: flex; justify-content: space-between; gap: 14px; }
|
||||||
.chart-tip .tip-row span { color: var(--muted); }
|
.chart-tip .tip-row span { color: var(--muted); }
|
||||||
.chart-tip .tip-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
|
.chart-tip .tip-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
|
||||||
/* Money chart: legend keys + the honest-data caption. The caption is a
|
/* Money chart: legend keys. No caption — charts carry no explanatory text
|
||||||
deliberate exception to the no-caption rule for the Trends charts: the
|
under them (the chart rule). */
|
||||||
operator asked for the data-history limits to be stated IN this chart. */
|
|
||||||
.money-legend { display: inline-flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
|
.money-legend { display: inline-flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
|
||||||
.money-legend .key { display: inline-flex; align-items: center; gap: 5px; }
|
.money-legend .key { display: inline-flex; align-items: center; gap: 5px; }
|
||||||
.money-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
|
.money-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
|
||||||
.money-caption { color: var(--muted); font-size: 11px; margin: 8px 0 0; }
|
|
||||||
@media (max-width: 600px) { .trend-controls { gap: 10px; } .trend-card { padding: 12px 10px; } }
|
@media (max-width: 600px) { .trend-controls { gap: 10px; } .trend-card { padding: 12px 10px; } }
|
||||||
.num { font-variant-numeric: tabular-nums; }
|
.num { font-variant-numeric: tabular-nums; }
|
||||||
.remaining-col { font-weight: 700; color: var(--green-deep); background: #eaf3ea; }
|
.remaining-col { font-weight: 700; color: var(--green-deep); background: #eaf3ea; }
|
||||||
@@ -445,7 +443,6 @@ PAGE_HTML = """<!DOCTYPE html>
|
|||||||
<span id="money-legend" class="money-legend"></span>
|
<span id="money-legend" class="money-legend"></span>
|
||||||
</div>
|
</div>
|
||||||
<div id="money-body" class="trend-body"><p class="trend-empty">Loading</p></div>
|
<div id="money-body" class="trend-body"><p class="trend-empty">Loading</p></div>
|
||||||
<p class="money-caption" id="money-caption"></p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -812,7 +809,8 @@ function renderTrends() {
|
|||||||
// One fetch at full range; the period and spend-mode toggles re-render
|
// One fetch at full range; the period and spend-mode toggles re-render
|
||||||
// client-side. The balance series exists only from the daily-snapshot
|
// client-side. The balance series exists only from the daily-snapshot
|
||||||
// deployment date onward (the OC API exposes just the CURRENT balance), so
|
// deployment date onward (the OC API exposes just the CURRENT balance), so
|
||||||
// it renders as a gap before that and the caption says so — never a zero.
|
// it renders as a gap before that — never a zero. No caption under the chart:
|
||||||
|
// the data explains itself (the operator dropped the balance-history caveat).
|
||||||
let moneyData = null;
|
let moneyData = null;
|
||||||
let moneyLoaded = false;
|
let moneyLoaded = false;
|
||||||
let moneyPeriod = 90; // 0 = all time
|
let moneyPeriod = 90; // 0 = all time
|
||||||
@@ -898,12 +896,6 @@ function renderMoney() {
|
|||||||
const host = $("money-body");
|
const host = $("money-body");
|
||||||
if (!host || !moneyData) return;
|
if (!host || !moneyData) return;
|
||||||
hideChartTip();
|
hideChartTip();
|
||||||
// The honest-limits caption, required by the operator: the payload carries
|
|
||||||
// the balance-history caveat and any per-source failures.
|
|
||||||
let cap = moneyData.caveat || "";
|
|
||||||
if (moneyData.stale) cap = "(cached — last refresh failed) " + cap;
|
|
||||||
if (moneyData.errors && moneyData.errors.length) cap += " Series unavailable: " + moneyData.errors.join("; ") + ".";
|
|
||||||
$("money-caption").textContent = cap;
|
|
||||||
renderMoneyLegend();
|
renderMoneyLegend();
|
||||||
const all = moneyData.series || [];
|
const all = moneyData.series || [];
|
||||||
const rows = moneyPeriod === 0 ? all : all.slice(-moneyPeriod);
|
const rows = moneyPeriod === 0 ? all : all.slice(-moneyPeriod);
|
||||||
@@ -918,8 +910,7 @@ function renderMoneyLegend() {
|
|||||||
{ c: MONEY_COLORS.spend, t: moneySpendMode === "daily" ? "Token spend — daily" : "Token spend — cumulative" }
|
{ c: MONEY_COLORS.spend, t: moneySpendMode === "daily" ? "Token spend — daily" : "Token spend — cumulative" }
|
||||||
];
|
];
|
||||||
if (moneySpendMode !== "daily") {
|
if (moneySpendMode !== "daily") {
|
||||||
const start = moneyData.balance_history_start;
|
items.push({ c: MONEY_COLORS.balance, t: "OC balance" });
|
||||||
items.push({ c: MONEY_COLORS.balance, t: "OC balance" + (start ? " — history begins " + start : "") });
|
|
||||||
}
|
}
|
||||||
$("money-legend").innerHTML = items.map(it =>
|
$("money-legend").innerHTML = items.map(it =>
|
||||||
'<span class="key"><span class="sw" style="background:' + it.c + '"></span>' + esc(it.t) + '</span>'
|
'<span class="key"><span class="sw" style="background:' + it.c + '"></span>' + esc(it.t) + '</span>'
|
||||||
|
|||||||
@@ -38,10 +38,19 @@ if (rects !== 0) throw new Error("cumulative mode must not draw bars, got " + re
|
|||||||
if (!count(/<circle cx="[^"]+" cy="[^"]+" r="3" fill="#a97a2a"/)) throw new Error("single balance point marker missing");
|
if (!count(/<circle cx="[^"]+" cy="[^"]+" r="3" fill="#a97a2a"/)) throw new Error("single balance point marker missing");
|
||||||
if (!count(/data-tip-host="money-body"/)) throw new Error("hover targets missing");
|
if (!count(/data-tip-host="money-body"/)) throw new Error("hover targets missing");
|
||||||
const legend = $("money-legend").innerHTML;
|
const legend = $("money-legend").innerHTML;
|
||||||
for (const frag of ["Revenue — OC contributions (cumulative)", "Token spend — cumulative", "OC balance — history begins 2026-11-08"]) {
|
for (const frag of ["Revenue — OC contributions (cumulative)", "Token spend — cumulative", "OC balance"]) {
|
||||||
if (!legend.includes(frag)) throw new Error("legend missing: " + frag);
|
if (!legend.includes(frag)) throw new Error("legend missing: " + frag);
|
||||||
}
|
}
|
||||||
if ($("money-caption").textContent !== moneyData.caveat) throw new Error("caption not the caveat");
|
|
||||||
|
// No caveat anywhere, in any rendering state — even though the fixture still
|
||||||
|
// carries the payload's caveat field, which the panel must ignore.
|
||||||
|
function assertNoCaveat() {
|
||||||
|
const rendered = $("money-body").innerHTML + " " + $("money-legend").innerHTML;
|
||||||
|
for (const bad of ["Balance history begins", "history begins", "Open Collective API exposes", "money-caption"]) {
|
||||||
|
if (rendered.includes(bad)) throw new Error("caveat/caption text rendered: " + bad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertNoCaveat();
|
||||||
|
|
||||||
// Axis: tick labels bottom-first — values ascend while their y descends; the
|
// Axis: tick labels bottom-first — values ascend while their y descends; the
|
||||||
// top tick must clear the data max. Date labels share text-anchor="end" with
|
// top tick must clear the data max. Date labels share text-anchor="end" with
|
||||||
@@ -78,6 +87,8 @@ const rects3 = (svg.match(/<rect /g) || []).length;
|
|||||||
if (rects3 !== 30) throw new Error("30-day slice: expected 30 bars, got " + rects3);
|
if (rects3 !== 30) throw new Error("30-day slice: expected 30 bars, got " + rects3);
|
||||||
setMoneyPeriod(90);
|
setMoneyPeriod(90);
|
||||||
setMoneySpendMode("cum");
|
setMoneySpendMode("cum");
|
||||||
|
renderMoney();
|
||||||
|
assertNoCaveat();
|
||||||
|
|
||||||
// --- balance-only deploy-day shape: one point renders as a marker, no crash ---
|
// --- balance-only deploy-day shape: one point renders as a marker, no crash ---
|
||||||
moneyData.series = [{ day: "2026-11-08", revenue_cum: null, spend_day: null, spend_cum: null, oc_balance: 1160.25 }];
|
moneyData.series = [{ day: "2026-11-08", revenue_cum: null, spend_day: null, spend_cum: null, oc_balance: 1160.25 }];
|
||||||
|
|||||||
Reference in new issue
Block a user