Paginate the live payment proof feed (Show more / Show fewer)

The feed showed only the latest 12 of 136 recorded payouts. Now:
- chain.getPayoutsPublic(offset,limit) returns a page of the full
  reversed history plus total/offset/limit/hasMore (limit capped 100).
- /api/public/payouts accepts ?offset & ?limit (defaults 0/40, so the
  live poll + toast detection are unchanged).
- payouts.js keeps a deduped store keyed by payout key; the live poll
  refreshes the recent page while "Show more" pulls older pages 12 at a
  time (with slight overlap so a newly-arrived payout can't open a gap),
  and "Show fewer" collapses back. Verified in-browser: 12 → 48 → 136
  rows, button flips to "Show fewer", collapses to 12, 0 console errors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-08-15 11:16:12 -05:00
parent 95bc5bc90f
commit d36a405581
4 changed files with 88 additions and 22 deletions
+4 -1
View File
@@ -368,7 +368,10 @@ async function handleApi(req,res,pathname){
}catch(e){return json(res,502,{error:e.message||'Lookup failed'})}
}
if(req.method==='GET'&&pathname==='/api/public/payouts'){
return json(res,200,chain.getPayoutsPublic(),{'Cache-Control':'public, max-age=20'});
const q=new URL(req.url,'http://x').searchParams;
const offset=Number(q.get('offset')||0);
const limit=Number(q.get('limit')||40);
return json(res,200,chain.getPayoutsPublic(offset,limit),{'Cache-Control':'public, max-age=20'});
}
if(req.method==='GET'&&pathname==='/api/public/org-stats'){
const root=Number(getConfig().orgRootId||21);