4.5 KiB
4.5 KiB
Classroom Support Integration
Purpose
ClassroomSupport renders editable classroom strategy content from the backend content catalog. The frontend owns only UI state, filtering rules, style tokens, and presentation.
Runtime strategy records, images, descriptions, and implementation tips belong to the backend seed payload and can be managed through content catalog APIs.
Frontend Layers
View:
frontend/src/components/frameworks/ClassroomSupport.tsxfrontend/src/components/classroom-support/ClassroomSupportView.tsxfrontend/src/components/classroom-support/ClassroomSupportHeader.tsxfrontend/src/components/classroom-support/ClassroomSupportManagementPanel.tsxfrontend/src/components/classroom-support/ClassroomSupportTryToday.tsxfrontend/src/components/classroom-support/ClassroomSupportFilters.tsxfrontend/src/components/classroom-support/ClassroomStrategyGrid.tsxfrontend/src/components/classroom-support/ClassroomStrategyCard.tsxfrontend/src/components/classroom-support/ClassroomStrategyDetailModal.tsxfrontend/src/components/common/ConfirmationDialog.tsx
Business logic:
frontend/src/business/classroom-support/hooks.tsfrontend/src/business/classroom-support/selectors.tsfrontend/src/business/classroom-support/types.ts
Shared contracts and UI config:
frontend/src/shared/types/app.tsfrontend/src/shared/constants/classroomSupport.tsfrontend/src/shared/constants/contentCatalog.ts
Backend Contract
The page reads:
GET /api/content-catalog/read/classroom-strategies
Organization-level strategy managers update:
PUT /api/content-catalog/classroom-strategiesPOST /api/file/upload/classroom-support/strategy-images
The content payload is seeded in:
backend/src/db/seeders/content-catalog-data/content-catalog-seed-payloads.ts
Each strategy payload supports:
idtitledescriptioncategoryageGroupzoneimage(uploaded file private URL for newly managed cards; seeded presets may use static asset paths)implementationTip
Behavior
useClassroomSupportPageloads strategies through the shared content catalog hook.- The app-shell scope selector exposes this module at organization, school, campus, and class effective tiers when the user has
READ_CLASSROOM. Organization-level users can maintain classroom strategy content for descendant schools and campuses through the same backend-owned content catalog. - The management panel is shown only when the effective tenant is an organization and the user has
MANAGE_CONTENT_CATALOG. The backend enforces the same organization-scope rule forclassroom-strategiesmanagement endpoints. - Add, edit, and delete operations update the organization-scoped
classroom-strategiespayload. Strategy images are uploaded through the shared file subsystem before the content payload is saved, so production storage uses the configured bucket path and the payload stores the returned private URL. - Delete uses the shared confirmation dialog so destructive classroom strategy actions stay consistent with project modal styling.
- Seeded strategy cards are preset for each organization through content catalog seeding. New school and campus tenants do not receive independent classroom-strategy rows; they read the organization library.
- Favorite strategy IDs load and persist through
GET/POST/DELETE /api/user_progresswithprogress_type = classroom_strategy_favorite. Favorite controls are enabled only when the user is viewing their own scope; parent users drilled into a child tenant do not load or write child-scope favorites. - Selectors handle search, category, age, zone, favorites-only filtering, and the daily strategy selection.
- View components receive a prepared page model and do not call API/data access modules.
- Loading, empty, and error states are explicit through
StatePanel. - The detail modal displays
implementationTiponly when the backend payload provides it.
Data Ownership Rules
- Do not add classroom strategy records to frontend constants.
- Do not add frontend fallback strategy payloads.
- Keep frontend constants limited to filter options, style classes, query-independent timing values, and UI labels.
- Keep favorites out of
content_catalog; they are per-user rows inuser_progress. - Keep uploaded card images in the shared file subsystem (
classroom-support/strategy-images) and store only the private URL in the strategy payload. - Test-only fixtures may live in selector tests or
frontend/src/test-seeds/.