Skip to content

Commit 759bf2d

Browse files
committed
Add participants list display and styling to activities
1 parent e252aa3 commit 759bf2d

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

src/static/app.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,32 @@ document.addEventListener("DOMContentLoaded", () => {
2020

2121
const spotsLeft = details.max_participants - details.participants.length;
2222

23+
// Build participants list HTML
24+
let participantsHTML = "";
25+
if (details.participants.length > 0) {
26+
participantsHTML = `
27+
<div class="participants-section">
28+
<strong>Participants:</strong>
29+
<ul class="participants-list">
30+
${details.participants.map(email => `<li>${email}</li>`).join("")}
31+
</ul>
32+
</div>
33+
`;
34+
} else {
35+
participantsHTML = `
36+
<div class="participants-section">
37+
<strong>Participants:</strong>
38+
<span class="no-participants">No participants yet</span>
39+
</div>
40+
`;
41+
}
42+
2343
activityCard.innerHTML = `
2444
<h4>${name}</h4>
2545
<p>${details.description}</p>
2646
<p><strong>Schedule:</strong> ${details.schedule}</p>
2747
<p><strong>Availability:</strong> ${spotsLeft} spots left</p>
48+
${participantsHTML}
2849
`;
2950

3051
activitiesList.appendChild(activityCard);

src/static/styles.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,31 @@ footer {
142142
padding: 20px;
143143
color: #666;
144144
}
145+
146+
.participants-section {
147+
margin-top: 12px;
148+
padding: 10px;
149+
background-color: #eef2ff;
150+
border-radius: 4px;
151+
border: 1px solid #c5cae9;
152+
}
153+
154+
.participants-section strong {
155+
color: #3949ab;
156+
display: block;
157+
margin-bottom: 6px;
158+
}
159+
160+
.participants-list {
161+
list-style-type: disc;
162+
margin-left: 20px;
163+
margin-bottom: 0;
164+
color: #333;
165+
font-size: 15px;
166+
}
167+
168+
.no-participants {
169+
color: #888;
170+
font-style: italic;
171+
margin-left: 5px;
172+
}

0 commit comments

Comments
 (0)