Skip to content

Commit 51073bc

Browse files
committed
Add participants section to activity cards with styling
1 parent a2fd2b4 commit 51073bc

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

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+
// 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.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: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,32 @@ footer {
142142
padding: 20px;
143143
color: #666;
144144
}
145+
146+
/* Add pretty participants section styles */
147+
.participants-section {
148+
margin-top: 10px;
149+
padding: 10px;
150+
background-color: #eef4fb;
151+
border-radius: 4px;
152+
border: 1px solid #cfd8dc;
153+
}
154+
155+
.participants-section strong {
156+
color: #1a237e;
157+
display: block;
158+
margin-bottom: 5px;
159+
}
160+
161+
.participants-list {
162+
list-style-type: disc;
163+
margin-left: 20px;
164+
margin-bottom: 0;
165+
color: #333;
166+
font-size: 15px;
167+
}
168+
169+
.no-participants {
170+
color: #888;
171+
font-style: italic;
172+
margin-left: 5px;
173+
}

0 commit comments

Comments
 (0)