+
Friends
+ {loading ? (
+
+ ) : (
+ <>
+
+
+
{
+ setIsModalOpen(true);
+ }}
+ >
+
+
+
+ {suggestion ? (
+ suggestion?.map((friend) => {
+ if (friend.status === "pending") {
+ return (
+
+ {
+ acceptFriendRequest(friend.id);
+ }}
+ onDeny={() => {
+ declineFriendRequest(friend.id, false);
+ }}
+ onCancel={() => {
+ declineFriendRequest(friend.id, false, true);
+ }}
+ />
+
+ );
+ } else
+ return (
+
+ {
+ declineFriendRequest(friend.id, true);
+ }}
+ />
+
+ );
+ })
+ ) : (
+
+ {pendingFriends.map((friend) => (
+ {
+ acceptFriendRequest(friend.id);
+ }}
+ onDeny={() => {
+ declineFriendRequest(friend.id, false);
+ }}
+ onCancel={() => {
+ declineFriendRequest(friend.id, false, true);
+ }}
+ />
+
+ ))}
+ {friends.map((friend) => (
+
{
@@ -183,42 +254,12 @@ export default function Friends() {
}}
/>
- );
- })
- ) : (
-
- {pendingFriends.map((friend) => (
-
- {
- acceptFriendRequest(friend.id);
- }}
- onDeny={() => {
- declineFriendRequest(friend.id, false);
- }}
- />
-
- ))}
- {friends.map((friend) => (
-
- {
- declineFriendRequest(friend.id, true);
- }}
- />
-
- ))}
-
- )}
-
-
- >
- )}
-
+ ))}
+
+ )}
+ >
+ )}
+