Data Structure
Form Schema
Firestore Collections
Frontend Implementation
Components Structure
Feature Overview
The availability management is implemented as a modal in the calendar page. The modal consists of two main sections:- A calendar view showing the current availability schedule
- A side panel for managing weekly schedules
Key Features
-
Weekly Schedule Management
- Set multiple time slots per day
- Mark entire days as unavailable
- Easy add/remove time slots with 15-minute intervals
- Default 9 AM to 5 PM schedule for each day
-
Time Slot Management
- Intuitive dropdown interface for time selection
- Validation for time slot ordering (end time must be after start time)
- Quick actions (delete slots, add new slots)
- Consistent 15-minute interval options
- Smart time constraints to prevent overlapping slots
- Logical time slot creation:
- First slot defaults to 9 AM - 5 PM
- Subsequent slots automatically start 1 hour after the latest end time
- One hour duration for new slots
-
Form Validation
- End time must be after start time for each slot
- Real-time validation feedback
Backend Implementation
API Endpoints Structure
Firebase Functions
Key Features
-
Data Management
- CRUD operations for weekly schedules
- Exception handling for specific dates
- Efficient querying of actual availability
- Conflict resolution between schedules and exceptions
-
Business Logic
- Validation of time slots (no overlaps)
- Schedule activation/deactivation
- Exception priority handling
- Time zone normalization
Calendar Integration
Displaying Availability with Background Events
The artist’s weekly schedule will be displayed as background events in the calendar usingreact-big-calendar’s background events feature. This provides a visual distinction between available time slots and actual bookings.
We calculate the unavailibity based on the weekly reccuring slots and the exceptions. We transform those into background events.
Integration with BigCalendar
The calendar page will combine both booking events and availability background events:Performance Considerations
-
Background Event Generation
- Generate background events only for the visible range
- Cache generated events to prevent unnecessary recalculations
- Update only when the schedule or visible range changes
-
Rendering Optimization
- Use
React.memofor background event components - Implement virtual scrolling for large datasets
- Lazy load events outside the visible range
- Use
Implementation Steps
-
Phase 1: Weekly Schedule Editor
- Implement WeeklyScheduleEditor components
- Build time slot management UI
- Add validation logic
- Create basic CRUD operations
-
Phase 2: Schedule Management
- Implement schedule templates
- Add exception handling
- Build schedule activation system
- Create schedule conflict detection
-
Phase 3: Calendar Integration
- Show actual availability in calendar
- Implement exception UI
- Add drag-and-drop support
- Build bulk operations interface
-
Phase 4: Optimization
- Add real-time updates
- Implement caching strategy
- Optimize queries
- Add batch operations
Technical Considerations
-
Performance
- Cache active weekly schedule
- Lazy load exceptions
- Optimize availability calculations
- Use efficient date-time operations
-
Scalability
- Support multiple active schedules
- Handle large numbers of exceptions
- Efficient schedule querying
- Batch updates for bulk changes
-
User Experience
- Immediate feedback on changes
- Intuitive time slot management
- Clear visual feedback
-
Time Slot Management
- Dynamic time constraints based on existing slots
- Prevents overlapping slots by filtering available times
- Smart defaults for new slots:
- Uses business hours (9-5) for first slot
- Calculates appropriate gaps between slots
- Maintains consistent one-hour duration for new slots
- Efficient time range validation using Date objects
- Preserves existing slot structure while adding new slots
Dependencies
@tanstack/react-query- For data fetching and cachingdate-fns- For date manipulation@radix-ui/react-select- For time selection dropdownszod- For schema validation@dnd-kit/core- For drag and drop functionality
Future Features
Advanced Scheduling Controls
-
Minimum Notice Period
- Allow artists to set a minimum advance notice required for bookings
- Configurable per schedule or globally
- Option to override for specific clients or booking types
- Automatic enforcement during booking process
-
Buffer Times
- Set automatic buffer times between appointments
- Configurable buffer duration before and after appointments
- Different buffer times based on tattoo type/size
- Smart buffer calculation based on booking history
-
Booking Duration Templates
- Preset duration templates based on tattoo size and complexity
- Custom templates for common tattoo types
- Integration with pricing calculator
- Historical data analysis for accurate duration estimates
-
Bulk Exception Management
- Batch create/edit exceptions for holidays and time off
- Import calendar events (iCal/Google Calendar)
- Recurring exception patterns
- Conflict resolution with existing bookings
Implementation Priority
- Minimum Notice Period - Essential for managing booking lead times
- Buffer Times - Critical for realistic scheduling
- Booking Duration Templates - Improves scheduling accuracy
- Bulk Exception Management - Enhances administrative efficiency