40227-vm/frontend/docs/dashboard-integration.md
Dmitri d4a5378adf Refactor: migrate frontend to Vite/React, add product backend modules
Frontend:
- Replace Next.js with Vite + React + TypeScript
- Add new component architecture (app-shell, sidebar, dashboard modules)
- Implement product modules: FRAME, safety protocols, walkthrough checkin,
  campus/staff attendance, personality quiz, sign language, classroom timer
- Add shadcn/ui component library with Tailwind CSS
- Remove legacy generated components, stores, and pages

Backend:
- Add product migrations: frame_entries, user_progress, safety_quiz_results,
  walkthrough_checkins, communication_events, personality_quiz_results,
  campus_attendance_config/summaries, staff_attendance_records, content_catalog
- Add corresponding models, services, and routes
- Implement cookie-based auth with refresh token rotation
- Add content catalog seeder with product content
- Migrate to ESLint flat config
- Switch from yarn to npm

Infrastructure:
- Update .gitignore for new tooling
- Add project documentation (CLAUDE.md, docs/)
- Remove deprecated config files and yarn.lock

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-06-09 15:18:23 +02:00

2.6 KiB

Dashboard Integration

Purpose

Dashboard composes current-user operational data from backend APIs and content catalog payloads through the three-layer frontend architecture.

View -> Business Logic -> API/Data Access -> Backend

Runtime quote, compliance, sign-of-week, FRAME, communication event, and zone check-in data comes from backend-backed hooks. The frontend owns only UI state, navigation config, zone option styling, and presentation.

Frontend Layers

View:

  • frontend/src/components/frameworks/Dashboard.tsx
  • frontend/src/components/dashboard/DashboardView.tsx
  • frontend/src/components/dashboard/DashboardHero.tsx
  • frontend/src/components/dashboard/DashboardQuotePanel.tsx
  • frontend/src/components/dashboard/DashboardZoneCheckIn.tsx
  • frontend/src/components/dashboard/DashboardFramePreview.tsx
  • frontend/src/components/dashboard/DashboardUpcomingEvents.tsx
  • frontend/src/components/dashboard/DashboardWeeklyProgress.tsx
  • frontend/src/components/dashboard/DashboardSignOfWeek.tsx
  • frontend/src/components/dashboard/DashboardQuickActions.tsx

Business logic:

  • frontend/src/business/dashboard/hooks.ts
  • frontend/src/business/dashboard/selectors.ts
  • frontend/src/business/dashboard/types.ts

Shared contracts and UI config:

  • frontend/src/shared/types/dashboard.ts
  • frontend/src/shared/constants/dashboard.ts
  • frontend/src/shared/constants/contentCatalog.ts

Backend Contracts

Content catalog:

  • GET /api/public/content-catalog/dashboard-encouraging-quotes
  • GET /api/public/content-catalog/dashboard-compliance-items
  • GET /api/public/content-catalog/dashboard-sign-of-week

Feature APIs:

  • F.R.A.M.E. entries through useFrameEntries
  • Communication events through useCommunicationEvents
  • Current-user zone check-in through useZoneCheckIn

Behavior

  • useDashboardPage composes all dashboard data sources into one page model.
  • Selectors handle greeting calculation, day-based quote selection, zone normalization, event limiting, and role-filtered quick actions.
  • View components receive prepared props and do not call API/data access modules.
  • Loading, empty, and error states remain explicit for each dashboard section.
  • The existing Dashboard props API is preserved while the framework component becomes a thin wrapper.

Data Ownership Rules

  • Do not add dashboard quote, compliance, sign-of-week, FRAME, event, or zone progress records to frontend constants.
  • Keep frontend constants limited to quick-action navigation config, zone button style config, and display limits.
  • Test-only fixtures may live in selector tests or frontend/src/test-seeds/.