40227-vm/frontend/docs/community-service.md

49 lines
1.9 KiB
Markdown

# Community Service Frontend Slice
## Purpose
Community Service & School Partnerships follows the frontend three-layer architecture and loads organization records from the backend content catalog.
```text
View -> Business Logic -> API/Data Access -> Backend
```
The frontend keeps only presentation configuration in shared constants. Community organization records are backend-owned runtime content.
## Files
View layer:
- `frontend/src/components/frameworks/CommunityService.tsx`
- `frontend/src/components/community-service/`
Business logic layer:
- `frontend/src/business/community/hooks.ts`
- `frontend/src/business/community/selectors.ts`
Shared constants and types:
- `frontend/src/shared/constants/contentCatalog.ts`
- `frontend/src/shared/constants/community.ts`
- `frontend/src/shared/types/community.ts`
API/data access layer:
- `frontend/src/shared/api/contentCatalog.ts`
- `frontend/src/shared/types/contentCatalog.ts`
## Behavior
- The framework component is a thin wrapper around `useCommunityService`.
- Organization records load from `GET /api/content-catalog/read/community-organizations`.
- Shared constants own partnership labels/classes, age group labels, and category icon keys.
- Business selectors own category extraction, typed select value normalization, organization filtering, and stats.
- Business hook owns content loading, search text, category/type/age filters, expanded organization state, saved organization state, and filter panel state.
- View components render header, filters, stats, organization cards, details, and empty state.
- Views render explicit loading and error states from the content catalog query.
## Management Contract
If community organizations become tenant-owned or admin-editable beyond content catalog management, add a typed backend management contract and keep the frontend integration on the same path: `shared/api` + `business/community` + thin views.