How jimmyhealer/shiftplanner works
Project type and purpose
• This is a Next.js-based full-stack application focused on rendering a shift-planning Gantt chart UI. It’s bootstrapped with Create-Next-App, uses React/TypeScript on the front end, and currently relies on mock data.
File structure
• Top-level config: next.config.ts, tsconfig.json, eslint.config.mjs, postcss.config.mjs, bun.lock
• Public assets: /public
• App entry: /src/app (Next.js App Router: layout.tsx, page.tsx, globals.css, gantt.css)
• Component hierarchy: /src/components (ErrorAlert, GanttChart, and subfolder /gantt for AssignmentBlock, DriverRow, ShiftLegend, TimelineHeader)
• State management: /src/context/ShiftPlannerContext.tsx
• Hooks: /src/hooks/useAssignmentOperations.ts
• Data: /src/data/mockData.ts (placeholder for real API)
• Utilities: /src/utils/ganttUtils.ts, /src/utils/timeline/timeUtils.ts
• Types: /src/types/index.ts
README for additional insights
• Confirms a Next.js front-end with automatic font optimization (Geist)
• No backend/API folder present, so it’s currently front-end only with mock data
Main components and relationships
a. Components
• Next.js Server / Node Runtime (Edge functions or SSR)
• React App (root at src/app/layout.tsx)
• ShiftPlannerContext Provider
• Page Layer (/src/app/page.tsx)
• Gantt Chart Module (/src/components/GanttChart.tsx + /components/gantt/*)
• Hook Layer (/src/hooks/useAssignmentOperations.ts)
• Data Layer (mockData or future API)
• Utility Layer (ganttUtils, timeUtils)
• Static Assets (public folder, fonts)
• Config & Build Tools (Bun, PostCSS, ESLint)
b. Interactions and data flow
1. Browser → Next.js Server: initial request
2. Next.js SSR/Hydration → React App Root
3. App Root initializes ShiftPlannerContext → provides state & operations hook
4. Page.tsx pulls context and passes assignments to GanttChart
5. GanttChart and subcomponents call ganttUtils/timeUtils for layout math
6. useAssignmentOperations hook reads/writes assignments (mockData or future API calls)
7. UI updates in client; errors surface via ErrorAlert
c. Architectural patterns & principles
• Component-based UI (Break Gantt into reusable blocks: DriverRow, AssignmentBlock, etc.)
• Context API for global state (shift assignments)
• Custom React Hook for encapsulating data operations
• Separation of concerns: layout (CSS), data (mockData/utilities), state, and view
d. Key technologies
• Next.js App Router (app/layout.tsx, page.tsx)
• React + TypeScript
• Context API & Custom Hooks
• PostCSS, CSS modules (globals.css, gantt.css)
• Vercel Edge/SSR (deployment target)