|
731 | 731 | <img src="{{ site.baseurl }}/img/lrr25/logo.svg" alt="Light Rail Relay" class="p-0 p-md-1"/> |
732 | 732 | <div class="subheader d-flex flex-column align-items-start align-items-md-end px-md-5 mb-4 justify-content-md-end text-md-end"> |
733 | 733 | <p><span class="h3">Ultra relay along Seattle's 1 Line</span><br/> by <a href="{{ site.baseurl }}/" class="fst-italic text-decoration-none text-light">Race Condition Running</a>. 08:30 September 27th</p> |
734 | | - <p class="text-muted">Registration closes September 25th</p> |
| 734 | + <p class="text-muted">Registration closes September 25th <span class="stats-text d-none">• <span class="stats-teams">-</span> teams registered</span></p> |
735 | 735 | <div class="gap-2 d-flex flex-wrap"> |
736 | 736 | <a class="btn btn-outline-light btn-lg" role="button" data-bs-title="by 9-25" data-bs-placement="bottom" href="{{ page.registration_link }}" data-goatcounter-click="ext-join-team-hero" >Join Team |
737 | 737 | </a> |
@@ -848,6 +848,9 @@ <h6 class="text-secondary">Segment Calculator</h6> |
848 | 848 |
|
849 | 849 | <section> |
850 | 850 | <div class="container"> |
| 851 | + <span class="stats-text float-end fw-light text-muted d-none pt-sm-2"> |
| 852 | + <span class="stats-teams">-</span> teams and <span class="stats-members">-</span> people are going. <span class="stats-thinking-about-it">-</span> are thinking about it. |
| 853 | + </span> |
851 | 854 | <h2 id="registration" class="mb-3">Registration</h2> |
852 | 855 | <p> |
853 | 856 | We are using <a href="https://panto.raceconditionrunning.com">Pantograph</a> for registration this year. Pantograph was tailor-made for team relays, and also lets your team upload exchange photos for timing purposes. |
@@ -1211,6 +1214,29 @@ <h2 id="results">Results <a href="#results" class="anchor-link" aria-label="Link |
1211 | 1214 | document.getElementById("results-table").appendChild(relayResultsTable) |
1212 | 1215 | })*/ |
1213 | 1216 |
|
| 1217 | + // Fetch and update stats |
| 1218 | + async function updateStats() { |
| 1219 | + try { |
| 1220 | + const response = await fetch('https://panto.raceconditionrunning.com/stats'); |
| 1221 | + if (response.ok) { |
| 1222 | + const stats = await response.json(); |
| 1223 | + document.querySelectorAll('.stats-text').forEach(el => el.classList.remove("d-none")); |
| 1224 | + document.querySelectorAll('.stats-teams').forEach(el => el.textContent = stats.teams || 0); |
| 1225 | + document.querySelectorAll('.stats-members').forEach(el => el.textContent = stats.memberships || 0); |
| 1226 | + document.querySelectorAll('.stats-thinking-about-it').forEach(el => el.textContent = stats.users - stats.memberships || 0); |
| 1227 | + } else { |
| 1228 | + // Hide stats elements if API fails |
| 1229 | + document.querySelectorAll('.stats-text').forEach(el => el.style.display = 'none'); |
| 1230 | + } |
| 1231 | + } catch (error) { |
| 1232 | + // Hide stats elements if fetch fails |
| 1233 | + document.querySelectorAll('.stats-text').forEach(el => el.style.display = 'none'); |
| 1234 | + } |
| 1235 | + } |
| 1236 | + |
| 1237 | + // Update stats on load |
| 1238 | + updateStats(); |
| 1239 | + |
1214 | 1240 | document.addEventListener('DOMContentLoaded', e => { |
1215 | 1241 | const greenGradient = [ |
1216 | 1242 | [67, 217, 50], |
|
0 commit comments