65 lines
2.7 KiB
Markdown
65 lines
2.7 KiB
Markdown
# User Progress Frontend Integration
|
|
|
|
## Purpose
|
|
|
|
User progress follows the frontend three-layer architecture for current-user
|
|
personal state, including **sign language** learned progress and Classroom
|
|
Support favorite strategies. The daily Zone check-in also persists in
|
|
`user_progress` server-side, but the frontend reads it through the dedicated
|
|
`/api/zone_checkins` slice — see [`zone-checkin-integration.md`](zone-checkin-integration.md) —
|
|
not through this generic client.
|
|
|
|
```text
|
|
View -> Business Logic -> API/Data Access -> Backend
|
|
```
|
|
|
|
## Files
|
|
|
|
View layer:
|
|
|
|
- `frontend/src/components/frameworks/SignLanguage.tsx`
|
|
- `frontend/src/components/frameworks/ClassroomSupport.tsx`
|
|
- `frontend/src/components/sign-language/SignLanguageProgressPanel.tsx`
|
|
- `frontend/src/components/sign-language/SignLanguageVideoModal.tsx`
|
|
- `frontend/src/components/classroom-support/`
|
|
Business logic layer:
|
|
|
|
- `frontend/src/business/dashboard/hooks.ts`
|
|
- `frontend/src/business/dashboard/selectors.ts`
|
|
- `frontend/src/business/sign-language/hooks.ts`
|
|
- `frontend/src/business/sign-language/selectors.ts`
|
|
- `frontend/src/business/classroom-support/hooks.ts`
|
|
- `frontend/src/business/classroom-support/selectors.ts`
|
|
- `frontend/src/business/user-progress/hooks.ts`
|
|
- `frontend/src/business/user-progress/mappers.ts`
|
|
- `frontend/src/business/user-progress/types.ts`
|
|
|
|
API/data access layer:
|
|
|
|
- `frontend/src/shared/api/userProgress.ts`
|
|
- `frontend/src/shared/types/userProgress.ts`
|
|
|
|
Constants:
|
|
|
|
- `frontend/src/shared/constants/userProgress.ts`
|
|
|
|
## Behavior
|
|
|
|
- Learned sign IDs load from `GET /api/user_progress?progress_type=sign_learned`.
|
|
- Marking a sign learned uses `POST /api/user_progress`.
|
|
- Unmarking a sign uses `DELETE /api/user_progress/by-item`.
|
|
- Classroom strategy favorite IDs load from
|
|
`GET /api/user_progress?progress_type=classroom_strategy_favorite`.
|
|
- Saving a classroom strategy favorite uses `POST /api/user_progress`; removing it uses
|
|
`DELETE /api/user_progress/by-item`.
|
|
- The sign language page combines user progress with backend content catalog records in `useSignLanguagePage`.
|
|
- The Classroom Support page combines favorite progress with backend content catalog records in `useClassroomSupportPage`.
|
|
- Views render explicit backend errors from React Query state.
|
|
- User progress ownership is derived by the backend from the authenticated session.
|
|
- Personal progress reads/writes are enabled only in the user's own scope. Parent users drilled into
|
|
a child tenant do not load/write favorite or learned-progress rows.
|
|
|
|
## Remaining Related Work
|
|
|
|
Other module progress types should reuse this API only when the data is truly current-user progress. Aggregate director reporting should use separate backend summary endpoints.
|