How nkabessa/calendar-pt works
Calendar Hack turns a selected runner training plan and race date into an editable calendar, with unit and week-start preferences and CSV/iCal exports. The main runtime path loads a plan, builds its dated race plan, presents it as a calendar, and routes edits and exports through the app controller. Plan selection, date-grid construction, workout rendering, and export formats are distinct domain responsibilities. The source excerpts establish the main controller and export/rendering behavior; some UI and plan-loading links rely on SOURCE INDEX references rather than inspected implementations.
Main entry points: App.tsx Plan app controller · CalendarGrid.tsx Calendar grid · main.tsx React entry and routes · rendering.ts Workout text and distances
Components 25
Application runtime
- React entry and routes
src/main.tsx - Plan app controller
src/App.tsx - About content
src/About.tsx - Toolbar and footer
src/Index.tsx
Plan and calendar domain
- Plan repository
src/ch/planrepo.ts - Available plans
src/ch/planList.ts - Plan configuration
src/ch/config.ts - Race-plan builder
src/ch/planbuilder.ts - Plan date calculation
src/ch/datecalc.ts - Dated workout grid
src/ch/dategrid.ts - Undo history
src/defy/history.ts
Calendar experience
- Calendar grid
src/components/CalendarGrid.tsx - Day cell and overlay
src/components/DayCell.tsx - Workout card
src/components/WorkoutCard.tsx - Week summary
src/components/WeekSummary.tsx - Weekday header
src/components/DayOfWeekHeader.tsx - Plan and date controls
src/components/PlanAndDate.tsx - Unit controls
src/components/UnitsButtons.tsx - Week-start control
src/components/WeekStartsOnPicker.tsx
Export services
- Workout text and distances
src/ch/rendering.ts - iCal generation
src/ch/icalservice.ts - CSV generation
src/ch/csvService.ts - File download
src/ch/downloadservice.ts
Other components
- Runner
- Browser
Connections 31
- Runner → React entry and routes: opens app
src/main.tsx - React entry and routes → Plan app controller: routes to
src/main.tsx - React entry and routes → Toolbar and footer: renders shell
src/main.tsx - React entry and routes → About content: routes to
src/main.tsx - Plan app controller → Plan repository: loads plans
src/App.tsx - Plan repository → Available plans: uses plan list
src/ch/planrepo.ts - Plan repository → Plan configuration: uses configuration
src/ch/planrepo.ts - Plan app controller → Plan configuration: checks plan status
src/App.tsx - Plan app controller → Race-plan builder: builds race plan
src/App.tsx - Race-plan builder → Plan date calculation: calculates dates
src/ch/planbuilder.ts - Race-plan builder → Dated workout grid: creates date grid
src/ch/planbuilder.ts - Plan app controller → Undo history: tracks undo state
src/App.tsx - Plan app controller → Plan and date controls: renders controls
src/App.tsx - Plan app controller → Unit controls: renders controls
src/App.tsx - Plan app controller → Week-start control: renders controls
src/App.tsx - Plan app controller → Calendar grid: renders race plan
src/App.tsx - Calendar grid → Dated workout grid: reads weeks
src/components/CalendarGrid.tsx - Calendar grid → Day cell and overlay: renders days
src/components/CalendarGrid.tsx - Calendar grid → Week summary: renders summaries
src/components/CalendarGrid.tsx - Calendar grid → Weekday header: renders headers
src/components/CalendarGrid.tsx - Day cell and overlay → Workout card: renders workout
src/components/DayCell.tsx - Workout card → Workout text and distances: formats workout
src/components/WorkoutCard.tsx - Week summary → Workout text and distances: formats distances
src/components/WeekSummary.tsx - Weekday header → Plan app controller: requests day swaps
src/App.tsx - Calendar grid → Plan app controller: requests date swaps
src/App.tsx - Plan app controller → iCal generation: generates iCal
src/App.tsx - Plan app controller → CSV generation: generates CSV
src/App.tsx - iCal generation → Workout text and distances: formats events
src/ch/icalservice.ts - CSV generation → Workout text and distances: formats rows
src/ch/csvService.ts - Plan app controller → File download: downloads export
src/App.tsx - File download → Browser: creates file download
src/ch/downloadservice.ts