Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(pulse): expose the counter filters as pressed toggles and give the rail a real error state

nirholase8dfa6aa9243
diff --git a/pages/pulse.html b/pages/pulse.html
index c9bcf7e1e..3354453ed 100644
--- a/pages/pulse.html
+++ b/pages/pulse.html
@@ -49,7 +49,7 @@
<header><div id="nav-container"></div></header>
<script src="/nav.js"></script>
- <main class="px-shell">
+ <main class="px-shell" id="px-shell" data-state="loading">
<section class="px-hero">
<p class="px-kicker" data-i18n-html="pulse.live_money_layer"><span class="px-live-dot" aria-hidden="true"></span> Live money layer</p>
<h1 class="px-title" data-i18n-html="pulse.the_money_pulse">The <em>Money Pulse</em></h1>
@@ -67,32 +67,32 @@
</section>
<dl class="px-counters" id="px-counters">
- <div class="px-counter px-counter--lead" data-filter="all" role="button" tabindex="0" aria-label="Show all events in feed">
+ <div class="px-counter px-counter--lead" data-filter="all" role="button" tabindex="0" aria-pressed="true" aria-label="Show all events in feed">
<dt data-i18n="pulse.volume_24h">Volume · 24h</dt>
<dd id="px-c-vol">—</dd>
<span class="px-counter-sub" id="px-c-vol-sub" data-i18n="pulse.on_chain_flow">on-chain flow</span>
</div>
- <div class="px-counter" data-filter="tips" role="button" tabindex="0" aria-label="Filter feed to tips">
+ <div class="px-counter" data-filter="tips" role="button" tabindex="0" aria-pressed="false" aria-label="Filter feed to tips">
<dt data-i18n="pulse.tips_24h">Tips · 24h</dt>
<dd id="px-c-tips">—</dd>
<span class="px-counter-sub" id="px-c-tips-sub">—</span>
</div>
- <div class="px-counter" data-filter="launches" role="button" tabindex="0" aria-label="Filter feed to launches">
+ <div class="px-counter" data-filter="launches" role="button" tabindex="0" aria-pressed="false" aria-label="Filter feed to launches">
<dt data-i18n="pulse.launches_24h">Launches · 24h</dt>
<dd id="px-c-launches">—</dd>
<span class="px-counter-sub" data-i18n="pulse.coins_minted">coins minted</span>
</div>
- <div class="px-counter" data-filter="trades" role="button" tabindex="0" aria-label="Filter feed to trades">
+ <div class="px-counter" data-filter="trades" role="button" tabindex="0" aria-pressed="false" aria-label="Filter feed to trades">
<dt data-i18n="pulse.trades_24h">Trades · 24h</dt>
<dd id="px-c-trades">—</dd>
<span class="px-counter-sub" id="px-c-trades-sub" data-i18n="pulse.swaps">swaps</span>
</div>
- <div class="px-counter" data-filter="payments" role="button" tabindex="0" aria-label="Filter feed to payments">
+ <div class="px-counter" data-filter="payments" role="button" tabindex="0" aria-pressed="false" aria-label="Filter feed to payments">
<dt data-i18n="pulse.payments_24h">Payments · 24h</dt>
<dd id="px-c-pays">—</dd>
<span class="px-counter-sub" data-i18n="pulse.agent_agent_x402">agent → agent x402</span>
</div>
- <div class="px-counter" data-filter="purchases" role="button" tabindex="0" aria-label="Filter feed to marketplace purchases">
+ <div class="px-counter" data-filter="purchases" role="button" tabindex="0" aria-pressed="false" aria-label="Filter feed to marketplace purchases">
<dt data-i18n="pulse.marketplace_24h">Marketplace · 24h</dt>
<dd id="px-c-market">—</dd>
<span class="px-counter-sub" id="px-c-market-sub" data-i18n="pulse.paid_skill_buys">paid skill buys</span>
@@ -133,20 +133,20 @@
</div>
<aside class="px-rail" aria-label="Money intelligence">
<section class="px-card px-card--hl" id="px-bigtip-card" hidden>
- <div class="px-card-h">Biggest tip <small data-i18n="pulse.24h">24h</small></div>
+ <h3 class="px-card-h">Biggest tip <small data-i18n="pulse.24h">24h</small></h3>
<div id="px-bigtip"></div>
</section>
<section class="px-card">
- <div class="px-card-h">Top earners <small data-i18n="pulse.tips_7d">tips · 7d</small></div>
- <div id="px-earners"><p class="px-lb-empty" data-i18n="pulse.loading">Loading…</p></div>
+ <h3 class="px-card-h">Top earners <small data-i18n="pulse.tips_7d">tips · 7d</small></h3>
+ <div id="px-earners" aria-busy="true"><div class="px-lb-skels" aria-hidden="true"><div class="px-lb-skel"></div><div class="px-lb-skel"></div><div class="px-lb-skel"></div></div></div>
</section>
<section class="px-card">
- <div class="px-card-h">Busiest wallets <small data-i18n="pulse.events_24h">events · 24h</small></div>
- <div id="px-busiest"><p class="px-lb-empty" data-i18n="pulse.loading_2">Loading…</p></div>
+ <h3 class="px-card-h">Busiest wallets <small data-i18n="pulse.events_24h">events · 24h</small></h3>
+ <div id="px-busiest" aria-busy="true"><div class="px-lb-skels" aria-hidden="true"><div class="px-lb-skel"></div><div class="px-lb-skel"></div><div class="px-lb-skel"></div></div></div>
</section>
<section class="px-card">
- <div class="px-card-h">Fresh launches <small data-i18n="pulse.newest_coins">newest coins</small></div>
- <div id="px-launches"><p class="px-lb-empty" data-i18n="pulse.loading_3">Loading…</p></div>
+ <h3 class="px-card-h">Fresh launches <small data-i18n="pulse.newest_coins">newest coins</small></h3>
+ <div id="px-launches" aria-busy="true"><div class="px-lb-skels" aria-hidden="true"><div class="px-lb-skel"></div><div class="px-lb-skel"></div><div class="px-lb-skel"></div></div></div>
</section>
<div id="px-stats"></div>
<p class="px-sub px-fineprint">
diff --git a/src/pulse.css b/src/pulse.css
index b4258f3d7..a179cf055 100644
--- a/src/pulse.css
+++ b/src/pulse.css
@@ -231,6 +231,30 @@ body {
.px-lb-empty, .px-stats-err { color: var(--ink-dim, #888); font-size: var(--text-sm, .8rem); padding: 8px; }
.px-lb-empty a { color: var(--ink-bright, #fff); }
+/* Rail + stats error: say what broke, say when it retries, offer the retry now. */
+.px-stats-err { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px;
+ background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.07));
+ border-radius: var(--radius-lg, 14px); line-height: 1.45; }
+.px-stats-err p { margin: 0; flex: 1 1 190px; min-width: 0; }
+.px-lb-err { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px;
+ color: var(--ink-dim, #888); font-size: var(--text-sm, .8rem); line-height: 1.45; }
+.px-lb-err p { margin: 0; flex: 1 1 140px; min-width: 0; }
+.px-retry { appearance: none; font: inherit; font-size: var(--text-2xs, .7rem); font-weight: 600; cursor: pointer;
+ color: var(--ink-bright, #fff); background: var(--surface-2, rgba(255,255,255,.05));
+ border: 1px solid var(--stroke-strong, rgba(255,255,255,.16)); border-radius: var(--radius-pill, 999px);
+ min-height: 30px; padding: 6px 14px; flex: 0 0 auto;
+ transition: background var(--duration-fast, 140ms) var(--ease-standard, ease), border-color var(--duration-fast, 140ms) var(--ease-standard, ease); }
+.px-retry:hover { background: var(--surface-3, rgba(255,255,255,.09)); border-color: var(--ink-bright, #fff); }
+.px-retry:focus-visible { outline: 2px solid var(--ink-bright, #fff); outline-offset: 2px; }
+.px-retry[disabled] { opacity: .55; cursor: progress; }
+
+/* Rail loading: three ghost rows sized like the real ones, so the card never
+ jumps when the data lands and never sits on a bare "Loading" string. */
+.px-lb-skels { display: flex; flex-direction: column; gap: 4px; }
+.px-lb-skel { height: 46px; border-radius: var(--radius-md, 9px);
+ background: linear-gradient(90deg, var(--surface-2, rgba(255,255,255,.05)) 25%, var(--surface-3, rgba(255,255,255,.11)) 50%, var(--surface-2, rgba(255,255,255,.05)) 75%);
+ background-size: 200% 100%; animation: px-skel 1.4s linear infinite; }
+
/* ── Monochrome re-skin of the shared Money Pulse feed (this page only) ──
The component defaults to the wallet violet; on /pulse we drive it to the
ink ramp so tips/trades/launches read as one calm monochrome stream. */
@@ -281,8 +305,23 @@ body {
[data-state="loading"] .px-spark-bars { display: block; }
[data-state="loading"] .px-spark-bars::after { width: 100%; height: 100%; }
[data-state="loading"] .px-market-skills > div::after { width: 100%; height: 92px; }
+[data-state="loading"] .px-counter dd,
+[data-state="loading"] .px-counter-sub,
+[data-state="loading"] .px-spark-total { position: relative; color: transparent; }
+[data-state="loading"] .px-counter dd::after,
+[data-state="loading"] .px-counter-sub::after {
+ content: ""; position: absolute; inset: 0; right: auto; border-radius: 6px;
+ background: linear-gradient(90deg, var(--surface-2, rgba(255,255,255,.05)) 25%, var(--surface-3, rgba(255,255,255,.11)) 50%, var(--surface-2, rgba(255,255,255,.05)) 75%);
+ background-size: 200% 100%; animation: px-skel 1.4s linear infinite;
+}
+[data-state="loading"] .px-counter dd::after { width: 62%; }
+[data-state="loading"] .px-counter-sub::after { width: 78%; }
+[data-state="loading"] .px-spark-total::after { position: absolute; inset: 0; right: auto; height: auto; }
[data-state="loading"] .px-trade-insight { display: none; }
@media (prefers-reduced-motion: reduce) {
+ .px-lb-skel,
+ [data-state="loading"] .px-counter dd::after,
+ [data-state="loading"] .px-counter-sub::after,
[data-state="loading"] .px-kpi dd::after,
[data-state="loading"] .px-market-tag::after,
[data-state="loading"] .px-spark-total::after,
diff --git a/src/pulse.js b/src/pulse.js
index ab7ec1534..f53efd463 100644
--- a/src/pulse.js
+++ b/src/pulse.js
@@ -36,9 +36,12 @@ function setFeedFilter(filter) {
state.filter = f;
state.pulse?.setType(f);
- // Highlight the active counter; un-highlight all others.
+ // Highlight the active counter; un-highlight all others. These are toggle
+ // controls, so the pressed state has to reach assistive tech too, not just paint.
for (const el of document.querySelectorAll('[data-filter]')) {
- el.classList.toggle('px-counter--active', el.dataset.filter === f);
+ const on = el.dataset.filter === f;
+ el.classList.toggle('px-counter--active', on);
+ el.setAttribute('aria-pressed', String(on));
}
// Show / hide the filter bar.
@@ -73,20 +76,80 @@ function startUpdatedTick() {
setInterval(tick, 15_000);
}
-async function loadStats() {
+// The three rail panels hydrate from the same stats call. When it fails they must
+// not sit on their loading skeletons forever, so each one gets the same actionable
+// error line and the same retry, which re-runs the single fetch that feeds them all.
+const RAIL_PANELS = ['px-earners', 'px-busiest', 'px-launches'];
+
+function clearStatsError() {
const host = $('px-stats');
+ if (host) host.innerHTML = '';
+}
+
+// One retry button, wired to loadStats, shared by the summary line and the rail.
+function retryButton() {
+ const btn = document.createElement('button');
+ btn.type = 'button';
+ btn.className = 'px-retry';
+ btn.textContent = 'Retry';
+ btn.addEventListener('click', () => {
+ for (const b of document.querySelectorAll('.px-retry')) { b.disabled = true; b.textContent = 'Retrying…'; }
+ loadStats();
+ });
+ return btn;
+}
+
+function renderStatsError(message) {
+ const host = $('px-stats');
+ if (host) {
+ host.innerHTML = '';
+ const box = document.createElement('div');
+ box.className = 'px-stats-err';
+ box.setAttribute('role', 'status');
+ const p = document.createElement('p');
+ p.textContent = `${message} The live feed below is unaffected. Retrying automatically every minute.`;
+ box.append(p, retryButton());
+ host.appendChild(box);
+ }
+ // The 7-day sparkline hydrates from the same call; an empty bar strip under a
+ // live-looking header reads as "no activity", which is a different and wrong claim.
+ const bars = $('px-spark-bars');
+ if (bars && bars.dataset.loaded !== '1') {
+ bars.innerHTML = '<p class="px-lb-empty">Activity history unavailable.</p>';
+ }
+ // Only replace a panel that never got real rows; a panel showing the last known
+ // good data keeps it, because stale money intelligence beats an error card.
+ for (const id of RAIL_PANELS) {
+ const panel = $(id);
+ if (!panel || panel.dataset.loaded === '1') continue;
+ panel.setAttribute('aria-busy', 'false');
+ panel.innerHTML = '';
+ const wrap = document.createElement('div');
+ wrap.className = 'px-lb-err';
+ const p = document.createElement('p');
+ p.textContent = 'Could not load this panel.';
+ wrap.append(p, retryButton());
+ panel.appendChild(wrap);
+ }
+}
+
+async function loadStats() {
try {
const res = await fetch(`/api/pulse?view=stats&network=${state.network}`, { headers: { accept: 'application/json' } });
if (!res.ok) throw new Error(`stats ${res.status}`);
const { data } = await res.json();
+ clearStatsError();
renderStats(data);
state.lastUpdated = Date.now();
const updEl = $('px-updated');
if (updEl) updEl.textContent = 'just now';
} catch (e) {
log.warn('stats failed', e?.message);
- // The stats panel is supplementary — degrade quietly, never block the feed.
- if (host) host.innerHTML = `<div class="px-stats-err">Money stats are reconnecting…</div>`;
+ // The stats panel is supplementary: degrade to a retryable notice, never block
+ // the feed, and never strand the rail on its loading skeletons.
+ renderStatsError('Money stats are offline right now.');
+ } finally {
+ $('px-shell')?.removeAttribute('data-state');
}
}
@@ -101,6 +164,14 @@ function setCounter(id, value, format) {
updateValue(el, value, format);
}
+// A panel that has rendered real rows (or a real empty state) is hydrated: a later
+// stats failure leaves it alone rather than replacing known-good data with an error.
+function markPanelLoaded(el) {
+ if (!el) return;
+ el.dataset.loaded = '1';
+ el.setAttribute('aria-busy', 'false');
+}
+
function renderStats(d) {
// Headline counters.
const vol = d.volume_24h || {};
@@ -130,8 +201,9 @@ function renderStats(d) {
.join('');
wireWalletChips(earners);
} else {
- earners.innerHTML = `<p class="px-lb-empty">No tips in the last 7 days. Be the first to back an agent.</p>`;
+ earners.innerHTML = `<p class="px-lb-empty">No tips in the last 7 days. <a href="/agents">Find an agent</a> and be the first to back one.</p>`;
}
+ markPanelLoaded(earners);
// Busiest wallets (24h events).
const busy = $('px-busiest');
@@ -141,8 +213,9 @@ function renderStats(d) {
.join('');
wireWalletChips(busy);
} else {
- busy.innerHTML = `<p class="px-lb-empty">No wallet activity in the last 24 hours yet.</p>`;
+ busy.innerHTML = `<p class="px-lb-empty">No wallet activity in the last 24 hours. <a href="/agents-live">Watch the agents</a> that are online now.</p>`;
}
+ markPanelLoaded(busy);
renderLaunches(d.recent_launches);
}
@@ -152,6 +225,7 @@ function renderSparkline(series) {
const host = $('px-spark-bars');
const totalEl = $('px-spark-total');
if (!host) return;
+ host.dataset.loaded = '1';
const days = Array.isArray(series) ? series : [];
const total = days.reduce((s, d) => s + (d.events || 0) + (d.launches || 0), 0);
if (totalEl) totalEl.textContent = `${fmtNum(total)} event${total === 1 ? '' : 's'}`;
@@ -186,6 +260,7 @@ function renderBigTip(t) {
function renderLaunches(list) {
const host = $('px-launches');
if (!host) return;
+ markPanelLoaded(host);
if (!list?.length) {
host.innerHTML = `<p class="px-lb-empty">No coins launched yet. <a href="/launch">Launch one.</a></p>`;
return;
@@ -240,6 +315,9 @@ function switchNetwork(net) {
const label = $('px-net-label');
if (label) label.textContent = target;
state.pulse?.setNetwork(target);
+ // The counters belong to the previous network until the new ones land: show the
+ // loading skeletons again rather than stale numbers under a new label.
+ $('px-shell')?.setAttribute('data-state', 'loading');
loadStats();
}