Skip to content

Commit 40085b0

Browse files
committed
Display LRR registration stats
1 parent c2ffc79 commit 40085b0

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

pages/light-rail-relay-25.html

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@
731731
<img src="{{ site.baseurl }}/img/lrr25/logo.svg" alt="Light Rail Relay" class="p-0 p-md-1"/>
732732
<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">
733733
<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>
735735
<div class="gap-2 d-flex flex-wrap">
736736
<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
737737
</a>
@@ -848,6 +848,9 @@ <h6 class="text-secondary">Segment Calculator</h6>
848848

849849
<section>
850850
<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>
851854
<h2 id="registration" class="mb-3">Registration</h2>
852855
<p>
853856
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
12111214
document.getElementById("results-table").appendChild(relayResultsTable)
12121215
})*/
12131216

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+
12141240
document.addEventListener('DOMContentLoaded', e => {
12151241
const greenGradient = [
12161242
[67, 217, 50],

0 commit comments

Comments
 (0)