{#if activeSection === 'friends'}
e.key === 'Enter' && handleSendFriendRequest()} class="add-friend-input" />
{#if pendingReceived.length > 0 && friendsFilter !== 'pending'}
You have {pendingReceived.length} pending friend request(s)
{/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
{/each}
{/if} {#if pendingSent.length > 0}

Outgoing Requests ({pendingSent.length})

{#each pendingSent as req (req.uuid)}
{req.username} Request pending...
{/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}
{/each}
{/if}
{:else if activeSection === 'members'}
{#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)}>
(app.viewProfileUuid = member.uuid)}>{member.username} {#if isMe} You {/if}
Lvl {member.global_level} {#if member.title} {member.title} {/if}
{member.online ? 'Online on Network' : member.last_seen ? `Active ${new Date(member.last_seen).toLocaleDateString()}` : 'Offline'}
{#if isMe} {:else if member.is_friend} {:else} {/if}
{/each}
{/if}
{:else if activeSection === 'messages'}
Conversations
{#each acceptedFriends as friend (friend.uuid)} {/each}
{#if activeChatFriend}
(app.viewProfileUuid = activeChatFriend!.uuid)} onkeydown={(e) => e.key === 'Enter' && (app.viewProfileUuid = activeChatFriend!.uuid)} >
{activeChatFriend.username} {activeChatFriend.is_online ? 'Active now' : 'Offline'}
{#if messages.length === 0}

No messages yet with {activeChatFriend.username}. Say hello!

{:else} {#each messages as msg (msg.id)} {@const isMine = msg.from_uuid === activeAccount()?.uuid}

{msg.content}

{new Date(msg.created_at).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
{/each} {/if}
e.key === 'Enter' && handleSendMessage()} class="composer-input" />
{: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}

Choose which instance / server you want to invite {inviteTargetFriend?.username} to join:

{#snippet footer()} {/snippet}