40227-vm/frontend/docs/top-bar-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

48 lines
1.8 KiB
Markdown

# Top Bar Integration
## Purpose
`TopBar` renders app-shell search, auth entry, campus/role badges, notifications, and profile menu through the three-layer frontend architecture.
```text
View -> Business Logic -> API/Data Access -> Backend
```
TopBar does not own product content records. It owns shell UI state and delegates auth actions to the auth session.
## Frontend Layers
View:
- `frontend/src/components/frameworks/TopBar.tsx`
- `frontend/src/components/top-bar/TopBarView.tsx`
- `frontend/src/components/top-bar/TopBarSearch.tsx`
- `frontend/src/components/top-bar/TopBarBadges.tsx`
- `frontend/src/components/top-bar/TopBarNotifications.tsx`
- `frontend/src/components/top-bar/TopBarProfileMenu.tsx`
- `frontend/src/components/top-bar/TopBarSignInModal.tsx`
Business logic:
- `frontend/src/business/top-bar/hooks.ts`
- `frontend/src/business/top-bar/selectors.ts`
- `frontend/src/business/top-bar/types.ts`
Shared config:
- `frontend/src/shared/constants/topBar.ts`
## Behavior
- `TopBar.tsx` is a thin wrapper that reads auth session state and passes it into `useTopBarPage`.
- `useTopBarPage` owns profile menu state, notifications menu state, sign-in modal state, search query state, and sign-out error state.
- Selectors handle initials, campus label fallback, shared role labels, and unread notification count.
- View components receive a prepared page model and do not call API/data access modules.
- Profile and settings menu items are explicitly disabled until product workflows exist, instead of rendering silent no-op buttons.
## Data Ownership Rules
- Do not add notification seed data to frontend constants.
- Keep TopBar constants limited to role badge classes and static menu labels.
- Future persisted notifications should use a backend API and a dedicated business hook.