+
{links.map((link) => (
))}
+ {isAuthenticated && (
+ <>
+ {user?.name || user?.email}
+
+ >
+ )}
{/* Mobile Toggle */}
@@ -88,6 +114,21 @@ export default function Navbar() {
{link.name}
))}
+ {isAuthenticated && (
+ <>
+
{user?.name || user?.email}
+
+ >
+ )}
)}
diff --git a/frontend/src/components/ProtectedRoute.jsx b/frontend/src/components/ProtectedRoute.jsx
new file mode 100644
index 0000000..a3305b8
--- /dev/null
+++ b/frontend/src/components/ProtectedRoute.jsx
@@ -0,0 +1,20 @@
+import { Navigate } from "react-router-dom";
+import { useAuth } from "../context/AuthContext";
+import { ClipLoader } from "react-spinners";
+
+const ProtectedRoute = ({ children }) => {
+ const { isAuthenticated, loading } = useAuth();
+ if (loading) {
+ return (
+