Skip to content

Commit cc796ae

Browse files
author
Roelf
committed
feat: enhance activity display with participants list and styling
1 parent b51f895 commit cc796ae

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-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+
// 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(p => `<li>${p}</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
@@ -63,6 +63,7 @@ section h3 {
6363
border: 1px solid #ddd;
6464
border-radius: 5px;
6565
background-color: #f9f9f9;
66+
position: relative;
6667
}
6768

6869
.activity-card h4 {
@@ -74,6 +75,34 @@ section h3 {
7475
margin-bottom: 8px;
7576
}
7677

78+
.participants-section {
79+
margin-top: 12px;
80+
padding: 10px;
81+
background-color: #eef2fa;
82+
border-radius: 4px;
83+
border: 1px solid #c5cae9;
84+
}
85+
86+
.participants-section strong {
87+
color: #3949ab;
88+
display: block;
89+
margin-bottom: 5px;
90+
}
91+
92+
.participants-list {
93+
margin: 0 0 0 18px;
94+
padding: 0;
95+
list-style-type: disc;
96+
color: #333;
97+
font-size: 15px;
98+
}
99+
100+
.no-participants {
101+
color: #888;
102+
font-style: italic;
103+
margin-left: 5px;
104+
}
105+
77106
.form-group {
78107
margin-bottom: 15px;
79108
}

0 commit comments

Comments
 (0)