Page MenuHomePhabricator

[native] introduce UserProfileRelationshipButton
ClosedPublic

Authored by ginsu on Sep 21 2023, 10:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 27, 2:34 PM
Unknown Object (File)
Mon, Aug 26, 7:46 PM
Unknown Object (File)
Sun, Aug 25, 4:03 PM
Unknown Object (File)
Wed, Aug 21, 10:42 AM
Unknown Object (File)
Jul 28 2024, 4:08 PM
Unknown Object (File)
Jul 17 2024, 8:25 PM
Unknown Object (File)
Jul 15 2024, 5:32 PM
Unknown Object (File)
Jul 15 2024, 5:32 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
Lint Not Applicable
Unit
Tests Not Applicable

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)