import { Center, Loader } from "@mantine/core";
import { App } from "./App";
import { useAuth } from "./auth";
import { LoginPage } from "./components/LoginPage";

export function Root() {
  const { user, loading } = useAuth();
  if (loading) {
    return (
      <Center style={{ minHeight: "100vh" }}>
        <Loader />
      </Center>
    );
  }
  if (!user) return <LoginPage />;
  return <App />;
}
