Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved Issue [#1742] Implemented MUI Tooltip for the UserAvatar com… #1743

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nitverse
Copy link

@nitverse nitverse commented Jan 6, 2024

Description

Implemented MUI Tooltip in the UserAvatar component, enhancing the user experience by displaying the user's name on hover.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Cypress integration
  • Cypress component tests
  • Jest unit tests

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

…Avatar component, displays the user's name on hover.
@dadiorchen dadiorchen requested a review from DylanJG01 January 8, 2024 09:22
@dadiorchen
Copy link
Collaborator

@nitverse thank you for you contribution, can you fix the eslint error in the ci:
image

Copy link
Member

@DylanJG01 DylanJG01 left a comment

Choose a reason for hiding this comment

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

The most pressing concern is fixing the tooltip to appear above the header.


function UserAvatar({ auth }) {
if (!auth?.isAuthenticated) {
return null;
}

const userName = auth?.user?.profile.preferred_username[0] || null;
Copy link
Member

Choose a reason for hiding this comment

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

I think userName should be set to auth?.user?.profile.preferred_username || null.
That way, when you highlight the tooltip--which is currently just the first letter of their username--it will give new information, instead of repeating information the user already has.

}}
>
<Avatar
<Tooltip title={userName} arrow>
Copy link
Member

Choose a reason for hiding this comment

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

Currently the arrow tooltip will show up behind the header/banner of the website. This is likely due to the header having a z-index of '9999'.

Screenshot 2024-01-30 191156

I am hesitant to suggest changing the header zindex to anything lower in the event it ruins the format in some place I'm unaware of. I am open to suggestions or ideas. @dadiorchen ?

color: ({ palette }) => palette.text.contrast,
}}
>
{userName}
Copy link
Member

Choose a reason for hiding this comment

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

We can change this to {userName ? userName[0] : null} to conform with the idea on line 8.

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.

3 participants