Add Google OAuth integration, routing, and theme toggle; implement login and protected routes

This commit is contained in:
ishikabhoyar
2025-10-13 23:51:39 +05:30
parent e8e6011524
commit 453f44a43a
13 changed files with 714 additions and 17 deletions

View File

@@ -0,0 +1,21 @@
import { Navigate } from 'react-router-dom';
import { useAuth } from '../contexts/AuthContext';
const ProtectedRoute = ({ children }) => {
const { isAuthenticated, isLoading } = useAuth();
if (isLoading) {
return (
<div className="min-h-screen flex items-center justify-center bg-black">
<div className="text-center">
<div className="inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-white"></div>
<p className="mt-4 text-white">Loading...</p>
</div>
</div>
);
}
return isAuthenticated ? children : <Navigate to="/login" replace />;
};
export default ProtectedRoute;