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

feat: [M3-8158] - Begin to sunset Gravatar #10859

Merged

Conversation

mjac0bs
Copy link
Contributor

@mjac0bs mjac0bs commented Aug 29, 2024

Description 📝

This is the first step in the two step process of sunsetting Gravatar. It adds new components and replaces the default icons for users currently without Gravatar with new avatars. For users with Gravatars, nothing changes yet except for an info dismissible banner informing Gravatar support will be sunset two weeks from the time this is released.

Changes 🔄

  • Creates a few new components:
    • ColorPicker component based on the native HTML ColorPicker
    • Avatar component to render a custom background color (stored in local storage) and first initial of username
      • Proxy avatars remain the same as in Parent/Child, but system events by Akamai/Linode have a default color and wave logo
    • AvatarColorPickerDialog to change the background color from its default
  • Updates the Profile Display page to allow users without Gravatars to use the AvatarColorPickerDialog
  • Conditionally renders the new Avatar component for users without Gravatars in the following places:
    • Top Menu
    • Notification Center Event
    • Events Landing > Event Table Row
    • User Landing > User Table Row
    • User SSH Key Panel
    • Profile Display
    • Support Ticket Details
  • Displays a global gravatar sunsetting banner for users with Gravatars only
  • Adds unit tests for new Avatar and AvatarColorPickerDialog components; updates EventRow unit test for changes
  • Adds Storybook stories for Avatar and ColorPicker components

Target release date 🗓️

09/16/24

Preview 📷

Gravatar Non-Gravatar
Screenshot 2024-09-05 at 9 04 19 AM ProfileDisplayv2
More Photos 📸
Before After
ProfileOld Profilev2
NotificationsOld NotificationsNew
EventsOld EventsNew
SSHKeysOld SSHKeysNew
supportOld supportNew
When logged in as another user on an account, the other users will display as the default color and the active user will see their own avatar color from local storage Screenshot 2024-09-11 at 7 28 02 AM Screenshot 2024-09-11 at 7 29 07 AM Screenshot 2024-09-11 at 7 29 50 AM

How to test 🧪

Prerequisites

