Skip to content

Commit cb552f4

Browse files
Add participants list display to activity cards
1 parent a7175b4 commit cb552f4

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

src/static/app.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,31 @@ 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 no-participants">
37+
<em>No participants yet.</em>
38+
</div>
39+
`;
40+
}
41+
2342
activityCard.innerHTML = `
2443
<h4>${name}</h4>
2544
<p>${details.description}</p>
2645
<p><strong>Schedule:</strong> ${details.schedule}</p>
2746
<p><strong>Availability:</strong> ${spotsLeft} spots left</p>
47+
${participantsHTML}
2848
`;
2949

3050
activitiesList.appendChild(activityCard);

src/static/styles.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ section h3 {
6363
border: 1px solid #ddd;
6464
border-radius: 5px;
6565
background-color: #f9f9f9;
66+
position: relative;
6667
}
6768

6869
.activity-card h4 {
@@ -142,3 +143,32 @@ footer {
142143
padding: 20px;
143144
color: #666;
144145
}
146+
147+
.participants-section {
148+
margin-top: 12px;
149+
padding: 10px;
150+
background-color: #eef3fb;
151+
border-radius: 4px;
152+
border: 1px solid #dbeafe;
153+
}
154+
155+
.participants-section strong {
156+
color: #1a237e;
157+
font-size: 15px;
158+
}
159+
160+
.participants-list {
161+
margin: 8px 0 0 18px;
162+
padding: 0;
163+
list-style-type: disc;
164+
color: #333;
165+
font-size: 15px;
166+
}
167+
168+
.no-participants {
169+
background-color: #f9f9f9;
170+
color: #888;
171+
border: none;
172+
font-style: italic;
173+
padding-left: 0;
174+
}

0 commit comments

Comments
 (0)