Skip to content

Phase 5: Dashboard completion — auth, types, all pages#26

Merged
nullEFFORT merged 3 commits intomainfrom
phase5-dashboard
Mar 5, 2026
Merged

Phase 5: Dashboard completion — auth, types, all pages#26
nullEFFORT merged 3 commits intomainfrom
phase5-dashboard

Conversation

@nullEFFORT
Copy link
Owner

Summary

Complete dashboard implementation for Phase 5:

  • Type reconciliation — Rewrote types.ts to match all backend schemas (enums, interfaces, response shapes)
  • Hook/page fixes — Fixed all existing pages for backend compatibility (raw arrays, correct field names, correct HTTP methods)
  • Auth UI — Full JWT auth flow: login page, token storage (sessionStorage), auto-refresh, protected routes, operator display in sidebar
  • SessionDetailPage — Tabbed view with chat feed (risk highlighting), voice transcripts, evidence table, linked subjects
  • SubjectDetailPage — Profile card, stats, timeline (chat/voice events), platform identities panel
  • EvidencePage — Evidence table with type filtering, integrity verification, file upload modal, download
  • ReportsPage — NCMEC report management with status filtering, draft creation, submission

Architecture

  • Token injection via module-level getters in client.ts with automatic 401 → refresh → retry
  • Domain hooks split into hooks-session.ts, hooks-subject.ts, hooks-evidence-reports.ts
  • Re-exported from main hooks.ts for convenience
  • No two files have overlapping ownership

Files Changed

  • src/api/types.ts — Full rewrite
  • src/api/hooks.ts — Fix types + re-exports
  • src/api/client.ts — Auth + upload
  • src/auth/ — AuthContext, useAuth, ProtectedRoute (new)
  • src/pages/LoginPage.tsx (new)
  • src/pages/DashboardPage.tsx, SessionsPage.tsx, SubjectsPage.tsx, AlertsPage.tsx — Field fixes
  • src/pages/SessionDetailPage.tsx, SubjectDetailPage.tsx, EvidencePage.tsx, ReportsPage.tsx — Full implementations
  • src/components/AlertCard.tsx, SubjectCard.tsx, Layout.tsx — Updated
  • src/App.tsx, src/main.tsx — Route + provider restructure
  • src/api/hooks-session.ts, hooks-subject.ts, hooks-evidence-reports.ts (new)

Closes #19, #20, #21, #22, #23, #24, #25

Test plan

  • Load app → redirected to /login
  • Bad credentials → error message
  • Valid login → dashboard with operator name in sidebar
  • Navigate all 8 pages without errors
  • Close tab, reopen → back to login (sessionStorage)
  • Session detail: chat/voice tabs with risk highlighting
  • Subject detail: profile, timeline, identities render
  • Evidence: upload, verify, download
  • Reports: create draft, submit
  • npx tsc --noEmit passes
  • npm run build succeeds

🤖 Generated with Claude Code

nullEFFORT and others added 2 commits March 4, 2026 22:36
- Rewrite types.ts to match backend schemas (Closes #19)
  - Fix all enum values (SessionStatus, AlertSeverity, GroomingStage, etc.)
  - Fix all interface fields to match backend *Out schemas
  - Remove paginated wrapper types (backend returns raw arrays)
  - Add auth types (OperatorOut, TokenResponse, etc.)

- Fix existing hooks and pages for backend compatibility (Closes #20)
  - hooks.ts: raw arrays, POST for confirm/dismiss, confirmed_by param
  - DashboardPage: total_subjects, remove trend data
  - SessionsPage: remove paginated .items, compute duration
  - SubjectsPage: cumulative_risk_score, sessions_flagged
  - AlertsPage: low/medium severity values
  - AlertCard: trigger_detail display, confirmed_by from auth
  - SubjectCard: updated grooming stage labels

- Auth UI foundation (Closes #21)
  - client.ts: token injection, 401 refresh, upload method
  - AuthContext + useAuth hook with sessionStorage tokens
  - ProtectedRoute with loading state
  - LoginPage with error handling
  - App.tsx route restructure with protected routes
  - Layout footer with operator name + logout
  - main.tsx AuthProvider wrapping

Co-Authored-By: Claude <noreply@anthropic.com>
SessionDetailPage (#22):
- Tabbed view: Chat, Voice, Evidence, Subjects
- Chat feed with risk highlighting (red tint + AlertTriangle)
- Voice transcript feed with speaker labels
- Evidence table with download links
- Session subjects list with risk badges
- New hooks-session.ts: useSessionSubjects

SubjectDetailPage (#23):
- Profile header with grooming stage pill and risk badge
- Stats row: sessions flagged, dates, account age, friends
- Timeline panel (60%): chronological chat/voice events
- Identities panel (40%): linked platform identities
- New hooks-subject.ts: useSubjectIdentities, useSubjectTimeline

EvidencePage (#24):
- Evidence table with file type filtering
- Verify integrity inline (ShieldCheck/ShieldAlert result)
- Upload modal with session_id, file_type, file picker
- Download links per file

ReportsPage (#25):
- Report list with status filter tabs
- Status badges (draft/submitted/accepted/rejected)
- Submit action for draft reports
- Create modal with session_id, subject_id, incident_type
- Auto-fills submitted_by from auth context

New hooks-evidence-reports.ts: useVerifyEvidence, useUploadEvidence,
useCreateReport, useSubmitReport

Re-export all domain hooks from hooks.ts.

Closes #22, #23, #24, #25

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@nullEFFORT nullEFFORT merged commit 2b24672 into main Mar 5, 2026
4 checks passed
@nullEFFORT nullEFFORT deleted the phase5-dashboard branch March 7, 2026 04:48
nullEFFORT added a commit that referenced this pull request Mar 7, 2026
Phase 5: Dashboard completion — auth, types, all pages
nullEFFORT added a commit that referenced this pull request Mar 7, 2026
Phase 5: Dashboard completion — auth, types, all pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type reconciliation: align types.ts with backend schemas

1 participant