Skip to content

Commit f3ad7ff

Browse files
committed
Add participants list display and styling to activity cards
1 parent 3dabb9c commit f3ad7ff

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+
// 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(p => `<li>${p}</li>`).join("")}
31+
</ul>
32+
</div>
33+
`;
34+
} else {
35+
participantsHTML = `
36+
<div class="participants-section">
37+
<strong>Participants:</strong>
38+
<p class="no-participants">No participants yet.</p>
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: #eef2fa;
150+
border-radius: 4px;
151+
border: 1px solid #dde3f3;
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+
}
166+
167+
.no-participants {
168+
color: #888;
169+
font-style: italic;
170+
margin-left: 2px;
171+
margin-bottom: 0;
172+
}

0 commit comments

Comments
 (0)