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,15 +1,30 @@
|
||||
---
|
||||
phase: "03"
|
||||
plan: "05"
|
||||
phase: '03'
|
||||
plan: '05'
|
||||
subsystem: pwa-event-write-ui
|
||||
tags: [react, tanstack-query, zustand, eventform, caldav-write, pwa]
|
||||
dependency_graph:
|
||||
requires: ["03-03"]
|
||||
provides: ["EventForm component", "createEvent/updateEvent/fetchWritableCalendars client calls", "eventFormOpen/eventFormMode/eventFormUid Zustand keys"]
|
||||
affects: ["CalendarShell", "EventDetailPopover (future edit trigger)"]
|
||||
requires: ['03-03']
|
||||
provides:
|
||||
[
|
||||
'EventForm component',
|
||||
'createEvent/updateEvent/fetchWritableCalendars client calls',
|
||||
'eventFormOpen/eventFormMode/eventFormUid Zustand keys',
|
||||
]
|
||||
affects: ['CalendarShell', 'EventDetailPopover (future edit trigger)']
|
||||
tech_stack:
|
||||
added: []
|
||||
patterns: ["TanStack Query useMutation + useQuery", "Zustand UI-only state", "bottom-sheet/dialog responsive overlay", "vi.hoisted() for mock TDZ", "D-01 last-used calendar localStorage", "D-02 conditional calendar picker", "D-11 whole-series recurrence presets", "T-03-15 plain-text JSX XSS guard"]
|
||||
patterns:
|
||||
[
|
||||
'TanStack Query useMutation + useQuery',
|
||||
'Zustand UI-only state',
|
||||
'bottom-sheet/dialog responsive overlay',
|
||||
'vi.hoisted() for mock TDZ',
|
||||
'D-01 last-used calendar localStorage',
|
||||
'D-02 conditional calendar picker',
|
||||
'D-11 whole-series recurrence presets',
|
||||
'T-03-15 plain-text JSX XSS guard',
|
||||
]
|
||||
key_files:
|
||||
created:
|
||||
- apps/pwa/src/components/EventForm.tsx
|
||||
@@ -20,14 +35,14 @@ key_files:
|
||||
- apps/pwa/src/store/calendarStore.ts
|
||||
- apps/pwa/src/components/CalendarShell.tsx
|
||||
decisions:
|
||||
- "D-01 calendar default: last-used URL from localStorage (eventForm.lastCalendarUrl), first writable calendar as fallback"
|
||||
- "D-02 calendar picker: hidden when writableCalendars.length === 1, shown when >1 — driven by GET /api/events/writable-calendars"
|
||||
- "T-03-15 XSS: all field values as plain-text JSX children in EventForm; no dangerouslySetInnerHTML in code"
|
||||
- "vi.hoisted() required for mock factory variables to avoid TDZ (D-03-04-hoisting pattern)"
|
||||
- "eventFormOpen selector added to CalendarShell per-field selector pattern (Bug B guard preserved)"
|
||||
- 'D-01 calendar default: last-used URL from localStorage (eventForm.lastCalendarUrl), first writable calendar as fallback'
|
||||
- 'D-02 calendar picker: hidden when writableCalendars.length === 1, shown when >1 — driven by GET /api/events/writable-calendars'
|
||||
- 'T-03-15 XSS: all field values as plain-text JSX children in EventForm; no dangerouslySetInnerHTML in code'
|
||||
- 'vi.hoisted() required for mock factory variables to avoid TDZ (D-03-04-hoisting pattern)'
|
||||
- 'eventFormOpen selector added to CalendarShell per-field selector pattern (Bug B guard preserved)'
|
||||
metrics:
|
||||
duration_minutes: 6
|
||||
completed_date: "2026-06-05"
|
||||
completed_date: '2026-06-05'
|
||||
tasks_completed: 3
|
||||
files_created: 3
|
||||
files_modified: 3
|
||||
@@ -42,6 +57,7 @@ metrics:
|
||||
### Task 1: Typed write client calls + Zustand form-state keys
|
||||
|
||||
Extended `apps/pwa/src/api/client.ts` with:
|
||||
|
||||
- `CreateEventPayload` interface (title, allDay, start, end, recurrence, optional location/description/calendarUrl)
|
||||
- `CreateEventResponse` interface ({ uid })
|
||||
- `WritableCalendar` interface ({ url, displayName, color, isShared }) — D-03 server-authoritative shape
|
||||
@@ -51,6 +67,7 @@ Extended `apps/pwa/src/api/client.ts` with:
|
||||
- `fetchWritableCalendars()` — GET /api/events/writable-calendars, parses `{ calendars }` envelope, returns `WritableCalendar[]`
|
||||
|
||||
Extended `apps/pwa/src/store/calendarStore.ts` with:
|
||||
|
||||
- `eventFormOpen: boolean` (default: false)
|
||||
- `eventFormMode: 'create' | 'edit'` (default: 'create')
|
||||
- `eventFormUid: string | null` (default: null)
|
||||
@@ -59,6 +76,7 @@ Extended `apps/pwa/src/store/calendarStore.ts` with:
|
||||
### Task 2: EventForm modal
|
||||
|
||||
New `apps/pwa/src/components/EventForm.tsx` (715 lines):
|
||||
|
||||
- Bottom sheet on phone (≤767px), centered 480px dialog on tablet/desktop — reuses EventDetailPopover pattern
|
||||
- Fields per UI-SPEC §EventForm order: title, all-day toggle, start date/time, end date/time, calendar picker (conditional), recurrence, location, description
|
||||
- All-day toggle (`role="switch"`, aria-checked): hides time inputs when on, restores 09:00/10:00 defaults when off
|
||||
@@ -77,6 +95,7 @@ New `apps/pwa/src/components/EventForm.tsx` (715 lines):
|
||||
### Task 3: Mount EventForm + "New Event" FAB/toolbar in CalendarShell
|
||||
|
||||
Updated `apps/pwa/src/components/CalendarShell.tsx`:
|
||||
|
||||
- Added `setEventForm` and `eventFormOpen` per-field selectors (Bug B guard preserved)
|
||||
- Phone layout: fixed FAB bottom-right (56×56px, dark neutral fill, Plus icon, 56px ≥ 44px touch target)
|
||||
- Tablet/desktop layout: toolbar button above calendar content (dark neutral fill, Plus icon + "New Event" label)
|
||||
@@ -95,6 +114,7 @@ Updated `apps/pwa/src/components/CalendarShell.tsx`:
|
||||
### Auto-fixed Issues
|
||||
|
||||
**1. [Rule 3 - Blocking] vi.hoisted() required for EventForm.test.tsx mock factory variables**
|
||||
|
||||
- **Found during:** Task 2 GREEN phase
|
||||
- **Issue:** `vi.mock('../api/client.js', ...)` factory captured `mockCreateEvent` etc. before initialization (TDZ), causing `ReferenceError: Cannot access 'mockCreateEvent' before initialization`
|
||||
- **Fix:** Moved mock function declarations into `vi.hoisted()` call per decision D-03-04-hoisting
|
||||
@@ -105,10 +125,10 @@ None — plan executed with one auto-fixed TDZ blocker.
|
||||
|
||||
## Threat Surface Scan
|
||||
|
||||
| Flag | File | Description |
|
||||
|------|------|-------------|
|
||||
| Flag | File | Description |
|
||||
| ---------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| T-03-15 verified | apps/pwa/src/components/EventForm.tsx | All event field values rendered as plain-text JSX children; no `dangerouslySetInnerHTML` in code (appears only in JSDoc comment) |
|
||||
| T-03-16 verified | apps/pwa/src/api/client.ts | `fetchWritableCalendars` reads server-authoritative D-03 set verbatim; no client-side writability derivation |
|
||||
| T-03-16 verified | apps/pwa/src/api/client.ts | `fetchWritableCalendars` reads server-authoritative D-03 set verbatim; no client-side writability derivation |
|
||||
|
||||
No new threat surface introduced beyond what was planned.
|
||||
|
||||
@@ -118,13 +138,13 @@ None. All API calls are wired to real Plan 03 endpoints. SyncStateToast feedback
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
| Item | Status |
|
||||
|------|--------|
|
||||
| apps/pwa/src/components/EventForm.tsx | FOUND |
|
||||
| apps/pwa/src/api/client.test.ts | FOUND |
|
||||
| apps/pwa/src/components/EventForm.test.tsx | FOUND |
|
||||
| 6400ce6 test(03-05): RED client calls | FOUND |
|
||||
| 6ffcdcb feat(03-05): client calls GREEN | FOUND |
|
||||
| df416a4 test(03-05): RED EventForm | FOUND |
|
||||
| 86cefff feat(03-05): EventForm GREEN | FOUND |
|
||||
| 69eac90 feat(03-05): CalendarShell wired | FOUND |
|
||||
| Item | Status |
|
||||
| ------------------------------------------ | ------ |
|
||||
| apps/pwa/src/components/EventForm.tsx | FOUND |
|
||||
| apps/pwa/src/api/client.test.ts | FOUND |
|
||||
| apps/pwa/src/components/EventForm.test.tsx | FOUND |
|
||||
| 6400ce6 test(03-05): RED client calls | FOUND |
|
||||
| 6ffcdcb feat(03-05): client calls GREEN | FOUND |
|
||||
| df416a4 test(03-05): RED EventForm | FOUND |
|
||||
| 86cefff feat(03-05): EventForm GREEN | FOUND |
|
||||
| 69eac90 feat(03-05): CalendarShell wired | FOUND |
|
||||
|
||||
Reference in New Issue
Block a user