import { Navigate, useLocation } from 'react-router-dom' import { useAuthStore } from '@/store/authStore' import { usePermissions, type EffectiveRole } from '@/hooks/usePermissions' interface ProtectedRouteProps { requiredRole?: EffectiveRole children: React.ReactNode } export function ProtectedRoute({ requiredRole, children }: ProtectedRouteProps) { const { isAuthenticated, isLoading } = useAuthStore() const location = useLocation() const { effectiveRole } = usePermissions() if (isLoading) { return (