How geovanex24/react-calendar-app works
Project Type and Purpose
• This is a single‐page React/Vite “Calendar App” that provides user authentication and calendar event management.
• It doesn’t include its own backend; instead it talks to an external calendar API (configured via .env) and handles state and UI entirely in the browser.
File Structure Analysis
• Top-level:
• index.html & public/ – static assets and HTML template served by Vite
• vite.config.js, babel.config.cjs, ESLint/Jest configs – build & test pipeline
• package.json – lists dependencies (React, React Router, Redux Toolkit, etc.)
• src/:
• main.jsx – React entrypoint
• router/AppRouter.jsx – defines routes (Login vs. Calendar)
• api/calendarApi.js & api/index.js – HTTP layer for external Calendar service
• auth/pages/LoginPage.jsx – login UI
• calendar/pages/CalendarPage.jsx + calendar/components – calendar UI and modals
• store/… – Redux slices for auth, calendar, ui plus root store
• hooks/… – custom hooks (useAuthStore, useCalendarStore, useUiStore, useForm)
• helpers/… – utility functions (date conversion, localization, env reading)
• tests/ – unit & integration tests organized by feature
Key Architectural Patterns
• SPA (Single-Page Application) using React Router for page-level routing
• Flux pattern via Redux Toolkit: domain-specific slices (auth, calendar, ui)
• Feature-based folder structure for high cohesion
• Layered separation:
• Presentation (JSX components + CSS)
• State management (Redux slices + hooks)
• Data access (API module)
• Utilities (helpers)
Data Flow & Interactions
1. User navigates → React Router renders LoginPage or CalendarPage
2. On login: LoginPage dispatches auth action → API call to auth endpoint → success sets token in store
3. After auth: CalendarPage mounts → dispatch fetchEvents thunk → calendarApi.getEvents → external API → events stored in calendarSlice
4. User adds/edits/deletes event → dispatch appropriate action → calendarApi call → on success update calendarSlice → UI re-renders
5. Helpers (convertToDate, calendarLocalizer) format data for the calendar component