feat: implement auth, projects, and frontend foundation

This commit is contained in:
2026-05-17 20:21:55 +00:00
parent e7819bfc82
commit 71d9fe6406
88 changed files with 10936 additions and 47 deletions
@@ -0,0 +1,19 @@
import { Navigate, useLocation } from "react-router-dom";
import { useAuth } from "../state/auth";
export const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
const { state } = useAuth();
const location = useLocation();
if (state === "loading") {
return <div className="center-screen">Checking session...</div>;
}
if (state === "unauthenticated") {
const nextPath = encodeURIComponent(location.pathname);
return <Navigate to={`/login?next=${nextPath}`} replace />;
}
return <>{children}</>;
};