Page MenuHomePhabricator

[web] introduce UserAvatar component
ClosedPublic

Authored by ginsu on Apr 2 2023, 10:58 PM.
Tags
None
Referenced Files
F3520361: D7273.diff
Mon, Dec 23, 12:08 AM
Unknown Object (File)
Sat, Dec 7, 7:23 AM
Unknown Object (File)
Sat, Dec 7, 7:23 AM
Unknown Object (File)
Sat, Dec 7, 7:23 AM
Unknown Object (File)
Thu, Dec 5, 8:39 PM
Unknown Object (File)
Thu, Dec 5, 8:39 PM
Unknown Object (File)
Nov 16 2024, 8:22 PM
Unknown Object (File)
Nov 7 2024, 4:32 AM
Subscribers

Details

Summary

After some discussion with @ashoat and @atul about how to fetch the ens uri for ens avatars we decided to have two separate components to render avatars: UserAvatar and ThreadAvatar this diff handles UserAvatar

This is also pretty much a copy from D7246

Depends on D7192

Test Plan

I was able to render all three avatar types: Emoji, Image, and ENS

Emoji:

Screenshot 2023-04-03 at 2.03.30 AM.png (2×3 px, 782 KB)

Image (by hardcoding const avatarInfo = { type: 'image', uri: 'https://picsum.photos/200' }):

Screenshot 2023-04-03 at 2.02.52 AM.png (2×3 px, 821 KB)

ENS (by hardcoding const avatarInfo = { type: 'ens' } and the same ensAvatarURI I tested with in D7246):

Screenshot 2023-04-03 at 2.03.52 AM.png (2×3 px, 747 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ginsu edited the test plan for this revision. (Show Details)
ginsu added reviewers: ashoat, atul.
ginsu edited the test plan for this revision. (Show Details)
ginsu requested review of this revision.Apr 2 2023, 11:13 PM

Thanks for testing all those scenarios in the Test Plan. Two questions inline.

web/components/user-avatar.react.js
14 ↗(On Diff #24531)

In what scenario do we expect userID to be null/undefined?

20–23 ↗(On Diff #24531)

Can't we just query for ClientAvatar directly?

This revision is now accepted and ready to land.Apr 3 2023, 10:34 AM
web/components/user-avatar.react.js
14 ↗(On Diff #24531)

The currentUserInfo in the profile screen is of type ?CurrentUserInfo. On the chance that the user experience this case, getAvatarForUser will handle this by returning an anonymous avatar (👤)

20–23 ↗(On Diff #24531)

We want userInfo so that we can use getAvatarForUser and handle cases where the user does not have an avatar already set or they are an anonymous user, but they can still get a ClientAvatar. getAvatarForUser returns a ClientAvatar

ginsu edited the test plan for this revision. (Show Details)

rebase before landing

This revision was automatically updated to reflect the committed changes.