v0.5.85: move matches page summary next to pager.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+27
-19
@@ -3732,7 +3732,6 @@ function renderMatchesPage() {
|
||||
const body = $("#matches-body");
|
||||
const originsEl = $("#matches-origins");
|
||||
const playersEl = $("#matches-players");
|
||||
const sub = $("#matches-sub");
|
||||
if (!body) return;
|
||||
|
||||
const origin = MATCH_ORIGIN_FILTERS.some((o) => o.id === state.matchesOrigin)
|
||||
@@ -3813,7 +3812,6 @@ function renderMatchesPage() {
|
||||
if (!hasData) {
|
||||
body.innerHTML =
|
||||
'<div class="rankings-empty">暂无比赛数据(请运行 python web/fetch_pro_matches.py)</div>';
|
||||
if (sub) sub.textContent = "";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3837,12 +3835,9 @@ function renderMatchesPage() {
|
||||
}
|
||||
const start = (page - 1) * pageSize;
|
||||
const rows = allRows.slice(start, start + pageSize);
|
||||
|
||||
if (sub) {
|
||||
sub.textContent = total
|
||||
? `共 ${total} 场 · 第 ${page}/${pageCount} 页`
|
||||
: "";
|
||||
}
|
||||
const summary = total
|
||||
? `共 ${total} 场 · 第 ${page}/${pageCount} 页`
|
||||
: "";
|
||||
|
||||
if (!rows.length) {
|
||||
body.innerHTML = state.matchesPlayerId
|
||||
@@ -3854,20 +3849,33 @@ function renderMatchesPage() {
|
||||
const wrap = document.createElement("div");
|
||||
wrap.className = "matches-page-wrap";
|
||||
wrap.appendChild(buildMatchList(null, rows, { showHero: true }));
|
||||
if (pageCount > 1) {
|
||||
wrap.appendChild(
|
||||
buildMatchesPager(page, pageCount, (next) => {
|
||||
state.matchesPage = next;
|
||||
syncStateToUrl();
|
||||
renderMatchesPage();
|
||||
const board = $("#matches-view");
|
||||
if (board) board.scrollTop = 0;
|
||||
})
|
||||
);
|
||||
}
|
||||
wrap.appendChild(
|
||||
buildMatchesFoot(summary, page, pageCount, (next) => {
|
||||
state.matchesPage = next;
|
||||
syncStateToUrl();
|
||||
renderMatchesPage();
|
||||
const board = $("#matches-view");
|
||||
if (board) board.scrollTop = 0;
|
||||
})
|
||||
);
|
||||
body.replaceChildren(wrap);
|
||||
}
|
||||
|
||||
function buildMatchesFoot(summaryText, page, pageCount, onGo) {
|
||||
const foot = document.createElement("div");
|
||||
foot.className = "matches-foot";
|
||||
if (summaryText) {
|
||||
const summary = document.createElement("p");
|
||||
summary.className = "matches-foot-summary";
|
||||
summary.textContent = summaryText;
|
||||
foot.appendChild(summary);
|
||||
}
|
||||
if (pageCount > 1) {
|
||||
foot.appendChild(buildMatchesPager(page, pageCount, onGo));
|
||||
}
|
||||
return foot;
|
||||
}
|
||||
|
||||
function buildMatchesPager(page, pageCount, onGo) {
|
||||
const nav = document.createElement("nav");
|
||||
nav.className = "matches-pager";
|
||||
|
||||
Reference in New Issue
Block a user