Page MenuHomePhabricator

[native] introduce UserProfileRelationshipButton
ClosedPublic

Authored by ginsu on Sep 21 2023, 10:57 AM.
Tags
None
Referenced Files
F3511036: D9258.id31464.diff
Sat, Dec 21, 1:17 PM
Unknown Object (File)
Fri, Dec 13, 10:02 AM
Unknown Object (File)
Mon, Nov 25, 9:16 AM
Unknown Object (File)
Sun, Nov 24, 8:34 PM
Unknown Object (File)
Fri, Nov 22, 4:48 AM
Unknown Object (File)
Fri, Nov 22, 4:30 AM
Unknown Object (File)
Nov 22 2024, 3:06 AM
Unknown Object (File)
Nov 21 2024, 10:26 PM
Subscribers

Details

Summary

This diff introduces the UserProfileRelationshipButton component that will be rendered on a user profile. This button will be used to do relationship actions such as sending/withdrawing a friend request and accepting/rejecting a friend request between the viewer and the user of the profile

Figma designs:
Sending/withdrawing friend request:

Screenshot 2023-09-21 at 2.03.59 PM.png (1×1 px, 241 KB)

Accepting/rejecting friend request:

Screenshot 2023-09-21 at 2.02.28 PM.png (1×1 px, 183 KB)

Friends:

Screenshot 2023-09-21 at 2.04.07 PM.png (1×692 px, 109 KB)

block in either direction is active:

Screenshot 2023-09-22 at 4.25.11 PM.png (1×720 px, 124 KB)

Depends on D9252

Test Plan

Please see the demo videos/screenshots below:

Sending/withdrawing friend request:

Accepting/rejecting friend request/friends:

anonymous user:

Screenshot 2023-09-20 at 4.49.07 PM.png (1×1 px, 750 KB)

block in either direction is active:

Screenshot 2023-09-22 at 4.15.11 PM.png (1×1 px, 732 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: atul, inka.
ginsu added inline comments.
native/components/user-profile-relationship-button.react.js
21–22 ↗(On Diff #31348)

I broke down the prop types down instead of using PendingPersonalThreadUserInfo here. This was some feedback I got from @kamil in an older diff. I also personally think it makes it more readable and super clear to any dev that this is exactly what is needed for this component, but happy to change this if others think otherwise

native/components/user-profile.react.js
87–89 ↗(On Diff #31348)

This is for the case if we view an anonymous profile

native/components/user-profile-relationship-button.react.js
20–23 ↗(On Diff #31378)

I broke down the prop types down instead of using PendingPersonalThreadUserInfo here. This was some feedback I got from @kamil in an older diff. I also personally think it makes it more readable and super clear to any dev that this is exactly what is needed for this component, but happy to change this if others think otherwise

native/components/user-profile.react.js
93–95 ↗(On Diff #31378)

This is for the case if we view an anonymous profile or there is block active in either direction

Looks good, only thing I'd change before landing is trying to avoid the one-off spacer.

native/components/user-profile-relationship-button.react.js
20–23 ↗(On Diff #31378)

Makes sense, also allows for more fine-grained memoization in the future (if needed)

40–75 ↗(On Diff #31378)

Given how much of the "volume" of this component is defining styles for addFriendButton and withdrawFriendRequestButton, might be worth factoring out into separate RelationshipButton component? Just a loose thought

83–143 ↗(On Diff #31378)

Can we wrap in useMemo

Also feedback above about separating common JSX into separate component would make this less verbose, could be something like:

58465c.png (870×1 px, 173 KB)

102 ↗(On Diff #31378)

Can we use flexbox/padding/margin/etc to avoid having a one-off spacer view here?

This revision is now accepted and ready to land.Sep 26 2023, 12:16 PM

rebasing (still need to address @atul's feedback)

native/components/user-profile-relationship-button.react.js
40–75 ↗(On Diff #31378)