Skip to content

Commit 2940842

Browse files
committed
Add participants list display and styling to activity cards
1 parent c2f964a commit 2940842

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

src/static/app.js

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

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

23+
// Create 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
31+
.map(
32+
(email) =>
33+
`<li><span class="participant-badge">${email}</span></li>`
34+
)
35+
.join("")}
36+
</ul>
37+
</div>
38+
`;
39+
} else {
40+
participantsHTML = `
41+
<div class="participants-section">
42+
<em>No participants yet.</em>
43+
</div>
44+
`;
45+
}
46+
2347
activityCard.innerHTML = `
2448
<h4>${name}</h4>
2549
<p>${details.description}</p>
2650
<p><strong>Schedule:</strong> ${details.schedule}</p>
2751
<p><strong>Availability:</strong> ${spotsLeft} spots left</p>
52+
${participantsHTML}
2853
`;
2954

3055
activitiesList.appendChild(activityCard);

src/static/styles.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,33 @@ footer {
142142
padding: 20px;
143143
color: #666;
144144
}
145+
146+
.participants-section {
147+
margin-top: 12px;
148+
padding: 10px;
149+
background-color: #e3eafc;
150+
border-radius: 4px;
151+
border: 1px solid #c5cae9;
152+
}
153+
154+
.participants-section strong {
155+
color: #1a237e;
156+
}
157+
158+
.participants-list {
159+
margin-top: 6px;
160+
margin-left: 18px;
161+
list-style-type: disc;
162+
}
163+
164+
.participant-badge {
165+
display: inline-block;
166+
background: #3949ab;
167+
color: #fff;
168+
padding: 2px 8px;
169+
border-radius: 12px;
170+
font-size: 0.95em;
171+
margin-bottom: 2px;
172+
margin-right: 4px;
173+
letter-spacing: 0.02em;
174+
}

0 commit comments

Comments
 (0)