Skip to content

Commit

Permalink
small improvements with displaying read chat messages
Browse files Browse the repository at this point in the history
  • Loading branch information
halbekanne committed Jan 7, 2024
1 parent c9e2827 commit 8e9d2c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/app/chat/data-access/chat-state.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,11 @@ export const chatStateAdapter = createAdapter<ChatAdaptState>()({
const activeChat = state.chats.find(
(chat) => chat.id === state.activeChatId
);
if (!activeChat) return [];
if (!activeChat || !state.ownProfileId) return [];
return activeChat.messages.filter(
(message) =>
message.readByParticipants && message.readByParticipants.length < 2
message.readByParticipants &&
!message.readByParticipants.includes(state.ownProfileId!)
);
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { DatePipe, NgClass, NgIf } from '@angular/common';
<div
class="absolute bottom-0.5"
[ngClass]="{
'fill-green-500': isRead,
'fill-gray-500': !isRead,
'fill-green-500': !isOwnMessage || isRead,
'fill-gray-500': isOwnMessage && !isRead,
'left-1.5': !isOwnMessage,
'right-1.5': isOwnMessage
}"
Expand All @@ -27,7 +27,7 @@ import { DatePipe, NgClass, NgIf } from '@angular/common';
<use
[attr.href]="
'assets/icons/bootstrap-icons.svg#' +
(isRead ? 'check2-all' : 'check2')
(!isOwnMessage || isRead ? 'check2-all' : 'check2')
"
/>
</svg>
Expand Down

0 comments on commit 8e9d2c6

Please sign in to comment.