Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,45 @@
"schedule": "Mondays, Wednesdays, Fridays, 2:00 PM - 3:00 PM",
"max_participants": 30,
"participants": ["john@mergington.edu", "olivia@mergington.edu"]
},
# Sports related activities
"Soccer Team": {
"description": "Join the school soccer team and compete in local leagues",
"schedule": "Tuesdays and Thursdays, 4:00 PM - 5:30 PM",
"max_participants": 18,
"participants": ["lucas@mergington.edu", "mia@mergington.edu"]
},
"Basketball Club": {
"description": "Practice basketball skills and play friendly matches",
"schedule": "Wednesdays, 3:30 PM - 5:00 PM",
"max_participants": 15,
"participants": ["liam@mergington.edu", "ava@mergington.edu"]
},
# Artistic activities
"Art Club": {
"description": "Explore painting, drawing, and other visual arts",
"schedule": "Mondays, 3:30 PM - 5:00 PM",
"max_participants": 16,
"participants": ["ella@mergington.edu", "noah@mergington.edu"]
},
"Drama Society": {
"description": "Participate in theater productions and acting workshops",
"schedule": "Fridays, 4:00 PM - 6:00 PM",
"max_participants": 20,
"participants": ["amelia@mergington.edu", "jack@mergington.edu"]
},
# Intellectual activities
"Math Olympiad": {
"description": "Prepare for math competitions and solve challenging problems",
"schedule": "Thursdays, 3:30 PM - 5:00 PM",
"max_participants": 14,
"participants": ["charlotte@mergington.edu", "benjamin@mergington.edu"]
},
"Debate Club": {
"description": "Develop public speaking and argumentation skills",
"schedule": "Wednesdays, 4:00 PM - 5:30 PM",
"max_participants": 12,
"participants": ["henry@mergington.edu", "grace@mergington.edu"]
}
}

Expand All @@ -61,7 +100,9 @@ def signup_for_activity(activity_name: str, email: str):

# Get the specific activity
activity = activities[activity_name]
# Validate student is not already signed up

if email in activity["participants"]:
# Add student
activity["participants"].append(email)
return {"message": f"Signed up {email} for {activity_name}"}
21 changes: 21 additions & 0 deletions src/static/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,32 @@ document.addEventListener("DOMContentLoaded", () => {

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

// Build participants list HTML
let participantsHTML = "";
if (details.participants && details.participants.length > 0) {
participantsHTML = `
<div class="participants-section">
<strong>Participants:</strong>
<ul class="participants-list">
${details.participants.map(email => `<li>${email}</li>`).join("")}
</ul>
</div>
`;
} else {
participantsHTML = `
<div class="participants-section">
<strong>Participants:</strong>
<span class="no-participants">No participants yet</span>
</div>
`;
}

activityCard.innerHTML = `
<h4>${name}</h4>
<p>${details.description}</p>
<p><strong>Schedule:</strong> ${details.schedule}</p>
<p><strong>Availability:</strong> ${spotsLeft} spots left</p>
${participantsHTML}
`;

activitiesList.appendChild(activityCard);
Expand Down
28 changes: 28 additions & 0 deletions src/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,31 @@ footer {
padding: 20px;
color: #666;
}

.participants-section {
margin-top: 12px;
padding: 10px;
background-color: #eef3fb;
border-radius: 4px;
border: 1px solid #c5cae9;
}

.participants-section strong {
color: #3949ab;
display: block;
margin-bottom: 6px;
}

.participants-list {
list-style-type: disc;
margin-left: 20px;
margin-bottom: 0;
color: #333;
font-size: 15px;
}

.no-participants {
color: #888;
font-style: italic;
margin-left: 4px;
}