Skip to content

Commit

Permalink
fix(Chat): Fix active chat border highlight (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgmarchi authored Oct 21, 2024
1 parent 9789cc1 commit 08f230e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib/components/messaging/ChatPreview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
$: users = Store.getUsers(chat.users)
$: lookupUsers = Store.getUsersLookup(chat.users)
$: chatName = chat.kind === ChatType.Group ? chat.name : ($users[1]?.name ?? $users[0].name)
$: chatName = chat.kind === ChatType.Group ? chat.name : $users[1]?.name ?? $users[0].name
$: loading = chatName === "Unknown User" || ($users.length <= 2 && ($users[1]?.loading == true || $users[0].loading == true))
$: directChatPhoto = $users[1]?.profile.photo.image ?? $users[0].profile.photo.image
$: chatStatus = $users.length > 2 ? Status.Offline : ($users[1]?.profile.status ?? $users[0].profile.status)
$: chatStatus = $users.length > 2 ? Status.Offline : $users[1]?.profile.status ?? $users[0].profile.status
$: simpleUnreads = derived(SettingsStore.state, s => s.messaging.simpleUnreads)
$: user = chat.typing_indicator.users().map(u => {
return $lookupUsers[u]
Expand Down Expand Up @@ -74,15 +74,17 @@
}, 500)
})
$: isActiveChat = get(Store.state.activeChat)?.id === chat.id
function getClass() {
if (!interactable) return ""
return `${cta ? "cta" : ""} ${get(Store.state.activeChat)?.id === chat.id ? "active-chat" : ""}`
return `${cta ? "cta" : ""} `
}
</script>

<button
data-cy="chat-preview"
class="chat-preview {getClass()}"
class="chat-preview {getClass()} {isActiveChat ? 'active-chat' : ''}"
disabled={!interactable}
on:contextmenu
on:click={_ => {
Expand Down

0 comments on commit 08f230e

Please sign in to comment.