58 lines
2.6 KiB
Markdown
58 lines
2.6 KiB
Markdown
# FRAME Frontend Integration
|
|
|
|
## Purpose
|
|
|
|
FRAME follows the frontend three-layer architecture for persisted action-plan entries.
|
|
|
|
```text
|
|
View -> Business Logic -> API/Data Access -> Backend
|
|
```
|
|
|
|
## Files
|
|
|
|
View layer:
|
|
|
|
- `frontend/src/components/frameworks/FrameModule.tsx`
|
|
- `frontend/src/components/frame/`
|
|
- `frontend/src/components/frameworks/Dashboard.tsx`
|
|
- `frontend/src/components/dashboard/DashboardFramePreview.tsx`
|
|
- `frontend/src/components/frameworks/DirectorDashboard.tsx`
|
|
- `frontend/src/components/director-dashboard/DirectorRecentFramePanel.tsx`
|
|
|
|
Business logic layer:
|
|
|
|
- `frontend/src/business/frame/hooks.ts`
|
|
- `frontend/src/business/frame/mappers.ts`
|
|
- `frontend/src/business/frame/selectors.ts`
|
|
- `frontend/src/business/frame/types.ts`
|
|
- `frontend/src/business/dashboard/hooks.ts`
|
|
- `frontend/src/business/director-dashboard/hooks.ts`
|
|
- `frontend/src/business/director-dashboard/selectors.ts`
|
|
- `frontend/src/shared/business/week.ts` (shared American/Sunday week canonicalization)
|
|
|
|
API/data access layer:
|
|
|
|
- `frontend/src/shared/api/frame.ts`
|
|
- `frontend/src/shared/types/frame.ts`
|
|
|
|
Constants:
|
|
|
|
- `frontend/src/shared/constants/frame.ts`
|
|
|
|
## Behavior
|
|
|
|
- FRAME entries load from `GET /api/frame_entries`.
|
|
- Create/update workflows use typed API calls and React Query mutations.
|
|
- **Week selection**: the create and edit forms use `FrameWeekPicker` (a `Popover` + `Calendar`) — picking any day snaps to that week's **Sunday** (American week) via the shared `shared/business/week.ts` (`toWeekStartIso`), and an optional free-text **week label** (e.g. "Spring Break week") is captured separately. The entry stores the canonical Sunday-start ISO in `week_of` and the label in `week_label`; cards render `Week of <formatWeekOf(weekStart)>` + the label badge. The same week util backs the dashboard hero "Week of …" and the safety-quiz week, so the week is consistent across the app.
|
|
- `FrameModule.tsx` is a thin wrapper that calls `useFrameModule` and renders focused FRAME view components.
|
|
- FRAME view components use shared UI primitives: `Button`, `Input`, `Textarea`, and `StatePanel`.
|
|
- Static FRAME sample entries are not used as runtime persisted-data substitutes.
|
|
- Empty and error states are rendered explicitly.
|
|
- Dynamic F/R/A/M/E field access is typed through `FrameSectionKey`.
|
|
- Director dashboard renders recent FRAME previews through director dashboard selectors instead of deriving preview rows in JSX.
|
|
- Home dashboard renders the latest FRAME entry through `useDashboardPage` and `DashboardFramePreview`.
|
|
|
|
## Remaining Related Work
|
|
|
|
Dashboard zone check-ins are owned by the dashboard business layer and user progress API, not by FRAME.
|