Live members-area updates: SSE toasts + cha-ching/pop sounds, no refresh needed

- The members area subscribes to the chain event stream (/api/feed/live) and
  reacts to anything relevant to the member: a payout received (cha-ching + toast
  + auto-refresh), a referral qualifying, a passed-up payout (missed), a settled
  purchase, a new activation in the line. No page refresh required.
- New chat message -> "pop" sound + toast + badge; ping heartbeat (20s) now
  returns chatUnread and pops on an increase.
- Sounds are synthesized via Web Audio (no asset files, CSP-safe).
- Surge badge: nudge the name down (ribbonY .779 -> .805) to center on its ribbon.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-07 07:36:47 -05:00
parent 7fbf9add37
commit 958bd5ac20
3 changed files with 70 additions and 9 deletions
+3 -2
View File
@@ -680,8 +680,9 @@ const server = http.createServer(async (req, res) => {
// lightweight presence heartbeat (called on a timer while the dashboard is open)
if (p === '/api/my/ping' && req.method === 'GET') {
const s = await auth.fromRequest(req);
if (s && s.email) accounts.touchSeen(s.email).catch(() => {});
return json(res, 200, { ok: true });
if (!s || !s.email) return json(res, 200, { ok: true, chatUnread: 0 });
accounts.touchSeen(s.email).catch(() => {});
return json(res, 200, { ok: true, chatUnread: await messages.chatUnread(s.email) });
}
// -- rehearsal test-POL faucet: top a connected wallet up to 10 test-POL
// (anvil_setBalance, no key needed). Rehearsal-only, rate-limited.