Skip to content

Commit 482a799

Browse files
committed
Add participants list display and styling to activity cards
1 parent 48eda52 commit 482a799

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

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+
// Create participants list HTML
24+
let participantsHTML = "";
25+
if (details.participants && 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 empty">
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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,31 @@ section h3 {
7474
margin-bottom: 8px;
7575
}
7676

77+
.participants-section {
78+
margin-top: 10px;
79+
padding: 10px;
80+
background-color: #eef3fa;
81+
border-radius: 4px;
82+
border: 1px solid #c5cae9;
83+
}
84+
.participants-section strong {
85+
color: #3949ab;
86+
font-size: 15px;
87+
}
88+
.participants-list {
89+
margin: 8px 0 0 18px;
90+
padding-left: 0;
91+
list-style-type: disc;
92+
color: #333;
93+
font-size: 15px;
94+
}
95+
.participants-section.empty {
96+
background-color: #f9f9f9;
97+
color: #888;
98+
border: 1px dashed #ccc;
99+
font-style: italic;
100+
}
101+
77102
.form-group {
78103
margin-bottom: 15px;
79104
}

0 commit comments

Comments
 (0)