From b258cc9742754f978174ba43bd107d3d92480b4c Mon Sep 17 00:00:00 2001 From: Daniel Olvera <139163393+danOIntellitect@users.noreply.github.com> Date: Sun, 15 Jun 2025 01:27:30 +0000 Subject: [PATCH 1/3] Add extracurricular activities and signup validation to the API --- src/app.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/app.py b/src/app.py index 4ebb1d9..2e2754b 100644 --- a/src/app.py +++ b/src/app.py @@ -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": "Wednesdays and Fridays, 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": "Tuesdays, 5:00 PM - 6:30 PM", + "max_participants": 15, + "participants": ["liam@mergington.edu", "ava@mergington.edu"] + }, + # Artistic activities + "Art Club": { + "description": "Explore painting, drawing, and other visual arts", + "schedule": "Thursdays, 3:30 PM - 5:00 PM", + "max_participants": 16, + "participants": ["grace@mergington.edu", "noah@mergington.edu"] + }, + "Drama Society": { + "description": "Participate in acting, stage production, and theater games", + "schedule": "Mondays, 4:00 PM - 5:30 PM", + "max_participants": 20, + "participants": ["ella@mergington.edu", "jack@mergington.edu"] + }, + # Intellectual activities + "Math Olympiad": { + "description": "Prepare for math competitions and solve challenging problems", + "schedule": "Wednesdays, 3:30 PM - 5:00 PM", + "max_participants": 10, + "participants": ["ethan@mergington.edu", "isabella@mergington.edu"] + }, + "Science Club": { + "description": "Conduct experiments and explore scientific concepts", + "schedule": "Fridays, 2:00 PM - 3:30 PM", + "max_participants": 14, + "participants": ["benjamin@mergington.edu", "charlotte@mergington.edu"] } } @@ -62,6 +101,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"]: + raise HTTPException(status_code=400, detail="Student already signed up") # Add student activity["participants"].append(email) return {"message": f"Signed up {email} for {activity_name}"} From 5659ff18bc1d9f9daa0e249fbb1bf14dcbc96c8f Mon Sep 17 00:00:00 2001 From: Daniel Olvera <139163393+danOIntellitect@users.noreply.github.com> Date: Sun, 15 Jun 2025 01:31:31 +0000 Subject: [PATCH 2/3] Add participants section to ActivityCard component --- components/ActivityCard.jsx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 components/ActivityCard.jsx diff --git a/components/ActivityCard.jsx b/components/ActivityCard.jsx new file mode 100644 index 0000000..bf55916 --- /dev/null +++ b/components/ActivityCard.jsx @@ -0,0 +1,27 @@ +
+ {/* ...existing activity info... */} +
+

+ Participants +

+ +
+ {/* ...existing code... */} +
\ No newline at end of file From c1db8e9102c61af2de4b7ae8445778f008144164 Mon Sep 17 00:00:00 2001 From: Daniel Olvera <139163393+danOIntellitect@users.noreply.github.com> Date: Sun, 15 Jun 2025 01:36:17 +0000 Subject: [PATCH 3/3] Add participants section to activity cards with styling --- components/ActivityCard.jsx | 27 ----------------------- src/static/app.js | 21 ++++++++++++++++++ src/static/styles.css | 43 +++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 27 deletions(-) delete mode 100644 components/ActivityCard.jsx diff --git a/components/ActivityCard.jsx b/components/ActivityCard.jsx deleted file mode 100644 index bf55916..0000000 --- a/components/ActivityCard.jsx +++ /dev/null @@ -1,27 +0,0 @@ -
- {/* ...existing activity info... */} -
-

- Participants -

- -
- {/* ...existing code... */} -
\ No newline at end of file diff --git a/src/static/app.js b/src/static/app.js index dcc1e38..73acc26 100644 --- a/src/static/app.js +++ b/src/static/app.js @@ -20,11 +20,32 @@ document.addEventListener("DOMContentLoaded", () => { const spotsLeft = details.max_participants - details.participants.length; + // Build participants list HTML + let participantsHTML = ""; + if (details.participants.length > 0) { + participantsHTML = ` + + `; + } else { + participantsHTML = `
No participants yet.
`; + } + activityCard.innerHTML = `

${name}

${details.description}

Schedule: ${details.schedule}

Availability: ${spotsLeft} spots left

+
+
Participants
+ ${participantsHTML} +
`; activitiesList.appendChild(activityCard); diff --git a/src/static/styles.css b/src/static/styles.css index a533b32..3d8e7b5 100644 --- a/src/static/styles.css +++ b/src/static/styles.css @@ -63,6 +63,7 @@ section h3 { border: 1px solid #ddd; border-radius: 5px; background-color: #f9f9f9; + position: relative; } .activity-card h4 { @@ -142,3 +143,45 @@ footer { padding: 20px; color: #666; } + +.participants-section { + margin-top: 18px; + padding: 12px 14px; + background: #eef3fa; + border-radius: 7px; + border: 1px solid #dde6f3; +} + +.participants-title { + font-weight: 600; + color: #1a237e; + margin-bottom: 8px; + font-size: 1.05em; + letter-spacing: 0.5px; +} + +.participants-list { + list-style: none; + padding-left: 0; + margin: 0; +} + +.participants-list li { + margin-bottom: 6px; + padding-left: 0; + color: #333; + display: flex; + align-items: center; + font-size: 0.98em; +} + +.participant-icon { + margin-right: 7px; + font-size: 1.1em; +} + +.no-participants { + color: #888; + font-style: italic; + font-size: 0.97em; +}