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

72 lines
1.6 KiB
TypeScript

import type { CampusId, CampusInfo } from '@/shared/types/app';
import type { UserRole } from '@/shared/types/app';
import type { AuthModalDraft, AuthSignupStep } from '@/business/auth/types';
export function validateSignupStepOne(draft: AuthModalDraft): string | null {
if (!draft.fullName.trim()) {
return 'Please enter your full name';
}
if (!draft.email.trim() || !draft.email.includes('@')) {
return 'Please enter a valid email address';
}
if (draft.password.length < 6) {
return 'Password must be at least 6 characters';
}
if (draft.password !== draft.confirmPassword) {
return 'Passwords do not match';
}
return null;
}
export function getNextSignupStep(step: AuthSignupStep): AuthSignupStep {
if (step === 1) {
return 2;
}
if (step === 2) {
return 3;
}
return 3;
}
export function getPreviousSignupStep(step: AuthSignupStep): AuthSignupStep {
if (step === 3) {
return 2;
}
if (step === 2) {
return 1;
}
return 1;
}
export function getSignupCampusName(campus: CampusId | '', campuses: readonly CampusInfo[]): string | null {
if (!campus) {
return null;
}
const selectedCampus = campuses.find((item) => item.id === campus);
return selectedCampus?.mascot || campus;
}
export function getAuthRoleLabel(role: UserRole): string {
switch (role) {
case 'teacher':
return 'Teacher';
case 'para':
return 'Support Staff';
case 'office':
return 'Office Manager';
case 'director':
return 'Director';
case 'superintendent':
return 'Superintendent';
}
}