feat: auto-register walk-in attendees during check-in

- Automatically register users who scan QR code but aren't pre-registered
- Mark walk-in registrations with wasWalkIn flag
- Show different success messages for walk-ins vs pre-registered attendees
- Check in walk-ins immediately upon registration
- Remove 'not registered' error - now handles walk-ins gracefully
- Update both QR scan and manual check-in to support walk-ins
This commit is contained in:
2025-11-20 19:10:29 +00:00
parent 2102f053da
commit 57b7cd2308
4 changed files with 66 additions and 17 deletions

View File

@@ -55,7 +55,13 @@ export function EventCheckInPage() {
try {
// Send the Clerk ID to backend and let it handle the lookup
const response = await apiClient.post<{ success: boolean; username?: string; firstName?: string; lastName?: string }>(
const response = await apiClient.post<{
success: boolean;
username?: string;
firstName?: string;
lastName?: string;
wasWalkIn?: boolean;
}>(
`/events/${eventId}/checkin`,
{ clerkUserId }
);
@@ -64,7 +70,11 @@ export function EventCheckInPage() {
? `${response.firstName} ${response.lastName}`
: response.username || 'user';
setSuccessMessage(`Successfully checked in ${displayName}`);
if (response.wasWalkIn) {
setSuccessMessage(`✨ ${displayName} registered and checked in as walk-in!`);
} else {
setSuccessMessage(`✓ Successfully checked in ${displayName}`);
}
// Reload attendees to get updated status
setTimeout(() => {
@@ -255,7 +265,13 @@ export function EventCheckInPage() {
<button
onClick={async () => {
try {
const response = await apiClient.post<{ success: boolean; username?: string; firstName?: string; lastName?: string }>(
const response = await apiClient.post<{
success: boolean;
username?: string;
firstName?: string;
lastName?: string;
wasWalkIn?: boolean;
}>(
`/events/${eventId}/checkin`,
{ clerkUserId: attendee.user.clerkId }
);
@@ -264,7 +280,11 @@ export function EventCheckInPage() {
? `${response.firstName} ${response.lastName}`
: response.username || attendee.user.username;
setSuccessMessage(`Successfully checked in ${displayName}`);
if (response.wasWalkIn) {
setSuccessMessage(`✨ ${displayName} registered and checked in as walk-in!`);
} else {
setSuccessMessage(`✓ Successfully checked in ${displayName}`);
}
// Reload attendees to get updated status
setTimeout(() => {

View File

@@ -98,7 +98,9 @@ export function UserProfilePage() {
areasOfInterest: profileData.areasOfInterest || [],
});
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to load profile');
console.error('Error loading profile data:', err);
const errorMessage = err instanceof Error ? err.message : 'Failed to load profile';
setError(errorMessage);
} finally {
setLoading(false);
}