Skip to content

Commit 5f37a01

Browse files
authored
Add participants section to activity cards
- Display a bulleted list of participants for each activity card - Show a message when there are no participants - Update styles for the participants section to improve appearance
1 parent 080f568 commit 5f37a01

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

25.1.1

Whitespace-only changes.

src/static/app.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ document.addEventListener("DOMContentLoaded", () => {
44
const signupForm = document.getElementById("signup-form");
55
const messageDiv = document.getElementById("message");
66

7+
78
// Function to fetch activities from API
89
async function fetchActivities() {
910
try {
@@ -20,11 +21,31 @@ document.addEventListener("DOMContentLoaded", () => {
2021

2122
const spotsLeft = details.max_participants - details.participants.length;
2223

24+
// Build participants list HTML
25+
let participantsHTML = "";
26+
if (details.participants.length > 0) {
27+
participantsHTML = `
28+
<div class="participants-section">
29+
<strong>Participants:</strong>
30+
<ul class="participants-list">
31+
${details.participants.map(email => `<li>${email}</li>`).join("")}
32+
</ul>
33+
</div>
34+
`;
35+
} else {
36+
participantsHTML = `
37+
<div class="participants-section no-participants">
38+
<em>No participants yet.</em>
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+
.participants-section {
147+
margin-top: 12px;
148+
padding: 10px;
149+
background-color: #e3eafc;
150+
border-radius: 4px;
151+
}
152+
153+
.participants-section strong {
154+
color: #1a237e;
155+
}
156+
157+
.participants-list {
158+
margin: 8px 0 0 18px;
159+
padding-left: 0;
160+
list-style-type: disc;
161+
color: #333;
162+
font-size: 15px;
163+
}
164+
165+
.no-participants {
166+
background-color: #f5f5f5;
167+
color: #888;
168+
font-style: italic;
169+
padding: 8px 10px;
170+
border-radius: 4px;
171+
}
172+
173+
#Hey @professortocat, Agent mode sounds pretty cool. Can you please tell me more about it?

0 commit comments

Comments
 (0)