unseen chats bold in list

This commit is contained in:
Martti Malmi 2020-05-18 14:52:01 +03:00
parent ec793efb26
commit bca16598fd
2 changed files with 11 additions and 4 deletions

View File

@ -504,6 +504,10 @@ header #back-button {
margin-right: 15px !important; margin-right: 15px !important;
} }
.chat-item.has-unseen .text, .chat-item.has-unseen .name {
font-weight: bold;
}
.chat-item .text { .chat-item .text {
padding-right: 5px; padding-right: 5px;
padding-top: 16px; padding-top: 16px;

View File

@ -961,12 +961,15 @@ function changeChatUnseenCount(pub, change) {
chats[pub].unseen = 0; chats[pub].unseen = 0;
} }
unseenTotal = unseenTotal >= 0 ? unseenTotal : 0; unseenTotal = unseenTotal >= 0 ? unseenTotal : 0;
var el = $('.chat-item[data-pub="' + pub +'"] .unseen'); var chatListEl = $('.chat-item[data-pub="' + pub +'"]');
var unseenCountEl = chatListEl.find('.unseen');
if (chats[pub].unseen > 0) { if (chats[pub].unseen > 0) {
el.text(chats[pub].unseen); chatListEl.addClass('has-unseen');
el.show(); unseenCountEl.text(chats[pub].unseen);
unseenCountEl.show();
} else { } else {
el.hide(); chatListEl.removeClass('has-unseen');
unseenCountEl.hide();
} }
setUnseenTotal(); setUnseenTotal();
} }