From 007da03837c52d25e77944084d558bd88ec083b1 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:29:04 -0300 Subject: [PATCH] feat: finish ui for modal showing pending requests --- .../src/pages/user/user-add-friends-modal.tsx | 48 ++++++------------- .../user/user-friend-pending-request.tsx | 32 ++++++++----- src/renderer/src/pages/user/user.css.ts | 16 ++++++- src/types/index.ts | 10 ++-- 4 files changed, 52 insertions(+), 54 deletions(-) diff --git a/src/renderer/src/pages/user/user-add-friends-modal.tsx b/src/renderer/src/pages/user/user-add-friends-modal.tsx index 4306936d..cb990e1c 100644 --- a/src/renderer/src/pages/user/user-add-friends-modal.tsx +++ b/src/renderer/src/pages/user/user-add-friends-modal.tsx @@ -26,7 +26,7 @@ export const UserAddFriendsModal = ({ const navigate = useNavigate(); - const { userDetails, sendFriendRequest } = useUserDetails(); + const { sendFriendRequest } = useUserDetails(); const { showSuccessToast, showErrorToast } = useToast(); @@ -51,21 +51,17 @@ export const UserAddFriendsModal = ({ useEffect(() => { setPendingRequests([ { - AId: "abcd1234", - ADisplayName: "Punheta Master 123", - AProfileImageUrl: + userId: "abcd1234", + displayName: "Punheta Master 123", + profileImageUrl: "https://cdn.discordapp.com/avatars/1239959140785455295/4aff4b901c7a9f5f814b4379b6cfd58a.webp", - BId: "BMmNRmP3", - BDisplayName: "Hydra", - BProfileImageUrl: null, + type: "RECEIVED", }, { - AId: "BMmNRmP3", - ADisplayName: "Hydra", - AProfileImageUrl: null, - BId: "12345678", - BDisplayName: "Deyvis0n", - BProfileImageUrl: null, + userId: "12345678", + displayName: "Deyvis0n", + profileImageUrl: null, + type: "SENT", }, ]); }, []); @@ -154,29 +150,13 @@ export const UserAddFriendsModal = ({ >

Pendentes

{pendingRequests.map((request) => { - if (request.AId === userDetails?.id) { - return ( - - ); - } - return ( onClickRequest(userId)} style={{ - display: "flex", - flexDirection: "row", - gap: `${SPACING_UNIT}px`, - alignItems: "center", + padding: "8px", }} > - +
+ {profileImageUrl ? ( + {displayName} + ) : ( + + )} +
{isRequestSent ? ( ) : ( <> diff --git a/src/renderer/src/pages/user/user.css.ts b/src/renderer/src/pages/user/user.css.ts index 16a4d44f..1582af29 100644 --- a/src/renderer/src/pages/user/user.css.ts +++ b/src/renderer/src/pages/user/user.css.ts @@ -35,6 +35,20 @@ export const profileAvatarContainer = style({ zIndex: 1, }); +export const pendingFriendRequestAvatarContainer = style({ + width: "32px", + height: "32px", + borderRadius: "50%", + display: "flex", + justifyContent: "center", + alignItems: "center", + backgroundColor: vars.color.background, + overflow: "hidden", + border: `solid 1px ${vars.color.border}`, + boxShadow: "0px 0px 5px 0px rgba(0, 0, 0, 0.7)", + zIndex: 1, +}); + export const profileAvatarEditContainer = style({ width: "128px", height: "128px", @@ -53,8 +67,6 @@ export const profileAvatarEditContainer = style({ export const profileAvatar = style({ height: "100%", width: "100%", - borderRadius: "50%", - overflow: "hidden", objectFit: "cover", }); diff --git a/src/types/index.ts b/src/types/index.ts index 396a3029..46a556b3 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -276,12 +276,10 @@ export interface UserFriend { } export interface PendingFriendRequest { - AId: string; - ADisplayName: string; - AProfileImageUrl: string | null; - BId: string; - BDisplayName: string; - BProfileImageUrl: string | null; + userId: string; + displayName: string; + profileImageUrl: string | null; + type: "SENT" | "RECEIVED"; } export interface UserProfile {