dashboard: move live indicator to TOC sidebar on all pages; add live-data docs

- All four pages (index, workstreams, decisions, progress) now inject the
  live indicator into #observablehq-toc via injectTocTop("live-indicator", el)
  Left-aligned (no text-align: right), position:relative + padding-right for
  the ? button affordance

- decisions.md: splits the former combined "decisions-sidebar" widget into two
  separate injectTocTop calls — KPI box first (ends lower), live indicator
  second (ends at top); both now have their own stable ids

- withDocHelp(_liveEl, "/docs/live-data") wires the ? button on every page

- src/docs/live-data.md: new documentation page explaining poll interval (15s),
  indicator colour semantics, offline recovery, and which endpoints each page hits

- Removes the .live-bar CSS class from all pages; replaces with .live-indicator

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 16:18:09 +01:00
parent 902aafcfb1
commit 816f1e25f1
5 changed files with 101 additions and 16 deletions

View File

@@ -151,16 +151,23 @@ const _kpiBox = html`<div class="kpi-infobox">
withDocHelp(_kpiBox, "/docs/decisions-kpi");
// ── Build sidebar widget: live indicator + KPI box ──────────────────────────
// ── Build live indicator ────────────────────────────────────────────────────
const _liveEl = html`<div class="live-indicator">
<span style="color:${_ok ? 'var(--theme-foreground-focus)' : 'red'}">●</span>
${_ok
? `Live · updated ${_ts?.toLocaleTimeString()}`
: html`<span style="color:red">Offline — run: <code>make api</code></span>`}
</div>`;
withDocHelp(_liveEl, "/docs/live-data");
const _tocInjected = injectTocTop("decisions-sidebar", html`<div>${_liveEl}${_kpiBox}</div>`);
if (!_tocInjected) display(html`<div style="float:right;width:215px;margin-left:1rem">${_liveEl}${_kpiBox}</div>`);
// ── Inject into TOC sidebar: KPI first (prepend → bottom), live last (→ top) ─
const _toc = document.querySelector("#observablehq-toc");
if (_toc) {
injectTocTop("decisions-kpi-box", _kpiBox);
injectTocTop("live-indicator", _liveEl);
} else {
display(html`<div style="float:right;width:215px;margin-left:1rem">${_liveEl}${_kpiBox}</div>`);
}
```
## Resolution History
@@ -357,8 +364,9 @@ if (escalated.length > 0) {
.live-indicator {
font-size: 0.8rem;
color: gray;
text-align: right;
margin-bottom: 0.75rem;
position: relative;
padding-right: 1.6rem;
}
/* ── KPI infobox ──────────────────────────────────────────────────────────── */