diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-11-05 15:52:09 -0800 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-11-05 15:52:09 -0800 |
| commit | 8052754a4bcc3d07208d11aad764d2bb3492166d (patch) | |
| tree | cd12af3d27ffa124bb3a64c29cbc44e3c2b8ce08 /frontend/src/pages/Profile.tsx | |
| parent | 44606b2c510bb327982f60506fc0c968a51b6e80 (diff) | |
add profile page to navbar
Diffstat (limited to 'frontend/src/pages/Profile.tsx')
| -rw-r--r-- | frontend/src/pages/Profile.tsx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/frontend/src/pages/Profile.tsx b/frontend/src/pages/Profile.tsx index 83aa701..8a78fcf 100644 --- a/frontend/src/pages/Profile.tsx +++ b/frontend/src/pages/Profile.tsx @@ -30,7 +30,7 @@ interface UserData { const Profile = () => { const { user, isLoading, logout } = useAuth(); - const targetUser = + let targetUser = new URLSearchParams(window.location.search).get("userId") || ""; // looking at profile of this user const navigate = useNavigate(); const [fetchingHeatmapData, setFetchingHeatmapData] = useState(true); @@ -101,14 +101,15 @@ const Profile = () => { } }, [targetUser]); - if (!targetUser) { - navigate("/"); - } - if (!user) { return <SessionExpiredPopup />; } + if (!targetUser) { + targetUser = user.id.toString(); + } + + if (isLoading || fetchingHeatmapData || fetchingUserData) { return <LoadingDisplay message="Loading Profile Page..." />; } @@ -129,7 +130,7 @@ const Profile = () => { return ( <div className="min-h-screen bg-slate-950"> - <NavBar user={user} handleLogout={handleLogout} currentPage="" /> + <NavBar user={user} handleLogout={handleLogout} currentPage="profile" /> {/* Main Content */} <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4 sm:py-8"> |
