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:
Lucas Berger
2026-06-11 20:35:18 -04:00
parent 4bc0445173
commit 982438dc10
398 changed files with 19050 additions and 16382 deletions
@@ -3,7 +3,7 @@ phase: 02-calendar-display
plan: 03
type: execute
wave: 2
depends_on: ["02-01"]
depends_on: ['02-01']
files_modified:
- apps/pwa/src/styles/tokens.css
- apps/pwa/src/styles/tokens.ts
@@ -24,40 +24,40 @@ user_setup: []
must_haves:
truths:
- "A CSS custom-property token layer (the clean theme) defines all colors, spacing, typography, breakpoints from UI-SPEC; no hard-coded hex/px will be needed by components — tuned to stay legible/informational at tablet distance, not ultra-minimal (D-03)"
- "Schedule-X --sx-color-* vars are mapped to project tokens so no Schedule-X default colors bleed through"
- "colorUtils derives Schedule-X lightColors (main/container/onContainer) from a member hex"
- 'A CSS custom-property token layer (the clean theme) defines all colors, spacing, typography, breakpoints from UI-SPEC; no hard-coded hex/px will be needed by components — tuned to stay legible/informational at tablet distance, not ultra-minimal (D-03)'
- 'Schedule-X --sx-color-* vars are mapped to project tokens so no Schedule-X default colors bleed through'
- 'colorUtils derives Schedule-X lightColors (main/container/onContainer) from a member hex'
- "calendarConfig translates WEEK_START_DAY=0 (Sunday/JS) to Schedule-X firstDayOfWeek=7 (Temporal Sunday) and builds the per-calendar config keyed by String(userId) + 'shared'"
- "hydrateEvents converts all-day occurrences to Temporal.PlainDate and timed occurrences to Temporal.ZonedDateTime"
- 'hydrateEvents converts all-day occurrences to Temporal.PlainDate and timed occurrences to Temporal.ZonedDateTime'
- "hydrateEvents routes each event's Schedule-X calendarId to 'shared' (isShared) or String(ownerUserId), matching the userId-keyed calendars config — never String(calendarId)"
- "calendarStore (Zustand) holds selectedView (persisted per breakpoint group), selectedDate, openEventId, calendarRange — no server data"
- "fetchEvents(start,end) calls the windowed /api/events with credentials:include and returns OccurrencesResponse"
- 'calendarStore (Zustand) holds selectedView (persisted per breakpoint group), selectedDate, openEventId, calendarRange — no server data'
- 'fetchEvents(start,end) calls the windowed /api/events with credentials:include and returns OccurrencesResponse'
artifacts:
- path: "apps/pwa/src/styles/tokens.css"
provides: "clean-theme CSS custom properties + Schedule-X var overrides"
contains: "--color-shared-family"
- path: "apps/pwa/src/lib/calendarConfig.ts"
provides: "WEEK_START_DAY, firstDayOfWeek translation, buildCalendarConfig()"
exports: ["WEEK_START_DAY", "buildCalendarConfig"]
- path: "apps/pwa/src/lib/hydrateEvents.ts"
provides: "hydrateEvents() ISO→Temporal with all-day PlainDate guard + isShared/ownerUserId calendarId routing"
exports: ["hydrateEvents"]
- path: "apps/pwa/src/store/calendarStore.ts"
provides: "Zustand UI-state store with localStorage view persistence"
exports: ["useCalendarStore"]
- path: 'apps/pwa/src/styles/tokens.css'
provides: 'clean-theme CSS custom properties + Schedule-X var overrides'
contains: '--color-shared-family'
- path: 'apps/pwa/src/lib/calendarConfig.ts'
provides: 'WEEK_START_DAY, firstDayOfWeek translation, buildCalendarConfig()'
exports: ['WEEK_START_DAY', 'buildCalendarConfig']
- path: 'apps/pwa/src/lib/hydrateEvents.ts'
provides: 'hydrateEvents() ISO→Temporal with all-day PlainDate guard + isShared/ownerUserId calendarId routing'
exports: ['hydrateEvents']
- path: 'apps/pwa/src/store/calendarStore.ts'
provides: 'Zustand UI-state store with localStorage view persistence'
exports: ['useCalendarStore']
key_links:
- from: "apps/pwa/src/main.tsx"
to: "temporal-polyfill/global"
via: "import before any Schedule-X mount"
pattern: "temporal-polyfill/global"
- from: "apps/pwa/src/lib/calendarConfig.ts"
to: "apps/pwa/src/lib/colorUtils.ts"
via: "deriveScheduleXColors() for lightColors"
pattern: "deriveScheduleXColors"
- from: "apps/pwa/src/lib/hydrateEvents.ts"
to: "apps/pwa/src/lib/calendarConfig.ts"
- from: 'apps/pwa/src/main.tsx'
to: 'temporal-polyfill/global'
via: 'import before any Schedule-X mount'
pattern: 'temporal-polyfill/global'
- from: 'apps/pwa/src/lib/calendarConfig.ts'
to: 'apps/pwa/src/lib/colorUtils.ts'
via: 'deriveScheduleXColors() for lightColors'
pattern: 'deriveScheduleXColors'
- from: 'apps/pwa/src/lib/hydrateEvents.ts'
to: 'apps/pwa/src/lib/calendarConfig.ts'
via: "calendarId = isShared ? 'shared' : String(ownerUserId) matches buildCalendarConfig keys"
pattern: "ownerUserId"
pattern: 'ownerUserId'
---
<objective>
@@ -109,6 +109,7 @@ windowed fetchEvents, updated main.tsx, Schedule-X deps installed.
Create `apps/pwa/src/styles/index.css` importing tokens.css, plus a minimal global reset (box-sizing border-box, body font-family var, margin 0) — no third-party reset library.
Update `apps/pwa/src/main.tsx`: as the FIRST three imports (before React), add `import 'temporal-polyfill/global'`, `import '@schedule-x/theme-default/dist/index.css'`, `import './styles/index.css'` (in that order — Temporal must register before any Schedule-X usage, and token overrides must come after the Schedule-X default CSS so they win). Leave the QueryClientProvider tree intact.
</action>
<verify>
<automated>cd apps/pwa && grep -q "temporal-polyfill/global" src/main.tsx && grep -q "@schedule-x/theme-default/dist/index.css" src/main.tsx && grep -q "./styles/index.css" src/main.tsx && echo MAIN_IMPORTS_OK</automated>
@@ -143,6 +144,7 @@ windowed fetchEvents, updated main.tsx, Schedule-X deps installed.
Create `apps/pwa/src/lib/colorUtils.ts` exporting `hexToContainer(hex)` (main at 15% opacity blended over #FFFFFF → returns a hex/rgb string), `hexToOnContainer(hex)` (main darkened 40%), and `deriveScheduleXColors(main)` returning `{ main, container, onContainer }`. Implement the math inline (no third-party color lib per RESEARCH Don't-Hand-Roll note — it's simple enough). Write colorUtils.test.ts asserting the derivations for a known hex.
Create `apps/pwa/src/lib/calendarConfig.ts` exporting `export const WEEK_START_DAY = 0` with the inline comment that Schedule-X uses 7=Sunday, a translation `const sxFirstDay = WEEK_START_DAY === 0 ? 7 : WEEK_START_DAY` exposed as an exported `SX_FIRST_DAY_OF_WEEK`, the view factory list (`createViewDay`, `createViewWeek`, `createViewMonthGrid`, `createViewMonthAgenda` from @schedule-x/calendar), and `buildCalendarConfig(members: MemberCalendarConfig[])` returning `{ calendars }` keyed by String(userId) plus a reserved `'shared'` entry using deriveScheduleXColors('#F25C7A'). Per-member entries use deriveScheduleXColors(member.color). The `String(userId)` + `'shared'` key scheme here is the routing contract hydrateEvents (Task 3) must match — keep them aligned. Limit usage to the confirmed Schedule-X API surface (Pitfall 6). Turn the Plan 01 RED calendarConfig.test.ts green (it asserts the 0→7 translation).
</action>
<verify>
<automated>cd apps/pwa && pnpm test -- src/lib/colorUtils.test.ts src/lib/calendarConfig.test.ts</automated>
@@ -187,6 +189,7 @@ windowed fetchEvents, updated main.tsx, Schedule-X deps installed.
Create `apps/pwa/src/store/calendarStore.ts` exporting `useCalendarStore` (Zustand `create`) with state: `selectedView:string`, `selectedDate:string`, `openEventId:string|null`, `calendarRange:{start:string;end:string}` and setters. selectedView is initialized from localStorage keyed by breakpoint group (`window.matchMedia('(max-width:767px)').matches ? 'phone' : 'tablet-desktop'`), defaulting to 'month-agenda' on phone / 'month-grid' on tablet-desktop (D-05); setSelectedView writes back to localStorage under `calendarView.{group}`. calendarRange defaults to the current month ± 1 week (do NOT depend on Schedule-X onRangeUpdate for the first fetch — A4/Open Q2). Server events NEVER enter this store. Add `zustand` to apps/pwa deps if not already present.
In `apps/pwa/src/api/client.ts`, REPLACE the old unwindowed `fetchEvents()` and its `CalendarEvent`/`EventsResponse` types with: `CalendarOccurrence` interface (mirror the server contract — include calendarId, ownerUserId, isShared so hydrateEvents can route), `OccurrencesResponse { occurrences: CalendarOccurrence[] }`, and `fetchEvents(start:string, end:string): Promise<OccurrencesResponse>` calling `/api/events?start=${start}&end=${end}` with `credentials:'include'` and the same `if(!res.ok) throw` pattern as fetchMe. Note: EventProof.tsx referenced the old fetchEvents — leave EventProof for Plan 05 to remove; if the type change breaks its build, update EventProof minimally to compile (it is replaced in Plan 05).
</action>
<verify>
<automated>cd apps/pwa && pnpm test -- src/lib/hydrateEvents.test.ts</automated>
@@ -207,20 +210,22 @@ windowed fetchEvents, updated main.tsx, Schedule-X deps installed.
</tasks>
<threat_model>
## Trust Boundaries
| Boundary | Description |
|----------|-------------|
| localStorage → store init | persisted view string read at startup |
| Boundary | Description |
| --------------------------- | ----------------------------------------------- |
| localStorage → store init | persisted view string read at startup |
| server JSON → hydrateEvents | occurrence strings parsed into Temporal objects |
## STRIDE Threat Register
| Threat ID | Category | Component | Disposition | Mitigation Plan |
|-----------|----------|-----------|-------------|-----------------|
| T-02c-01 | Tampering | localStorage selectedView | accept | UI-only state; an invalid stored view falls back to the D-05 default; no security impact (single-device, two-person app) |
| T-02c-02 | Tampering | hydrateEvents string parsing | accept | Temporal.from throws on malformed input surfaced as a React Query error, not a security boundary; data already passed server zod validation |
| T-02c-SC | Tampering | @schedule-x/*, temporal-polyfill, lucide-react, zustand installs | mitigate | All Approved in RESEARCH §Package Legitimacy (mainstream, no postinstall); pinned versions; no [ASSUMED]/[SUS] |
| Threat ID | Category | Component | Disposition | Mitigation Plan |
| --------- | --------- | ----------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| T-02c-01 | Tampering | localStorage selectedView | accept | UI-only state; an invalid stored view falls back to the D-05 default; no security impact (single-device, two-person app) |
| T-02c-02 | Tampering | hydrateEvents string parsing | accept | Temporal.from throws on malformed input surfaced as a React Query error, not a security boundary; data already passed server zod validation |
| T-02c-SC | Tampering | @schedule-x/\*, temporal-polyfill, lucide-react, zustand installs | mitigate | All Approved in RESEARCH §Package Legitimacy (mainstream, no postinstall); pinned versions; no [ASSUMED]/[SUS] |
</threat_model>
<verification>
@@ -230,26 +235,28 @@ windowed fetchEvents, updated main.tsx, Schedule-X deps installed.
</verification>
<success_criteria>
- Clean-theme token layer + Schedule-X overrides present (D-01/D-02)
- firstDayOfWeek 0→7 translation encoded; per-calendar config built from member colors
- All-day Temporal PlainDate guard in place
- hydrateEvents calendarId routes by isShared/ownerUserId to match buildCalendarConfig keys
- Zustand UI store + windowed fetchEvents ready for Plan 04
</success_criteria>
</success_criteria>
<artifacts_produced>
## Artifacts this phase produces (Plan 03)
- CSS custom properties: --color-*, --space-*, --text-*, --font-family-base, --bp-*, --sx-color-* overrides (tokens.css)
- CSS custom properties: --color-_, --space-_, --text-_, --font-family-base, --bp-_, --sx-color-\* overrides (tokens.css)
- token object export (tokens.ts); styles/index.css global reset
- `hexToContainer`, `hexToOnContainer`, `deriveScheduleXColors` (colorUtils.ts)
- `WEEK_START_DAY`, `SX_FIRST_DAY_OF_WEEK`, `buildCalendarConfig`, `MemberCalendarConfig` (calendarConfig.ts)
- `hydrateEvents`, `ScheduleXEvent` (hydrateEvents.ts) — calendarId routed by isShared/ownerUserId
- `useCalendarStore` Zustand store + CalendarStore state shape (calendarStore.ts)
- `fetchEvents(start,end)`, `CalendarOccurrence`, `OccurrencesResponse` (client.ts — replaces old unwindowed versions)
- @schedule-x/* + temporal-polyfill + lucide-react + zustand dependencies
- @schedule-x/\* + temporal-polyfill + lucide-react + zustand dependencies
- main.tsx Temporal-polyfill-first import block
</artifacts_produced>
</artifacts_produced>
<output>
Create `.planning/phases/02-calendar-display/02-03-SUMMARY.md` when done