Overview
The Calendar feature provides a visual monthly view for tracking registered volunteer opportunities and workflow deadlines. Users can see upcoming commitments, mark completed opportunities, and sync with Google Calendar. File Reference:frontend/app/calendar/page.tsx:15
Key Features
Monthly Calendar View
Displays a traditional calendar grid with:- Day Headers - Sun through Sat
- Current Day Highlight - Highlighted with secondary background color
- Empty Cells - For days before the first of the month
- Day Numbers - Each day shows its numeric value
- Opportunity Badges - Color-coded events within each day
frontend/app/calendar/page.tsx:105-167
Opportunity Display
Each day can show multiple opportunities with:- Upcoming Opportunities - Red/pink background (
#eb6c6cwith 20% opacity) - Completed Opportunities - Gray background with strikethrough
- Checkmark Indicator - ✓ prefix on completed items
- Truncated Titles - Long titles are truncated with ellipsis
- Click to View - Click any opportunity for full details
frontend/app/calendar/page.tsx:129-163
Navigation
Month Navigation
Previous Month - Left chevron button Next Month - Right chevron button Date Picker - Calendar icon opens date picker modal for quick navigation Today Button - Jump to current month Code Reference:frontend/app/calendar/page.tsx:29-58
Date Picker Modal
Opens when clicking the calendar icon in the header:- Shows year and month selectors
- Select target year
- Select target month
- Calendar updates to selected date
frontend/app/calendar/page.tsx:53-58, 244-249
Opportunity Management
Registered Opportunities
The calendar displays opportunities from your registered list:- Data sourced from
useRegisteredOpportunities()hook - Filters
mockOpportunitiesby registration status - Matches opportunities to dates for display
frontend/app/calendar/page.tsx:8-26
Date Matching
Opportunities are matched to calendar days using:frontend/app/calendar/page.tsx:70-83
Past vs Future
The calendar distinguishes between: Past Opportunities:- Gray background (
bg-gray-200dark:bg-gray-700) - Strikethrough text
- Checkmark prefix
- Dimmed text color
- Red/pink background
- Normal text
- Hover effect (opacity increase)
- Clickable for details
frontend/app/calendar/page.tsx:86-90, 148-155
Opportunity Details Modal
Opening the Modal
Click any opportunity badge to open details:frontend/app/calendar/page.tsx:93-96
Modal Features
TheOpportunityModal displays:
- Full Title & Description - Complete opportunity details
- Date & Time - When the opportunity occurs
- Location - Where to go
- Requirements - What’s needed
- Registration Status - Whether you’re registered
- Cancel Registration - Button to unregister (if registered)
frontend/app/calendar/page.tsx:251-263
Canceling Registration
From the modal, users can:- Click “Cancel Registration” button
- Confirmation prompt (if implemented)
cancelRegistration(opportunityId)is called- Opportunity is removed from calendar
frontend/app/calendar/page.tsx:257-261
Google Calendar Sync
Sync Component
TheGoogleCalendarSync component provides:
- Export to Google Calendar - Generate .ics file or direct sync
- Bulk Export - Export all registered opportunities at once
- Event Details - Includes title, description, date, location
frontend/app/calendar/page.tsx:241, 12
Usage
- Register for opportunities
- Click “Sync with Google Calendar” button
- Choose export method (download .ics or direct sync)
- Events are added to your Google Calendar
components/calendar/google-calendar-sync.tsx
Calendar Calculations
Days in Month
frontend/app/calendar/page.tsx:61-63
First Day of Month
frontend/app/calendar/page.tsx:65-67
Calendar Grid Rendering
The calendar grid is rendered in three phases:- Weekday Headers - Sun through Sat (7 cells)
- Empty Prefix Cells - Days before first of month
- Day Cells - Each day of the month with opportunities
frontend/app/calendar/page.tsx:111-164
State Management
Local State
frontend/app/calendar/page.tsx:20-23
Global State
UsesuseRegisteredOpportunities() hook for:
registeredOpportunities- Array of registered opportunity IDsisRegistered(id)- Check registration statuscancelRegistration(id)- Unregister from opportunity
frontend/app/calendar/page.tsx:17
UI Components
Card Components
- Card - Main calendar container
- CardHeader - Month/year display and navigation controls
- CardContent - Calendar grid and legend
frontend/app/calendar/page.tsx:176-226
Navigation Controls
- Button - Previous/next month, date picker, today
- ChevronLeft/Right - Navigation icons
- CalendarIcon - Date picker trigger
frontend/app/calendar/page.tsx:182-206
Modals
- OpportunityModal - Opportunity details and actions
- DatePickerModal - Year/month quick navigation
frontend/app/calendar/page.tsx:244-263
Visual Legend
The calendar includes a color-coded legend:frontend/app/calendar/page.tsx:211-224
Responsive Design
The calendar adapts to different screen sizes:- Desktop - Full 7-column grid with spacious day cells
- Tablet - Compact grid with smaller fonts
- Mobile - Scrollable grid, abbreviated day names possible
Grid Layout
frontend/app/calendar/page.tsx:209
Day Cell Sizing
frontend/app/calendar/page.tsx:136
Data Flow
Loading Opportunities
- Component mounts
useRegisteredOpportunities()loads user’s registrationsmockOpportunitiesfiltered by registration status- Opportunities mapped to calendar dates
- Calendar renders with opportunity badges
User Interactions
- Click Opportunity → Opens modal with details
- Cancel Registration → Removes from calendar, updates state
- Navigate Month → Recalculates grid, fetches new date range
- Open Date Picker → Shows year/month selector
- Sync Calendar → Exports to Google Calendar
Integration Points
Hooks
useRegisteredOpportunities()- Registration state managementuseRouter()- Navigation (if needed)
frontend/app/calendar/page.tsx:16-17
Components
OpportunityModal- Details displayDatePickerModal- Date navigationGoogleCalendarSync- External calendar integration
frontend/app/calendar/page.tsx:11-13
Types
frontend/app/calendar/page.tsx:11
Best Practices
Performance
- Memoization - Consider memoizing
getOpportunitiesForDay()for large datasets - Virtual Scrolling - For year views or many opportunities per day
- Lazy Loading - Load only current month’s data initially
User Experience
- Clear Visual Hierarchy - Distinct colors for past/future
- Intuitive Navigation - Multiple navigation methods (arrows, today, date picker)
- Touch Targets - Large clickable areas for mobile
- Loading States - Show skeleton while data loads
Accessibility
- Keyboard Navigation - Support arrow keys for month navigation
- Screen Reader Labels - Announce dates and opportunity counts
- Focus Management - Return focus after modal close
- Color Contrast - Ensure text readable on all backgrounds
Troubleshooting
Common Issues
Opportunities Not Showing- Verify registration status in
registeredOpportunities - Check date matching logic (timezone issues)
- Confirm
mockOpportunitiescontains expected data
- Check timezone conversions (use UTC consistently)
- Verify
getFirstDayOfMonth()returns correct weekday - Ensure month indexing (0-11) is correct
- Verify
handleOpportunityClick()is called - Check
isModalOpenstate updates - Confirm
selectedOpportunityis set correctly
Debugging Tips
Future Enhancements
Potential Features
- Week View - Alternative layout showing single week
- Agenda View - List of upcoming opportunities
- Filters - Filter by opportunity type, location, etc.
- Search - Find specific opportunities
- Notifications - Reminders for upcoming commitments
- Multi-Select - Bulk actions on opportunities
- Recurring Events - Handle repeating opportunities
- Timezone Support - Display in user’s local timezone
Integration Opportunities
- Workflow Deadlines - Show workflow
start_atand completion deadlines - Step Deadlines - Display individual step due dates
- Team Calendar - View other team members’ availability
- Conflict Detection - Warn about overlapping commitments