import type { PropsWithChildren } from 'react';
import { useAuth } from '../hooks/useAuth';

export default function ProtectedRoute({ children }: PropsWithChildren) {
  const { isLoading } = useAuth();

  if (isLoading) {
    return (
      <div style={{ display: 'grid', placeItems: 'center', minHeight: '30vh' }} aria-busy="true">
        <progress />
      </div>
    );
  }

  return <>{children}</>;
}
