/** * Protected Route Component * Redirects to login if user is not authenticated */ import { Navigate, useLocation } from 'react-router-dom'; import { isAuthenticated } from '../utils/auth'; interface ProtectedRouteProps { children: React.ReactNode; } export default function ProtectedRoute({ children }: ProtectedRouteProps) { const location = useLocation(); if (!isAuthenticated()) { // Redirect to login, preserving the attempted location return ; } return <>{children}; }