4.9 KiB
4.9 KiB
Sign Language Integration
Purpose
SignLanguage renders backend-owned sign catalog content and current-user learned progress through the three-layer frontend architecture.
View -> Business Logic -> API/Data Access -> Backend
Runtime sign records, teaching tips, video URLs, GIF URLs, step instructions, and page-level teaching reminders belong to backend content catalog payloads. The frontend owns only UI state, filter config, style tokens, and progress interaction wiring.
Frontend Layers
View:
frontend/src/components/frameworks/SignLanguage.tsxfrontend/src/components/frameworks/SignLanguageVideoModal.tsxfrontend/src/components/sign-language/SignLanguageView.tsxfrontend/src/components/sign-language/SignLanguageHeader.tsxfrontend/src/components/sign-language/SignLanguageManagementPanel.tsxfrontend/src/components/sign-language/SignLanguageRememberPanel.tsxfrontend/src/components/sign-language/SignLanguageProgressPanel.tsxfrontend/src/components/sign-language/SignLanguageFilters.tsxfrontend/src/components/sign-language/SignLanguageGrid.tsxfrontend/src/components/sign-language/SignLanguagePagination.tsxfrontend/src/components/sign-language/SignLanguageCard.tsxfrontend/src/components/sign-language/SignLanguageVideoModal.tsx
Business logic:
frontend/src/business/sign-language/hooks.tsfrontend/src/business/sign-language/selectors.tsfrontend/src/business/sign-language/types.ts
Shared contracts and UI config:
frontend/src/shared/types/app.tsfrontend/src/shared/constants/signLanguage.tsfrontend/src/shared/constants/contentCatalog.ts
Backend Contracts
The page reads content from:
GET /api/content-catalog/read/sign-language-itemsGET /api/content-catalog/read/sign-language-page-contentGET /api/content-catalog/read/dashboard-sign-of-weekPUT /api/content-catalog/sign-language-itemsPUT /api/content-catalog/dashboard-sign-of-week
Learned progress uses:
GET /api/user_progress?progress_type=sign_learnedPOST /api/user_progressDELETE /api/user_progress/by-item
Content payloads are seeded in:
backend/src/db/seeders/content-catalog-data/content-catalog-seed-payloads.ts
Behavior
useSignLanguagePageloads sign items, page content, and learned sign progress.- Organization-scope users with
MANAGE_CONTENT_CATALOGcan create, edit, and delete sign cards from the sign language page. The management panel writes the full org-scopedsign-language-itemspayload through the managed content catalog endpoint. - The sign editor supports title, description, category, step-by-step guide, teaching tip, preview image URL or upload, GIF URL or upload, YouTube video URL, and optional YouTube search URL.
- The Sign of the Week selector stores the selected card in
dashboard-sign-of-weekbysignId, current Sunday-startweekOf, and display fallback fields. Dashboard and notification rendering resolve that selector back to the live sign card, with word-based fallback for older seeded payloads. - Learned progress is a personal persisted state. When a parent-scope user is drilled into a child tenant, the page still shows sign content, but it does not load/write learned-sign progress or render "Progress Saved" / "Learned" affordances.
- Selectors handle category counts, search/category filtering, 12-card pagination, progress percentage, video duration, filter normalization, media URL normalization, and YouTube search URL construction.
- The grid displays 12 cards per page after search/category filters are applied. Changing search or category resets to page 1. Pagination stays visible for any non-empty result set, with previous/next controls disabled when there is only one page.
- Sign item media is normalized before rendering:
- image URLs are trimmed;
- YouTube watch, short, embed, shorts, and raw video IDs are normalized to embed URLs;
- Lifeprint GIF absolute and relative paths are normalized to the canonical
/asl101/gifscatalog; - legacy Lifeprint
/asl101/images-signsentries are treated as missing animated demos, so the modal shows the reference image fallback; - YouTube search terms are trimmed and URL-encoded.
- View components receive a prepared page model and do not call API/data access modules.
- The video modal uses
useSignLanguageVideoModalStatefor GIF/video mode, GIF loading state, and step-guide expansion. - Loading, empty, and error states are explicit through
StatePanel.
Data Ownership Rules
- Do not add sign records, teaching tips, page reminders, video URLs, GIF URLs, or step instructions to frontend constants.
- Do not add frontend fallback sign payloads.
- Keep frontend constants limited to filter options, category style classes, external URL templates, and UI view modes.
- Sign of the Week is selected from existing sign cards; do not duplicate dashboard-only sign content.
- Test-only fixtures may live in selector tests or
frontend/src/test-seeds/.