import { StrictMode, type ReactNode } from "react";
import { createRoot } from "react-dom/client";
import { BrowserRouter, Navigate, Route, Routes, useLocation } from "react-router-dom";
import { AppShell } from "./components/Shell";
import { Spinner } from "./components/ui";
import "./index.css";
import { AuthProvider, useAuth } from "./lib/auth";
import { I18nProvider } from "./lib/i18n";
import Applications from "./pages/Applications";
import Apply from "./pages/Apply";
import Board from "./pages/Board";
import CvPage from "./pages/Cv";
import Auth from "./pages/Auth";
import Dashboard from "./pages/Dashboard";
import History from "./pages/History";
import InterviewRoom from "./pages/InterviewRoom";
import JobEditor from "./pages/JobEditor";
import JobDetail from "./pages/JobDetail";
import Jobs from "./pages/Jobs";
import Landing from "./pages/Landing";
import NewInterview from "./pages/NewInterview";
import Onboarding from "./pages/Onboarding";
import ReportPage from "./pages/Report";
import SettingsPage from "./pages/Settings";
// apply the saved theme before first paint
try {
const s = localStorage.getItem("evalbot_theme");
if (s === "dark" || (!s && window.matchMedia("(prefers-color-scheme: dark)").matches)) document.documentElement.classList.add("dark");
} catch {
/* ignore */
}
/** Signed-in pages. `role` keeps company accounts and job seekers in their own parts of the app. */
function Private({ children, bare, role }: { children: ReactNode; bare?: boolean; role?: "candidate" | "recruiter" }) {
const { ready, profile } = useAuth();
const loc = useLocation();
if (!ready) return ;
if (!profile) return ;
if (role && profile.role !== role) return ;
return bare ? <>{children}> : {children};
}
/** The job board is public; signed-in job seekers see it inside the app. */
function JobsPublic() {
const { ready, profile } = useAuth();
if (!ready) return ;
return profile?.role === "candidate" ? : ;
}
createRoot(document.getElementById("root")!).render(
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
,
);