/** * Protected Route Component */ import React from 'react'; import { Navigate } from 'react-router-dom'; import { useAuth } from '../hooks'; interface ProtectedRouteProps { children: React.ReactNode; adminOnly?: boolean; } export const ProtectedRoute: React.FC = ({ children, adminOnly = false }) => { const { isAuthenticated, user, isLoading } = useAuth(); if (isLoading) { return (

Loading...

); } if (!isAuthenticated) { return ; } if (adminOnly && user?.role !== 'admin') { return ; } return <>{children}; };