import { Navigate, Outlet, useLocation } from "react-router-dom"; import type { UserRole } from "@/lib/auth"; import { useAuth } from "@/hooks/useAuth"; type ProtectedRouteProps = { allowedRoles?: UserRole[]; }; export function ProtectedRoute({ allowedRoles }: ProtectedRouteProps) { const { isAuthenticated, role, dashboardPath } = useAuth(); const location = useLocation(); if (!isAuthenticated) { return ( ); } if (allowedRoles && !allowedRoles.includes(role)) { return ; } return ; }