# Sign Language Integration

## Purpose

`SignLanguage` renders backend-owned sign catalog content and current-user learned progress through the three-layer frontend architecture.

```text
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.tsx`
- `frontend/src/components/frameworks/SignLanguageVideoModal.tsx`
- `frontend/src/components/sign-language/SignLanguageView.tsx`
- `frontend/src/components/sign-language/SignLanguageHeader.tsx`
- `frontend/src/components/sign-language/SignLanguageRememberPanel.tsx`
- `frontend/src/components/sign-language/SignLanguageProgressPanel.tsx`
- `frontend/src/components/sign-language/SignLanguageFilters.tsx`
- `frontend/src/components/sign-language/SignLanguageGrid.tsx`
- `frontend/src/components/sign-language/SignLanguageCard.tsx`
- `frontend/src/components/sign-language/SignLanguageVideoModal.tsx`

Business logic:

- `frontend/src/business/sign-language/hooks.ts`
- `frontend/src/business/sign-language/selectors.ts`
- `frontend/src/business/sign-language/types.ts`

Shared contracts and UI config:

- `frontend/src/shared/types/app.ts`
- `frontend/src/shared/constants/signLanguage.ts`
- `frontend/src/shared/constants/contentCatalog.ts`

## Backend Contracts

The page reads content from:

- `GET /api/public/content-catalog/sign-language-items`
- `GET /api/public/content-catalog/sign-language-page-content`

Learned progress uses:

- `GET /api/user_progress?progress_type=sign_learned`
- `POST /api/user_progress`
- `DELETE /api/user_progress/by-item`

Content payloads are seeded in:

- `backend/src/db/seeders/content-catalog-data/content-catalog-seed-payloads.js`

## Behavior

- `useSignLanguagePage` loads sign items, page content, and learned sign progress.
- Selectors handle category counts, search/category filtering, progress percentage, video duration, filter normalization, and YouTube search URL construction.
- View components receive a prepared page model and do not call API/data access modules.
- The video modal uses `useSignLanguageVideoModalState` for 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.
- Test-only fixtures may live in selector tests or `frontend/src/test-seeds/`.
