feat: players page redesign — deltas, KPI tiles, sparklines, expanded row #9

Merged
shcizo merged 27 commits from feat/shared-visual-layer-topbar-4 into main 2026-05-21 16:14:01 +02:00
Showing only changes of commit 15adddc2f1 - Show all commits
+9 -5
View File
@@ -135,17 +135,21 @@ async function clearCache() {
}
}
// Refreshes both the current rating and the prediction in one click.
// The single refresh button in the actions cell is wired to this wrapper
// (design has only one icon; we used to have two separate refresh buttons).
// Refreshes both the current rating and the prediction in one click, then
// re-swaps the table so every derived value (deltas, pills, sparkline) reflects
// the new state. Cheaper than fine-grained DOM updates and guaranteed consistent
// because the server renders the truth.
async function refreshPlayerData(pdgaNumber) {
const icon = document.querySelector(`#row-${pdgaNumber} .cell-actions .refresh-icon`);
if (icon) icon.classList.add('spinning');
try {
await Promise.allSettled([
refreshPlayer(pdgaNumber),
refreshRoundHistory(pdgaNumber)
fetch(`/api/refresh-player/${pdgaNumber}`, { method: 'POST' }),
fetch(`/api/refresh-round-history/${pdgaNumber}`, { method: 'POST' })
]);
htmx.ajax('GET', '/partials/ratings-table', { target: '#ratings-table', swap: 'innerHTML' });
} catch (error) {
console.error('Error refreshing player data:', error);
} finally {
if (icon) icon.classList.remove('spinning');
}