From a141cd32f2613d281a2f5f55049de6fb333805b0 Mon Sep 17 00:00:00 2001 From: Greg Date: Sun, 8 Mar 2026 13:47:59 +0100 Subject: [PATCH] feat: add clear season indicator on main attendance page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Season label always visible above table (e.g. "Season 2025/2026") - Green highlighted banner when viewing next season ("⚡ Next Season — 2026/2027") - Next Season button turns green and active when selected Co-Authored-By: Claude Sonnet 4.6 --- static/app.js | 24 ++++++++++++++++++++---- templates/index.html | 22 +++++++++++++++++++++- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/static/app.js b/static/app.js index bb954fd..15330c2 100644 --- a/static/app.js +++ b/static/app.js @@ -22,16 +22,32 @@ function currentSeasonYear() { function fetchData() { fetch('/api/data').then(r => r.json()).then(d => { data = d; - updateSeasonButton(); + updateSeasonUI(); renderTable(); }); } -function updateSeasonButton() { +function updateSeasonUI() { const thisSeason = currentSeasonYear(); const hasNextSeason = (data.dates || []).some(d => getSeasonYear(d) === thisSeason + 1); + const btn = document.getElementById('next-season-btn'); - if (btn) btn.style.display = hasNextSeason ? '' : 'none'; + if (btn) { + btn.style.display = hasNextSeason ? '' : 'none'; + btn.classList.toggle('active', viewingNextSeason); + btn.textContent = viewingNextSeason ? 'Current Season' : 'Next Season'; + } + + const banner = document.getElementById('season-banner'); + if (banner) { + if (viewingNextSeason) { + banner.className = 'next'; + banner.textContent = `\u26a1 Next Season \u2014 ${thisSeason + 1}/${thisSeason + 2}`; + } else { + banner.className = 'current'; + banner.textContent = `Season ${thisSeason}/${thisSeason + 1}`; + } + } } function saveData() { @@ -210,11 +226,11 @@ document.addEventListener('DOMContentLoaded', () => { if (nextSeasonBtn) { nextSeasonBtn.onclick = () => { viewingNextSeason = !viewingNextSeason; - nextSeasonBtn.textContent = viewingNextSeason ? 'Current Season' : 'Next Season'; // Reset "show all" toggle when switching seasons showAllMatches = false; if (toggleBtn) toggleBtn.textContent = 'Show All Matches'; initialLoad = true; + updateSeasonUI(); renderTable(); }; } diff --git a/templates/index.html b/templates/index.html index 460030c..4ef2f3d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -92,6 +92,25 @@ background: #948979; color: #222831; } + #season-banner { + margin-bottom: 0.7em; + font-size: 0.95em; + font-weight: bold; + } + #season-banner.current { color: #948979; } + #season-banner.next { + display: inline-block; + background: #1e2e1e; + border: 1px solid #6aab69; + border-radius: 10px; + padding: 0.4em 1em; + color: #6aab69; + } + #next-season-btn.active { + background: #6aab69; + color: #222831; + border-color: #6aab69; + } @media (max-width: 900px) { body { margin: 1em; } .name-col { width: 110px; min-width: 80px; max-width: 140px; font-size: 0.95em; } @@ -109,9 +128,10 @@ -
+

Padel Nivelles

+