(activeSection = 'friends')}>
Friends ({acceptedFriends.length})
{ activeSection = 'members'; if (!membersList.length) searchMembers(); }}>
Find Players
(activeSection = 'messages')}>
Direct Messages
(activeSection = 'invites')}>
Invites ({invites.filter((i) => i.status === 'pending').length})
{#if activeSection === 'friends'}
e.key === 'Enter' && handleSendFriendRequest()}
class="add-friend-input"
/>
{#if sendingFriendReq} {:else}Send Request{/if}
(friendsFilter = 'all')}>
All ({acceptedFriends.length})
(friendsFilter = 'online')}>
Online ({acceptedFriends.filter((f) => f.is_online).length})
(friendsFilter = 'pending')}>
Pending ({pendingReceived.length + pendingSent.length})
{#if pendingReceived.length > 0 && friendsFilter !== 'pending'}
You have {pendingReceived.length} pending friend request(s)
(friendsFilter = 'pending')}>Review
{/if}
{#if friendsFilter === 'pending'}
{#if pendingReceived.length > 0}
Incoming Requests ({pendingReceived.length})
{#each pendingReceived as req (req.uuid)}
(app.viewProfileUuid = req.uuid)} onkeydown={(e) => e.key === 'Enter' && (app.viewProfileUuid = req.uuid)}>
{req.username}
Wants to be friends
handleRespondRequest(req.uuid, true)} title="Accept">
handleRespondRequest(req.uuid, false)} title="Decline">
{/each}
{/if}
{#if pendingSent.length > 0}
Outgoing Requests ({pendingSent.length})
{#each pendingSent as req (req.uuid)}
{req.username}
Request pending...
handleRemoveFriend(req.uuid)} title="Cancel Request">
{/each}
{/if}
{#if pendingReceived.length === 0 && pendingSent.length === 0}
No pending friend requests.
{/if}
{:else if displayedFriends.length === 0}
No friends found in this view. Add friends by typing their username above!
{:else}
{#each displayedFriends as friend (friend.uuid)}
(app.viewProfileUuid = friend.uuid)}
onkeydown={(e) => e.key === 'Enter' && (app.viewProfileUuid = friend.uuid)}
title="View Profile"
>
{friend.username}
{#if friend.is_online && friend.playing_on}
Playing on {friend.playing_on}
{:else if friend.is_online}
Online in Launcher
{:else}
Offline
{/if}
selectChatFriend(friend)} title="Message">
openInviteModal(friend)} title="Invite to Game">
handleRemoveFriend(friend.uuid)} title="Remove Friend">
{/each}
{/if}
{:else if activeSection === 'members'}
e.key === 'Enter' && searchMembers()}
class="members-search-input"
/>
{#if loadingMembers} {:else} Search{/if}
{#if loadingMembers && !membersList.length}
{:else if membersList.length === 0}
No players found matching "{memberSearchQuery}". Try another username!
{:else}
{#each membersList as member (member.uuid)}
{@const isMe = member.uuid === activeAccount()?.uuid}
(app.viewProfileUuid = member.uuid)} onkeydown={(e) => e.key === 'Enter' && (app.viewProfileUuid = member.uuid)}>
{#if isMe}
(app.viewProfileUuid = member.uuid)}>
View My Profile
{:else if member.is_friend}
{
const friend = friends.find(f => f.uuid === member.uuid) || { uuid: member.uuid, username: member.username, status: 'accepted', is_online: member.online, playing_on: null };
selectChatFriend(friend as FriendInfo);
}}>
Message
(app.viewProfileUuid = member.uuid)} title="View Profile">
{:else}
handleAddMemberAsFriend(member.username, member.uuid)}
disabled={addingFriendUuid === member.uuid}
>
{#if addingFriendUuid === member.uuid}
{:else}
Add Friend
{/if}
(app.viewProfileUuid = member.uuid)} title="View Profile">
{/if}
{/each}
{/if}
{:else if activeSection === 'messages'}
{#if activeChatFriend}
e.key === 'Enter' && handleSendMessage()}
class="composer-input"
/>
{#if sendingMessage} {:else} {/if}
{:else}
Select a friend to start chatting
{/if}
{:else if activeSection === 'invites'}
{#if invites.length === 0}
No game invites received. When friends invite you to join their server, they will appear here!
{:else}
{#each invites as inv (inv.id)}
{inv.from_username} invited you to play
{inv.server_name}
{inv.server_address}
{/each}
{/if}
{/if}