style(13-03): apply Prettier formatting across repo
Mechanical reformat — no logic changes. 398 files changed, 19125 insertions(+), 16457 deletions(-). Prettier 3.8.4 with .prettierrc (singleQuote:true, semi:true, tabWidth:2, trailingComma:all, printWidth:100). Isolated per D-13-08 for reviewability.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
---
|
||||
phase: 02-calendar-display
|
||||
plan: "04"
|
||||
plan: '04'
|
||||
subsystem: pwa-calendar-shell
|
||||
tags: [schedule-x, tanstack-query, zustand, hydrate-events, temporal, calendar-shell, smoke-test]
|
||||
dependency_graph:
|
||||
requires: ["02-02", "02-03"]
|
||||
requires: ['02-02', '02-03']
|
||||
provides: [CalendarShell, App-root-calendar, CAL-03-smoke-test]
|
||||
affects: ["02-05"]
|
||||
affects: ['02-05']
|
||||
tech_stack:
|
||||
added: []
|
||||
patterns:
|
||||
@@ -24,13 +24,13 @@ key_files:
|
||||
- apps/pwa/src/App.tsx
|
||||
- apps/pwa/vitest.config.ts
|
||||
decisions:
|
||||
- "CalendarShell callbacks nested under config.callbacks per CalendarConfigExternal type (not top-level)"
|
||||
- "DateRange.start/end are Temporal.ZonedDateTime; extracted to ISO date via .toPlainDate().toString() for Zustand"
|
||||
- "test-setup.ts as vitest setupFiles for window.matchMedia polyfill — calendarStore creates Zustand store at module load time before test polyfills run"
|
||||
- "App.tsx simplified to single-line wrapper; EventProof and health probe removed from render path"
|
||||
- 'CalendarShell callbacks nested under config.callbacks per CalendarConfigExternal type (not top-level)'
|
||||
- 'DateRange.start/end are Temporal.ZonedDateTime; extracted to ISO date via .toPlainDate().toString() for Zustand'
|
||||
- 'test-setup.ts as vitest setupFiles for window.matchMedia polyfill — calendarStore creates Zustand store at module load time before test polyfills run'
|
||||
- 'App.tsx simplified to single-line wrapper; EventProof and health probe removed from render path'
|
||||
metrics:
|
||||
duration: "~12m"
|
||||
completed: "2026-06-05"
|
||||
duration: '~12m'
|
||||
completed: '2026-06-05'
|
||||
tasks_completed: 2
|
||||
files_created: 3
|
||||
files_modified: 2
|
||||
@@ -45,6 +45,7 @@ Schedule-X CalendarShell component wired to TanStack Query windowed fetch, hydra
|
||||
### Task 1: CalendarShell + App.tsx
|
||||
|
||||
**`apps/pwa/src/components/CalendarShell.tsx`** (186 lines):
|
||||
|
||||
- `useCalendarApp(config, [eventsService, eventModal])` with all four view factories: `createViewDay`, `createViewWeek`, `createViewMonthGrid`, `createViewMonthAgenda`
|
||||
- `defaultView` from Zustand persisted view (D-05 defaults: phone→month-agenda, tablet-desktop→month-grid already encoded in store)
|
||||
- `firstDayOfWeek: SX_FIRST_DAY_OF_WEEK` (7 = Sunday, Temporal convention) — Pitfall 1 guard
|
||||
@@ -61,6 +62,7 @@ Schedule-X CalendarShell component wired to TanStack Query windowed fetch, hydra
|
||||
### Task 2: CalendarShell Render Smoke Test (CAL-03)
|
||||
|
||||
**`apps/pwa/src/components/CalendarShell.test.tsx`** (6 tests):
|
||||
|
||||
- Render-without-throw smoke (validates `@schedule-x/react@4.1.0` ↔ `@schedule-x/calendar@4.6.0` import compatibility — Pitfall 6)
|
||||
- `ScheduleXCalendar` mounts with non-null `calendarApp`
|
||||
- `hydrateEvents` called with both timed + all-day occurrences; `eventsService.set()` called with hydrated events
|
||||
@@ -87,6 +89,7 @@ vite build: clean (474.27 kB, built in 395ms)
|
||||
### Auto-fixed Issues
|
||||
|
||||
**1. [Rule 1 - Bug] CalendarCallbacks nested under config.callbacks — not top-level**
|
||||
|
||||
- **Found during:** Task 1 — tsc reported `onRangeUpdate` not in `CalendarConfigExternal`
|
||||
- **Issue:** Research pattern (RESEARCH.md Pattern 4) showed `onRangeUpdate` at the top level of the config object. The actual type (`CalendarConfigExternal extends Partial<ReducedCalendarConfigInternal>`) carries `callbacks?: CalendarCallbacks` where `CalendarCallbacks` contains `onRangeUpdate` and `onEventClick`. They must be nested under `config.callbacks`.
|
||||
- **Fix:** Moved `onRangeUpdate` and `onEventClick` into `callbacks: { ... }` in the `useCalendarApp` config
|
||||
@@ -94,6 +97,7 @@ vite build: clean (474.27 kB, built in 395ms)
|
||||
- **Commit:** b79f649
|
||||
|
||||
**2. [Rule 3 - Blocking] window.matchMedia not defined in jsdom**
|
||||
|
||||
- **Found during:** Task 2 — test run crashed at Zustand store initialisation
|
||||
- **Issue:** `calendarStore.ts` calls `window.matchMedia` inside `readPersistedView()` which runs at `create()` time — i.e. at module load, before any test-file-level polyfill runs. Inline `Object.defineProperty` in the test file is too late.
|
||||
- **Fix:** Created `src/test-setup.ts` with the polyfill; added `setupFiles: ['./src/test-setup.ts']` to `vitest.config.ts`
|
||||
@@ -107,15 +111,18 @@ None — CalendarShell fetches real windowed data from `/api/events`, hydrates t
|
||||
## Threat Flags
|
||||
|
||||
No new threat surface beyond the plan's threat model.
|
||||
|
||||
- T-02d-01 (XSS): CalendarShell uses React JSX default escaping for all event field rendering — no `dangerouslySetInnerHTML`. Carried to Plan 05 popover.
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
Files created:
|
||||
|
||||
- [x] apps/pwa/src/components/CalendarShell.tsx
|
||||
- [x] apps/pwa/src/components/CalendarShell.test.tsx
|
||||
- [x] apps/pwa/src/test-setup.ts
|
||||
|
||||
Commits:
|
||||
|
||||
- [x] b79f649 — Task 1: CalendarShell + App.tsx
|
||||
- [x] f0af43c — Task 2: CalendarShell smoke test
|
||||
|
||||
Reference in New Issue
Block a user