import { Navigate, useLocation } from 'react-router-dom' import type { ReactNode } from 'react' import { Spinner } from '../components/ui' import { STUDENT_ROUTES } from '../lib/routes' import { useStudentAuth } from './StudentAuthContext' /** * Trasa kursanta. Niezalogowany trafia na logowanie Akademii. * * Zabezpieczenie interfejsu, nie zastepuje regul po stronie backendu. * Backend i tak odrzuci zadanie bez tokenu kursanta, a token panelu nie * otworzy /api/academy/**. */ export function RequireStudent({ children }: { children: ReactNode }) { const { student, loading } = useStudentAuth() const location = useLocation() if (loading) { return (