import React, { useContext } from "react"; import { Navigate } from "react-router-dom"; import { AuthContext } from "../context/AuthContext"; const AdminRoute = ({ children }) => { const { auth } = useContext(AuthContext); // Show loading state while checking authentication if (auth.loading) { return (