Skip to content

Fix 155 Added small profile popup on hovering profile icon#167

Open
DeveloperAmrit wants to merge 2 commits intoAOSSIE-Org:mainfrom
DeveloperAmrit:fix-155-profile-popup
Open

Fix 155 Added small profile popup on hovering profile icon#167
DeveloperAmrit wants to merge 2 commits intoAOSSIE-Org:mainfrom
DeveloperAmrit:fix-155-profile-popup

Conversation

@DeveloperAmrit
Copy link
Contributor

@DeveloperAmrit DeveloperAmrit commented Jan 1, 2026

Fixes #155 half part only, added a small popup to appear when clicked on profile icon. The popup contains disaplay name, user id, email, rating and logout option.

image

Summary by CodeRabbit

  • New Features
    • Added user profile menu in the header displaying user information (name, email, ID, rating, and avatar)
    • Added Sign out button accessible from the profile menu for quick logout

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 1, 2026

📝 Walkthrough

Walkthrough

The Header component now includes a user profile popover that displays user information (avatar, name, email, ID, rating) fetched from global state and auth context, with a sign-out button. The avatar is interactive and replaces the previously static implementation while preserving existing layout for notifications and responsive drawer.

Changes

Cohort / File(s) Summary
Header Profile Panel
frontend/src/components/Header.tsx
Added authentication context and user state integration. Replaced static avatar with Popover-triggered interactive avatar displaying user info panel (avatar, name, email, ID, rating). Implemented sign-out button calling auth?.logout(). Avatar rendering updated to use user?.avatarUrl with fallback. Maintains existing notification bell icon and responsive drawer layout.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hop hop, the profile now pops!
A popover blooms when avatar stops,
User data gleams with a sign-out bop,
Auth flows smooth—no more static props!

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The code implements the profile icon popup requirement from issue #155 with user info and logout functionality, but does not address the notification system requirement also mentioned in that issue. The notification system for comments, badges, tournaments, and leaderboard updates mentioned in issue #155 is not implemented. Either implement notification functionality or clarify that it will be addressed in a separate PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a profile popup feature when the profile icon is clicked, matching the primary modification in Header.tsx.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the profile popup feature from issue #155; no unrelated modifications are present in the changeset.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
frontend/src/components/Header.tsx (1)

115-122: Add error handling and loading state for logout action.

The logout button currently has no error handling or loading state. Consider:

  1. Adding a loading spinner or disabled state while logout is in progress
  2. Handling and displaying errors if logout fails
  3. Adding user feedback (e.g., toast notification) on successful logout
🔎 Example enhancement with loading state

Add state for loading:

const [isLoggingOut, setIsLoggingOut] = useState(false);

Update the button:

                <button
-                  onClick={() => auth?.logout()}
+                  onClick={async () => {
+                    try {
+                      setIsLoggingOut(true);
+                      await auth?.logout();
+                    } catch (error) {
+                      console.error('Logout failed:', error);
+                      // Show error toast/message
+                    } finally {
+                      setIsLoggingOut(false);
+                    }
+                  }}
+                  disabled={isLoggingOut}
-                  className="w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 hover:bg-red-50 rounded-md transition-colors"
+                  className="w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 hover:bg-red-50 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
                >
-                  <LogOut className="w-4 h-4" />
-                  Sign out
+                  <LogOut className="w-4 h-4" />
+                  {isLoggingOut ? 'Signing out...' : 'Sign out'}
                </button>
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f8db72 and 560e9e0.

📒 Files selected for processing (1)
  • frontend/src/components/Header.tsx
🔇 Additional comments (3)
frontend/src/components/Header.tsx (3)

1-11: LGTM! Clean imports.

All new imports are properly utilized in the component for the user profile popover feature.


78-124: Note: Implementation differs from PR description (click vs hover).

The PR title and commit message state "on hovering profile icon", but the implementation uses a click interaction via Popover component. While this is actually better UX (click provides more control, is mobile-friendly, and follows industry standards), the description should be updated to accurately reflect the implementation.


26-27: No action required. The code correctly accesses AuthContext.logout() and all user properties (avatarUrl, displayName, email, id, rating). These are properly defined in AuthContextType and the User type, with appropriate optional chaining used throughout for null safety.

Comment on lines 78 to 87
<Popover>
<PopoverTrigger asChild>
<button className="focus:outline-none">
<img
src={user?.avatarUrl || avatarImage}
alt="User avatar"
className="w-8 h-8 rounded-full border-2 border-gray-300 object-cover cursor-pointer hover:opacity-80 transition-opacity"
/>
</button>
</PopoverTrigger>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove focus:outline-none or add custom focus indicator for accessibility.

The focus:outline-none class on line 80 removes the keyboard focus indicator, making it impossible for keyboard users to see which element is focused. This violates WCAG 2.4.7 (Focus Visible) and creates an accessibility barrier.

🔎 Proposed fix
-              <button className="focus:outline-none">
+              <button className="focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 rounded-full">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Popover>
<PopoverTrigger asChild>
<button className="focus:outline-none">
<img
src={user?.avatarUrl || avatarImage}
alt="User avatar"
className="w-8 h-8 rounded-full border-2 border-gray-300 object-cover cursor-pointer hover:opacity-80 transition-opacity"
/>
</button>
</PopoverTrigger>
<Popover>
<PopoverTrigger asChild>
<button className="focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 rounded-full">
<img
src={user?.avatarUrl || avatarImage}
alt="User avatar"
className="w-8 h-8 rounded-full border-2 border-gray-300 object-cover cursor-pointer hover:opacity-80 transition-opacity"
/>
</button>
</PopoverTrigger>
🤖 Prompt for AI Agents
In frontend/src/components/Header.tsx around lines 78 to 87, the button uses the
class "focus:outline-none" which removes the keyboard focus indicator; remove
that class or replace it with an accessible focus style (for example use
Tailwind focus-visible:ring/focus-visible:ring-offset and a visible ring color
or restore the default outline) so keyboard users can see focus; ensure the
chosen focus style has sufficient contrast and persists on keyboard navigation
(test with Tab) and keep the rest of the markup unchanged.

Comment on lines 102 to 107
<div className="flex justify-between text-sm">
<span className="text-gray-500">User ID</span>
<span className="font-mono text-xs bg-gray-100 px-2 py-0.5 rounded text-gray-700 truncate max-w-[150px]" title={user?.id}>
{user?.id || "N/A"}
</span>
</div>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Consider privacy implications of displaying User ID.

Displaying the full user ID (line 104-106) in the profile popup might expose sensitive information. While users are viewing their own ID, consider whether this information needs to be prominently displayed or if it could be moved to a dedicated profile settings page.

🤖 Prompt for AI Agents
In frontend/src/components/Header.tsx around lines 102 to 107, the profile popup
currently displays the full user ID which may expose sensitive information;
remove or minimize exposure by replacing the visible full ID with either a
masked version (e.g., show first/last 4 chars with ellipsis) or move the full ID
out of the popup into a dedicated profile/settings page; keep an accessible
title or tooltip only if necessary and ensure the rendered value falls back to
"N/A" when absent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing feature: Profile icon and notification bell is not working

1 participant