Skip to content

Commit

Permalink
Let recent emojis as maximum 6
Browse files Browse the repository at this point in the history
  • Loading branch information
lgmarchi committed Oct 14, 2024
1 parent e4bb712 commit cb5e0c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/lib/state/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ class Store {
})
}

getMostUsed(top?: number) {
top = top ? top : 5
getMostUsed(top = 6) {
return derived(this.state.emojiCounter, counter => {
return Object.entries(counter)
.sort((f, s) => s[1] - f[1])
.map(v => v[0])
.sort(([, countA], [, countB]) => countB - countA)
.slice(0, top)
.map(([emoji]) => emoji)
})
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/routes/chat/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@
// TODO(Lucas): Need to improve that for chats when not necessary all users are friends
$: loading = get(UIStore.state.chats).length > 0 && !$activeChat.users.slice(1).some(userId => $users[userId]?.name !== undefined)
$: chatName = $activeChat.kind === ChatType.DirectMessage ? $users[$activeChat.users[1]]?.name : ($activeChat.name ?? $users[$activeChat.users[1]]?.name)
$: chatName = $activeChat.kind === ChatType.DirectMessage ? $users[$activeChat.users[1]]?.name : ($activeChat.name ?? $users[$activeChat.users[1]]?.name)
$: chatName = $activeChat.kind === ChatType.DirectMessage ? $users[$activeChat.users[1]]?.name : $activeChat.name ?? $users[$activeChat.users[1]]?.name
$: statusMessage = $activeChat.kind === ChatType.DirectMessage ? $users[$activeChat.users[1]]?.profile?.status_message : $activeChat.motd
$: pinned = getPinned($conversation)
Expand Down

0 comments on commit cb5e0c4

Please sign in to comment.