Add event check in to Welcome landing page#2130
Add event check in to Welcome landing page#2130bconti123 wants to merge 10 commits intohackforla:developmentfrom
Conversation
Remove unused styles/state, extract helpers to reduce duplication, add error handling for check-in, and remove debug console.logs.
There was a problem hiding this comment.
Pull request overview
Adds an event check-in section to the logged-in Welcome landing page, including fetching checkInReady events and posting check-ins, with styling aligned to the existing check-in UI.
Changes:
- Fetches
checkInReady=trueevents on the Welcome page and displays a meeting selector. - Adds a CHECK IN action that POSTs to
/api/checkinsand renders a success state. - Introduces new local styling constants for the check-in section and empty-state messaging.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks! I’ve started addressing the feedback. |
|
Updated based on your feedback. Let me know if I missed anything. |
There was a problem hiding this comment.
🤖 ## CodeRabbit Review — 2 findings
1. Missing response status check (UserWelcome.jsx ~lines 97-108)
The fetch('/api/events?checkInReady=true') call doesn't check res.ok before parsing JSON. If the API returns a 4xx/5xx error, the error response body gets parsed and set into events state, which could cause rendering issues.
Suggested fix:
const res = await fetch('/api/events?checkInReady=true', {
headers: {
'x-customrequired-header': headerToSend,
},
});
if (!res.ok) {
throw new Error(`Failed to fetch events: ${res.statusText}`);
}
const resJson = await res.json();
setEvents(resJson);2. Potential runtime error on undefined event (UserWelcome.jsx ~lines 143-145)
events.find((e) => e._id === selectedEventId) may return undefined in edge cases (stale data, race condition), which would cause getEventLabel(undefined) to throw.
Suggested fix:
{(() => {
const event = events.find((e) => e._id === selectedEventId);
return event ? getEventLabel(event) : 'Unknown event';
})()}Review generated with CodeRabbit CLI 🤖
|
🤖 ### Additional context on the This one is more than a nitpick — The existing Worth noting: you already handle this correctly in |
Fixes #2106
What changes did you make and why did you make them ?
Notes:
checkInReady: trueon the event document.checkInReadyistrue.Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)
Visuals before changes are applied
Visuals after changes are applied