1.8 KiB
1.8 KiB
Email Prompt on Event Registration
Overview
When users without a registered email address attempt to sign up for an event, they are now prompted to add an email address. This ensures they can receive notifications about event changes or cancellations.
Implementation
New Component
src/components/event/EmailPromptModal.tsx
- Modal that appears when a user without an email tries to register for an event
- Provides two options:
- "Add Email Address" - Navigates to user profile page
- "Continue Without Email" - Proceeds with registration anyway
Modified Files
src/pages/EventsPage.tsx
- Added email check in
handleRegisterfunction - Checks if user has
primaryEmailAddressbefore registration - Shows EmailPromptModal if no email is found
- Added navigation to user profile page for email management
- Maintains pending event ID to complete registration after user decision
src/components/event/index.ts
- Added export for
EmailPromptModal
User Flow
- User clicks "Register" or "Quick Register" on an event
- System checks if user has an email address registered
- If no email:
- EmailPromptModal appears
- User can choose to:
- Add email (redirected to profile page)
- Continue without email (registration proceeds)
- If email exists:
- Registration proceeds normally
Benefits
- Encourages users to add email addresses for better communication
- Non-blocking - users can still register without email
- Clear messaging about why email is beneficial
- Seamless integration with existing registration flow
Technical Details
- Uses Clerk's
user.primaryEmailAddress?.emailAddressto check for email - Modal is shown before API call to register
- Pending event ID is stored in state during modal interaction
- Registration completes after user makes a choice