Skip to content

[UI] Fix Navbar to Show User Profile When Signed In #37

@laurenwu22

Description

@laurenwu22

Objective
When a user is signed in, the navbar should display their profile avatar with a dropdown menu. When not signed in, the navbar should show a Login option.

Tasks

  • Integrate useSession from next-auth/react into Navbar.tsx
  • Conditionally render navbar content based on authentication state:
    • Unauthenticated: show Login link (existing behavior)
    • Authenticated
      • Hide Login link
      • Display the user’s profile image
      • Make the avatar clickable to open a dropdown menu
  • Implement dropdown menu actions:
    • Go to Profile → navigates to /user-page
    • Sign out → calls signOut from nextauth
  • Ensure behavior works for desktop nav and mobile hamburger menu

Acceptance Criteria

  • ✅ Navbar correctly detects authentication state using NextAuth session
  • ✅ Logged-out users see a Login link
  • ✅ Logged-in users see their profile picture instead of Login
  • ✅ Clicking the profile picture opens a menu with:
    • Go to Profile
    • Sign Out
  • ✅ Sign out successfully clears the session and updates the navbar
  • ✅ Mobile and desktop nav both behave correctly

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions