// src/components/AdminRoute.tsx import React from 'react'; import { Navigate, Outlet } from 'react-router-dom'; import type { Profile } from '../types'; export interface AdminRouteProps { profile: Profile | null; } export const AdminRoute: React.FC = ({ profile }) => { // An admin is identified by the 'admin' role in their profile. const isAdmin = profile?.role === 'admin'; if (!isAdmin) { return ; } return ; };