# RTSport Frontend โ€” Build 20260501 ## What Was Built ### 1. Coach Dashboard (Rewritten) **File:** `frontend/templates/coach/dashboard.html` **Changes:** - **Bottom nav** with 3 tabs: Roster, Status, Messages - **Roster tab** โ€” Sport selector (multi-sport coaches), stat grid (Out/Modified/Cleared), filter buttons (All/Out/Modified/Cleared), team sections with athlete items - **Status tab** โ€” Athletes grouped by status (๐Ÿšซ Out, โš ๏ธ Modified) with sport+rehab details, stat summary - **Messages tab** โ€” Placeholder stub - **Sport selector** โ€” Inline trigger with dropdown for multi-sport coaches, click-outside-to-close - **Filter highlight fix** โ€” Clearing sport filter also clears quick-action button highlight - **Athlete detail** โ€” Inline alert with name, team, grade, position, status, injury, rehab phase ### 2. AD Dashboard (Rewritten) **File:** `frontend/templates/ad/dashboard.html` **Features:** - **Bottom nav** with 3 tabs: Overview, Cases, Reports - **Overview tab** โ€” School-wide stats (total athletes, active cases, out today), sports grid with athlete/out/modified counts, recent activity feed - **Cases tab** โ€” All-sport cases grouped by sport, totals row (Out/Modified/Active Cases), per-athlete rows with status badges - **Reports tab** โ€” Placeholder with available report types listed - **Sport card click** navigates to coach view (`/coach?sport=...`) ### 3. AT Dashboard (New) **File:** `frontend/templates/at/dashboard.html` **Features:** - **Bottom nav** with 5 items: Overview, Cases, New Entry (+), Messages, Roster - **New Entry** gets distinctive green accent treatment - **Overview tab** โ€” Stats grid + active cases list with status badges - **Cases tab** โ€” Cases grouped by sport with athlete detail on click - Quick-loads from API `/api/v1/dashboard/at?school_id=...` ### 4. AT Sideline Entry (New) **File:** `frontend/templates/at/sideline-entry.html` **Features:** - Full form with athlete selector, event type, body part, side, severity, status, notes - Submits to `POST /api/v1/events/sideline-entry` - Roster loaded from `GET /api/v1/roster?school_id=...` - Success view with "Add Another" option - Back button to previous page ### 5. Parent Dashboard (New) **File:** `frontend/templates/parent/dashboard.html` **JS:** `frontend/static/js/parent-tabs.js` **CSS:** `frontend/static/css/parent-tabs.css` **Features:** - **Bottom nav** with 3 tabs: Home, Timeline, Message - **Home tab** โ€” Welcome header, athlete status card (avatar, name, sport, grade, position), status badge (Out/Modified/Cleared), injury details, rehab phase, milestones compact view - **Timeline tab** โ€” Recovery phases displayed as timeline with dots + descriptions - **Message tab** โ€” Stub view - Data from `GET /api/v1/dashboard/parent?school_id=...&child_id=...` - Milestone detail from `GET /api/v1/athletes/{id}/case?school_id=...` ### 6. Design System (Updated) **Files:** - `frontend/static/css/dashboard-tabs.css` โ€” Unified tab framework, bottom nav styles, skeleton loading, error retry, status grouping, timeline, milestones compact, parent cards - `frontend/static/css/parent-tabs.css` โ€” Parent-specific styles (athlete selector, welcome, status card) - `frontend/static/css/rtsport.css` โ€” Unchanged; legacy light theme (dashboards now use dark theme via dashboard-tabs.css) ### 7. Unified Tab Framework **File:** `frontend/static/js/dashboard-tabs.js` **Features:** - **Auto-login** with `at@preble.k12.wi.us` / `testpass123` via `POST /api/v1/auth/login/json`, stores in `localStorage.rtsport_token` - **Auth headers** `Authorization: Bearer {token}` on all requests - **`fetchWithRetry()`** โ€” 2 attempts with 1s delay - **Skeleton loaders** โ€” `skeletonHTML()`, `skeletonStats()` for consistent loading states - **Error/retry UI** โ€” `errorRetryHTML()` with inline retry button - **`initBottomNav()`** โ€” Tab framework with switchTab(), role-specific accent colors - **SVG icons** โ€” All nav items use consistent inline SVGs via `NAV_ICONS` object - **Utilities** โ€” `escHtml()`, `escAttr()`, `getSportIcon()` ## API Integration Points | Endpoint | Used In | |---|---| | `POST /api/v1/auth/login/json` | All dashboards (auto-login) | | `GET /api/v1/roster?school_id=...` | Sideline entry athlete dropdown | | `GET /api/v1/dashboard/at?school_id=...` | AT dashboard (Overview + Cases) | | `GET /api/v1/dashboard/coach?sport=...&school_id=...` | Coach dashboard (Roster + Status) | | `GET /api/v1/dashboard/parent?school_id=...&child_id=...` | Parent dashboard (Home) | | `GET /api/v1/dashboard/ad?school_id=...` | AD dashboard (Overview + Cases) | | `GET /api/v1/athletes/{id}/case?school_id=...` | Parent Timeline tab | | `POST /api/v1/events/sideline-entry` | Sideline entry form | All endpoints have mock fallback when API is unavailable. ## Success Criteria Status - [x] All 4 dashboards have bottom nav with working tabs - [x] Nav icons are consistent style (inline SVGs, same stroke/fill approach) - [x] Active tab has clear visual indicator (underline via ::after pseudo-element) - [x] AT "New Entry" gets distinctive treatment (green accent, larger icon, no label) - [x] Coach Status tab shows real data grouped by sport + status (๐Ÿšซ X out ยท โš ๏ธ Y restricted) - [x] Coach Messages tab shows stub/placeholder view - [x] Parent nav fully wired: Home (status card + milestones), Timeline (recovery phases), Message (placeholder) - [x] AD nav: Overview (dashboard stats), Cases (all-sport cases), Reports (placeholder) - [x] Filter highlight bug fixed โ€” clearing sport filter also clears quick-action button highlight - [x] "New Reports" count respects current sport filter - [x] Skeleton loading shown during API fetches - [x] Error retry with 2 attempts, 1s delay