Page MenuHomePhabricator

[web] introduce UserAvatar component
ClosedPublic

Authored by ginsu on Apr 2 2023, 10:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 4:32 AM
Unknown Object (File)
Thu, Nov 7, 4:32 AM
Unknown Object (File)
Thu, Nov 7, 4:32 AM
Unknown Object (File)
Wed, Nov 6, 3:26 AM
Unknown Object (File)
Tue, Nov 5, 10:22 PM
Unknown Object (File)
Sun, Oct 27, 1:08 AM
Unknown Object (File)
Oct 11 2024, 11:36 PM
Unknown Object (File)
Oct 4 2024, 8:49 PM
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
No Lint Coverage
Unit
No Test Coverage

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.