diff --git a/assets/profile.png b/assets/profile.png new file mode 100644 index 0000000..1613774 Binary files /dev/null and b/assets/profile.png differ diff --git a/components/TopBar.tsx b/components/TopBar.tsx index 246941c..a20eaa9 100644 --- a/components/TopBar.tsx +++ b/components/TopBar.tsx @@ -1,11 +1,16 @@ "use client"; +import { useState } from "react"; import { usePathname } from "next/navigation"; import CurrentTime from "./CurrentTime"; import { useAuth } from "@/services/AuthContext"; +import ProfileIcon from '../assets/profile.png'; +import Image from "next/image"; +import { deleteCookie } from "cookies-next"; const TopBar = () => { const { userName } = useAuth(); + const [isDropdownOpen, setIsDropdownOpen] = useState(false); const routeNames: { [key: string]: string } = { '/reports': 'Report', '/library': 'Library', @@ -15,11 +20,34 @@ const TopBar = () => { const pathname = usePathname(); const routeName = routeNames[pathname] ||

Welcome
{userName}

; + const toggleDropdown = () => { + setIsDropdownOpen(!isDropdownOpen); + }; + + const handleLogout = () => { + deleteCookie("access_token"); + deleteCookie("refresh_token"); + window.location.reload(); + }; + return (
-
+
{routeName} +
+ Profile + {isDropdownOpen && ( +
+ +
+ )} +