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

chore: new user avatar tooltip #9050

Merged
merged 3 commits into from
Jan 3, 2025
Merged

chore: new user avatar tooltip #9050

merged 3 commits into from
Jan 3, 2025

Conversation

nunogois
Copy link
Member

@nunogois nunogois commented Jan 2, 2025

https://linear.app/unleash/issue/2-3109/improve-avatar-tooltip

I noticed our current user avatar tooltip is a bit poor.

This PR tries to improve it a bit using only the data we already have available, without any drastic changes.

Before

image

After

image

Other examples after the changes

image

image

image

image

Copy link

vercel bot commented Jan 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2025 10:15am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Jan 3, 2025 10:15am

Copy link
Contributor

github-actions bot commented Jan 2, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

Copy link
Contributor

@thomasheartman thomasheartman left a comment

Choose a reason for hiding this comment

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

Looks good to me 😄 Got a couple small questions and suggestions, but nothing major.

frontend/src/component/common/UserAvatar/UserAvatar.tsx Outdated Show resolved Hide resolved
const StyledTooltipAvatar = styled(Avatar)(({ theme }) => ({
width: theme.spacing(5),
height: theme.spacing(5),
margin: 'auto',
Copy link
Contributor

Choose a reason for hiding this comment

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

out of curiosity: what's the margin auto doing here? Does ... does the avatar have some built-in margins?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure, was a copy paste from the existing styled avatar component.

Comment on lines 33 to 36
backgroundColor: theme.palette.secondary.light,
color: theme.palette.text.primary,
fontSize: theme.fontSizes.smallerBody,
fontWeight: theme.fontWeight.bold,
Copy link
Contributor

Choose a reason for hiding this comment

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

This, presumably, is to handle cases when we put letters instead of images?

Copy link
Contributor

Choose a reason for hiding this comment

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

Which, ... I'm not sure we'll ever do? Because we only show this if we have src or imageurl?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, this made me rethink my approach. I'm now always showing an avatar in the tooltip with whatever content is in the original avatar, which is probably more reasonable and consistent:

image

image

</>
<StyledTooltip>
<ConditionallyRender
condition={Boolean(src || user?.imageUrl)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this condition redundant with the if check above?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also ... are we still using conditionally render? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't this condition redundant with the if check above?

Yep, it was. Good point.

Also ... are we still using conditionally render? 🤔

I don't know, are we? 🤷

I've dropped them in this file in the latest commit.

@nunogois nunogois merged commit 7eced29 into main Jan 3, 2025
11 checks passed
@nunogois nunogois deleted the chore-new-avatar-tooltip branch January 3, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants