fix: paginate weinfo times and read min deposit from ranking_info

- weinfo.html now pages times with the API's zero-based page offset instead of block heights\n- bal.js renders page metadata and hides dead next links on the last page\n- index.html and terms.html read amount from /ranking_info/{chain}
This commit is contained in:
2026-11-06 21:10:20 -04:00
parent 33df29b7a8
commit c87ce760e2
4 changed files with 44 additions and 23 deletions

View File

@@ -166,9 +166,8 @@ footer a{color:var(--accent);text-decoration:none}
<section class="card rounds">
<div class="head">
<div><h2>WeTime rounds</h2><div class="note">Each round: the block hash sent by this server and how fast it was. Chain: <span class="mono" id="chainth"></span>. The full list is in the download below.</div></div>
<!-- The server returns the latest 100 rounds only (no paging): no prev/next here. -->
<div class="pager" id="paginator" hidden></div>
<span class="badge">Latest 100 rounds</span>
<!-- The API supports page offsets; bal.js draws the prev/next links here. -->
<div class="pager" id="paginator"></div>
</div>
<div class="table-wrap">
<table id="wetimes">
@@ -348,18 +347,17 @@ footer a{color:var(--accent);text-decoration:none}
} else {
tableBody.innerHTML = '<tr><td colspan="7" style="padding:24px;text-align:center;color:var(--muted)">No rounds yet.</td></tr>';
}
var prev=0;
var next=0;
if (data.times && data.times.length > 0){
prev = data.times[0].blockHeight+data.times.length;
next = data.times[data.times.length-1].blockHeight;
if (prev < 0 ){
prev = 0;
}
}
const paginator = {prev:prev,next:next};
return paginator;
const urlParams = new URLSearchParams(window.location.search);
const currentPage = Math.max(parseInt(urlParams.get('page') || '0', 10) || 0, 0);
const pageSize = Math.min(Number(limit) || 100, 100);
const hasNext = !!data.times && data.times.length >= pageSize;
return {
page: currentPage,
prev: Math.max(currentPage - 1, 0),
next: currentPage + 1,
hasPrev: currentPage > 0,
hasNext: hasNext,
};
},{elementName:"download",fileName:"weinfo_"+cdate+".json",linkText:"download"})
}