+
{/* Success Popup */}
@@ -1162,4 +1162,4 @@ const Profile = () => {
);
};
-export default Profile;
\ No newline at end of file
+export default Profile;
diff --git a/frontend/src/Components/ui/floating-navbar.tsx b/frontend/src/Components/ui/floating-navbar.tsx
index 6be4f25..b25b4dc 100644
--- a/frontend/src/Components/ui/floating-navbar.tsx
+++ b/frontend/src/Components/ui/floating-navbar.tsx
@@ -1,6 +1,7 @@
"use client";
import React, { JSX, useState } from "react";
-import { useNavigate } from "react-router-dom";
+// Import Link to handle internal routing
+import { useNavigate, Link } from "react-router-dom";
import {
motion,
AnimatePresence,
@@ -12,6 +13,8 @@ import { cn } from "@/lib/utils";
export const FloatingNav = ({
navItems,
className,
+ isAuthenticated, // <-- ADDED PROP
+ handleLogout, // <-- ADDED PROP
}: {
navItems: {
name: string;
@@ -19,9 +22,10 @@ export const FloatingNav = ({
icon?: JSX.Element;
}[];
className?: string;
+ isAuthenticated?: boolean; // <-- ADDED PROP TYPE
+ handleLogout?: () => void; // <-- ADDED PROP TYPE
}) => {
const { scrollYProgress } = useScroll();
-
const [visible, setVisible] = useState(false);
const navigate = useNavigate();
@@ -57,30 +61,67 @@ export const FloatingNav = ({
duration: 0.2,
}}
className={cn(
- "flex max-w-fit fixed top-10 inset-x-0 mx-auto border border-transparent dark:border-white/[0.2] rounded-full dark:bg-black bg-white shadow-[0px_2px_3px_-1px_RGBA(0,0,0,0.1),0px_1px_0px_0px_RGBA(25,28,33,0.02),0px_0px_0px_1px_RGBA(25,28,33,0.08)] z-[5000] pr-2 pl-8 py-2 items-center justify-center space-x-4",
+ "flex max-w-fit fixed top-10 inset-x-0 mx-auto border border-transparent dark:border-white/[0.2] rounded-full dark:bg-black bg-white shadow-[0px_2px_3px_-1px_RGBA(0,0,0,0.1),0px_1px_0px_0px_RGBA(25,28,33,0.02),0px_0px_0px_1px_RGBA(25,28,33,0.08)] z-[5000] pr-2 pl-8 py-2 items-center justify-center space-x-4",
className
)}
>
- {navItems.map((navItem: any, idx: number) => (
-
{
+ // Check if link is external or an anchor
+ const isExternal =
+ navItem.link.startsWith("http") || navItem.link.startsWith("#");
+
+ const content = (
+ <>
+ {navItem.icon}
+ {navItem.name}
+
+ >
+ );
+
+ const itemClassName = "relative text-[15px] md:text-[16px] lg:text-[17px] font-medium transition-all duration-300 group flex items-center gap-2 hover:pb-1";
+
+ // Use for external/anchor links, for internal links
+ return isExternal ? (
+
+ {content}
+
+ ) : (
+
+ {content}
+
+ );
+ })}
+
+ {/* --- MODIFIED SECTION: Conditional Login/Logout Button --- */}
+ {isAuthenticated ? (
+
+ ) : (
+
navigate("/login")}
+ className="border text-sm font-medium relative border-neutral-200 dark:border-white/[0.2] text-black dark:text-white px-4 py-2 rounded-full hover:bg-neutral-100 dark:hover:bg-neutral-800 hover:cursor-pointer transition-colors"
+ >
+ Login
+
+
+ )}
+ {/* --- END OF MODIFIED SECTION --- */}
);
-};
+};
\ No newline at end of file