import { Navigate } from "react-router-dom"; import { useAuth } from "../context/AuthContext"; interface Props { children: React.ReactNode; roles?: string[]; } /** * Wrapper that redirects to `/login` when the user is not authenticated. * Optionally restricts access to specific roles (admins always pass). */ export default function ProtectedRoute({ children, roles }: Props) { const { isAuthenticated, isLoading, user } = useAuth(); if (isLoading) { return (