(How to setup test environment)

  • Have an account with a Gravatar and one without (use a test account if you don't have one without)

Verification steps

(How to verify changes)

  • For an account with a Gravatar:
    • Check the following places and confirm the user's Gravatar is still displayed:
      • Top Menu
      • Notification Center Event
      • Events Landing > Event Table Row
      • User Landing > User Table Row
      • User SSH Key Panel
      • Profile Display
      • Support Ticket Details (test this in dev with a dummy support ticket you comment on)
    • Confirm the sunsetting banner is visible on every page and is dismissible
  • For an account without a Gravatar:
    • Check the following places and confirm the new Avatar component is displayed:
      • Top Menu
      • Notification Center Event
      • Events Landing > Event Table Row
      • User Landing > User Table Row
      • User SSH Key Panel
      • Profile Display
      • Support Ticket Details (test this in dev with a dummy support ticket you comment on)
    • Confirm the sunsetting banner is not visible
    • Confirm that you can Change Avatar Color on http://localhost:3000/profile/display and the changes are reflected everywhere the Avatar is displayed
  • yarn storybook and check the Avatar and ColorPicker stories in Storybook

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@mjac0bs mjac0bs self-assigned this Aug 29, 2024
@mjac0bs mjac0bs force-pushed the M3-8158-replace-gravatar-with-new-avatars branch from 2a5aa36 to ae25868 Compare September 3, 2024 21:33
@mjac0bs mjac0bs force-pushed the M3-8158-replace-gravatar-with-new-avatars branch from 93c8efe to ccea1bd Compare September 5, 2024 14:14
@mjac0bs mjac0bs marked this pull request as ready for review September 5, 2024 15:33
@mjac0bs mjac0bs requested a review from a team as a code owner September 5, 2024 15:34
@mjac0bs mjac0bs removed the request for review from a team September 5, 2024 15:34
Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

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

This is looking great! some improvement can still be made but I really like the placeholder improvement 💅 and code cleanup 🧹

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am confused. This change did fix the CI failure on the test-manager job, which is now passing here, but it was a failure on a component not touched in this PR. There still seems to be something more going on here because Code Coverage / current branch is still failing. Local runs of unit tests don't reproduce errors.

Screenshot 2024-09-10 at 10 05 27 AM

Copy link
Contributor

@abailly-akamai abailly-akamai Sep 10, 2024

Choose a reason for hiding this comment

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

Seeing the same thing here. Test suite passes locally by CI is unhappy

Copy link
Contributor Author

@mjac0bs mjac0bs Sep 10, 2024

Choose a reason for hiding this comment

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

Reverted this change so it can be addressed in its own PR (M3-8559).

Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

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

Great work! Confirmed Avatar/Gravatar behaviors are working as expected and async rendering is handled as best as possible.

Thanks for working with me on improving the flickering issues even if this feels like micro-improvements and who knows, the 2 weeks period may be expended and we have a good UI to support it!

Can't wait to remove a lot of logic related to having to fetch the gravatar and kiss goodbye to this unnecessary burden 👋

Note: fine skipping the the failing test which has become a flake ❄️

Comment on lines +16 to +25
export const GravatarByUsername = (props: GravatarByUsernameProps) => {
const { className, username } = props;
const { data: user } = useAccountUser(username ?? '');
const { data: user, isLoading } = useAccountUser(username ?? '');
const url = user?.email ? getGravatarUrl(user.email) : undefined;

// Render placeholder instead of flashing default user icon briefly
if (isLoading) {
return <Box height={DEFAULT_AVATAR_SIZE} width={DEFAULT_AVATAR_SIZE} />;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Latest change:

Adds isLoading to render a placeholder for GravatarByUsername while we're waiting for the user. This impacts the events landing and notification center gravatars. Without a placeholder here, while the query loaded, we were setting url to undefined, which rendered the default icon briefly and previously had me adding an extra long fade in (>1s) to avoid. With this actual fix, we still slightly (.2s) fade in the gravatar so the transition from loading to the icon is less abrupt.

Between this change and the cache in useGravatar, we shouldn't be seeing anymore flickering, even at slow speeds.

@bnussman-akamai bnussman-akamai added the Approved Multiple approvals and ready to merge! label Sep 11, 2024
@mjac0bs
Copy link
Contributor Author

mjac0bs commented Sep 11, 2024

Going to merge this now. The two failed tests in CI were unrelated and flaky - I've seensmoke-delete-linode.spec.ts and clone-linode.spec.ts pass locally.

@mjac0bs mjac0bs merged commit 3bc6e76 into linode:develop Sep 11, 2024
18 of 19 checks passed
nikhagra-akamai pushed a commit to nikhagra-akamai/manager that referenced this pull request Sep 23, 2024
* Swap out gravatar for colored avatar on Profile > Display

* Add utils to determine letter color

* Bring back checkForGravatar event and fix hasGravatar boolean

* Hide tooltip if user unless user hasGravatar

* Add GravatarSunsetBanner.tsx

* Use util for banner and profile page

* Add Akamai wave icon for Akamai-generated user events

* Clean up of theme colors and conditional rendering

* Style ColorPicker

* Try to handle constrast ratio

* Address UX feedback: show avatar preview in dialog

* Add new avatar to EventRow on Event Landing page

* Conditionally render Gravatar in EventRow until sunset

* Replace gravatar conditionally in UserRow of Users Landing

* Conditionally render styled Avatar in UserSSHKeyPanel

* Conditionally render Avatar in TopMenu; rename GravatarForProxy

* Conditionally render styled Avatar in NotificationCenterEvent

* Fix sunset date

* Use MUI theme function to get contrasting text color

* Clean up; change color default to darker color

* Clean up Avatar, ColorPicker; add stories

* Clean up and add unit tests

* Clean up; fix test

* Forgot to push last changes for Support; default color fix

* Add changesets

* Fix an accidentally skipped test

* Address UX feedback: use 'Avatar' over 'Profile photo'

* Address feedback: avoid regex

* Fix bug: NotificationCenterEvent missing Linode system avatar

* Use hook throughout gravatar replacement

* improve useGravatar hook

* Fix: showing new system/support avatars when user has Gravatar enabled

* Experiment with component for loading/gravatar/avatar

* Handle loading state and fade per-component to fix flickering

* Fix username for support tickets; clean up

* Fix avatar color for additional account users

* Switch over to single GravatarOrAvatar component for rendering

* Clean up commented code

* Use const for default avatar size

* Address feedback: use Map

* Does not using the deprecated function fix the unit tests in CI?

* Revert "Does not using the deprecated function fix the unit tests in CI?"

This reverts commit c373a53.

* Skip failing test with JSDom issues for now

* Improve fading behavior

* Revert "Improve fading behavior" because it causes other issues

This reverts commit 04c0b6b.

* Add GravatarByUsername loading placeholder; adjust other fades

---------

Co-authored-by: Alban Bailly <abailly@akamai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants