nodejs.org icon indicating copy to clipboard operation
nodejs.org copied to clipboard

feat: Introducing avatar tooltip

Open canerakdas opened this issue 1 year ago • 3 comments

Description

I saw it in Slack (OpenJS Foundation) threads and thought it was a good way to support contributors

With this PR, the Tooltip component was created and minor refactors were made to Avatar and AvatarGroup components. In addition, the WithAvatarGroup component was created to make avatars easier to manage to simplify the process

I took care to use the elements/components in the existing design system as a design, I was inspired by (Search typing) in the Figma for the Tooltip component;

https://www.figma.com/design/pu1vZPqNIM7BePd6W8APA5/Node.js?node-id=464-6397&node-type=frame&t=dj6OGYBZLLo5cp4z-0

Validation

  • Avatars should continue to work as it is.
  • A tooltip should appear for users in authors.json whose website field is exist

Example screenshot; image

image

Related Issues

Related to #7141

Check List

  • [x] I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • [x] I have run npm run format to ensure the code follows the style guide.
  • [x] I have run npm run test to check if all tests are passing.
  • [x] I have run npx turbo build to check if the website builds without errors.
  • [x] I've covered new added functionality with unit tests if necessary.

canerakdas avatar Oct 25 '24 22:10 canerakdas

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

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Nov 18, 2024 3:04pm

vercel[bot] avatar Oct 25 '24 22:10 vercel[bot]

Does it work on mobile? I've tried from my iphone and it didn't work from the preview.

mcollina avatar Oct 26 '24 07:10 mcollina

After some test on desktop few point:

  • For the learn section, all the authors have a GitHub username, so there's no need to go into the authors.json file.
  • For the blog section, we'd have to try and standardise the data so that eventually it's just GitHub usernames. To reduce the complexity of things
  • Like Matteo said need to found something for mobile

AugustinMauroy avatar Oct 26 '24 09:10 AugustinMauroy

Does it work on mobile? I've tried from my iphone and it didn't work from the preview.

This is the design choice of the radix tooltip component I use, and IMO it is the right choice (https://github.com/radix-ui/primitives/issues/955#issuecomment-960610209)

Here, as an alternative, it may be better to redirect directly when a profile image is clicked on mobile (like GitHub), but the current profile images are too small for mobile resolution, I will check the accessibility and try to implement a better solution👍

canerakdas avatar Oct 26 '24 22:10 canerakdas

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 95 🟢 100 🟢 100 🟢 92 🔗
/en/download 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 92 🔗

github-actions[bot] avatar Oct 27 '24 11:10 github-actions[bot]

Does it work on mobile? I've tried from my iphone and it didn't work from the preview.

This is the design choice of the radix tooltip component I use, and IMO it is the right choice (radix-ui/primitives#955 (comment))

Here, as an alternative, it may be better to redirect directly when a profile image is clicked on mobile (like GitHub), but the current profile images are too small for mobile resolution, I will check the accessibility and try to implement a better solution👍

IMO, double can do the job and increase little bit the size of the avatar for mobile

AugustinMauroy avatar Oct 27 '24 11:10 AugustinMauroy

@canerakdas can you resolve the conflicts? 👀

ovflowd avatar Oct 28 '24 21:10 ovflowd

FYI I think we should ditch the authors.json and use the GitHub user API to retrieve their profiles from username.

Then we just cache on the server side the resolution of the profile metadata :)

That can be within a follow-up PR btw, but would love that!

ovflowd avatar Oct 30 '24 16:10 ovflowd

FYI I think we should ditch the authors.json and use the GitHub user API to retrieve their profiles from username.

Then we just cache on the server side the resolution of the profile metadata :)

That can be within a follow-up PR btw, but would love that!

noted that there are authors who are not GitHub users ‘nodejs project ...’ those can remain in a constant

AugustinMauroy avatar Oct 30 '24 18:10 AugustinMauroy

FYI I think we should ditch the authors.json and use the GitHub user API to retrieve their profiles from username.

Then we just cache on the server side the resolution of the profile metadata :)

That can be within a follow-up PR btw, but would love that!

noted that there are authors who are not GitHub users ‘nodejs project ...’ those can remain in a constant

True, authors.json can be a fallback file 🤷

ovflowd avatar Oct 30 '24 18:10 ovflowd

FYI I think we should ditch the authors.json and use the GitHub user API to retrieve their profiles from username.

Then we just cache on the server side the resolution of the profile metadata :)

That can be within a follow-up PR btw, but would love that!

noted that there are authors who are not GitHub users ‘nodejs project ...’ those can remain in a constant

True, authors.json can be a fallback file 🤷

Sounds great! I'd love to add it, but I think this PR has already affected a lot of places. I'm in favor of creating a follow-up PR to this PR and working on it 🙇

canerakdas avatar Oct 30 '24 20:10 canerakdas

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 92%
90.66% (631/696) 72.58% (188/259) 94.48% (120/127)

Unit Test Report

Tests Skipped Failures Errors Time
137 0 :zzz: 0 :x: 0 :fire: 5.335s :stopwatch:

github-actions[bot] avatar Oct 30 '24 21:10 github-actions[bot]

Sounds great! I'd love to add it, but I think this PR has already affected a lot of places. I'm in favor of creating a follow-up PR to this PR and working on it 🙇

considering the complexity of this, should we consider this approach vs #7142 ??

bmuenzenmeyer avatar Oct 31 '24 12:10 bmuenzenmeyer

image

A bit broken in some scenarios. (https://nodejs-org-git-fork-canerakdas-feat-avatar-tooltip-openjs.vercel.app/en/blog/all/page/120)

ovflowd avatar Nov 02 '24 15:11 ovflowd

Also wondering if we can extract the usernames?

image

ovflowd avatar Nov 02 '24 15:11 ovflowd

@canerakdas on mobile clicking on the picture opens the profile, I think with the thumbnails clicking should not open the profile directly anymore, IMO.

ovflowd avatar Nov 02 '24 16:11 ovflowd

A bit broken in some scenarios. (https://nodejs-org-git-fork-canerakdas-feat-avatar-tooltip-openjs.vercel.app/en/blog/all/page/120)

I didn't see that, thanks!

Also wondering if we can extract the usernames?

Extracted the usernames here

@canerakdas on mobile clicking on the picture opens the profile, I think with the thumbnails clicking should not open the profile directly anymore, IMO.

I removed the redirect/tooltip here, it makes more sense to have it on the detail pages 🙇


Also, the tooltip is visible in the changelog modal, but it's not clickable, I am working on the fixing this issue 🤔

canerakdas avatar Nov 02 '24 20:11 canerakdas

Sounds great! I'd love to add it, but I think this PR has already affected a lot of places. I'm in favor of creating a follow-up PR to this PR and working on it 🙇

considering the complexity of this, should we consider this approach vs #7142 ??

I think it's more like approaches that are a continuation of each other rather than approaches that are against each other 🤔

canerakdas avatar Nov 02 '24 20:11 canerakdas

I think we can show the full list of contributors instead only the first few:

Screenshot 2024-11-03 at 10 49 36

Also, it would be better to display all of them immediately instead of limiting to the first few. There is space, at least in the desktop variant.

Screenshot 2024-11-03 at 10 50 06

mcollina avatar Nov 03 '24 09:11 mcollina

I think we can show the full list of contributors instead only the first few:

Screenshot 2024-11-03 at 10 49 36 Also, it would be better to display all of them immediately instead of limiting to the first few. There is space, at least in the desktop variant. Screenshot 2024-11-03 at 10 50 06

Maybe show full list if you click the +13?

ovflowd avatar Nov 03 '24 11:11 ovflowd

I agree with @mcollina that it would be better to show all contributors/authors, but it is not possible with the current design since we are listing them in a single line 🙇

I tried to show the maximum avatar we can display for desktop and mobile resolutions. Sample screenshots are as follows;

Desktop

image

Small Desktop / Tablet

image

Mobile

image

canerakdas avatar Nov 05 '24 20:11 canerakdas

Hey @canerakdas can we hold this PR until I get the Next.js 15 PR done? 🙏 -- I also still want to provide code review here 🫡

ovflowd avatar Nov 09 '24 00:11 ovflowd

FYI Next.js v15 has landed, so feel free to continue development on this.

avivkeller avatar Nov 16 '24 03:11 avivkeller

Awesome work here, @canerakdas, thank you so much!! <3 <3

ovflowd avatar Nov 18 '24 16:11 ovflowd

Awesome work here, @canerakdas, thank you so much!! <3 <3

yeah it's super cool !

thanks @canerakdas !

AugustinMauroy avatar Nov 18 '24 16:11 AugustinMauroy