seen indicator

This commit is contained in:
Martti Malmi 2020-01-27 10:17:27 +02:00
parent 4a0e187b33
commit 28953d9576
2 changed files with 8 additions and 4 deletions

View File

@ -515,8 +515,9 @@ function sortMessagesByTime() {
function addMessage(msg) {
var escaped = $('<div>').text(msg.text).html();
var textEl = $('<div class="text"></div>').html(autolinker.link(escaped));
var seenHtml = msg.selfAuthored ? ' <span class="seen"><svg version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 40"><polygon fill="currentColor" points="40.6,12.1 17,35.7 7.4,26.1 4.6,29 17,41.3 43.4,14.9"/></svg></span>' : '';
var msgContent = $(
'<div class="msg-content"><div class="time"><span class="seen"><svg version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 40"><polygon fill="#4FC3F7" points="40.6,12.1 17,35.7 7.4,26.1 4.6,29 17,41.3 43.4,14.9"/></svg></span> ' + formatTime(msg.time) + '</div></div>'
'<div class="msg-content"><div class="time">' + formatTime(msg.time) + seenHtml + '</div></div>'
);
msgContent.prepend(textEl);
if (msg.text.length === 2 && isEmoji(msg.text)) {
@ -600,7 +601,6 @@ function addChat(pub, chatLink) {
});
chats[pub].getMyMsgsLastSeenTime(time => {
chats[pub].myLastSeenTime = new Date(time);
console.log('myLastSeenTime', time);
});
}
@ -611,7 +611,7 @@ function lastSeenTimeChanged(pub) {
$('.msg.our').each(function() {
var el = $(this);
if (el.data('time') <= chats[pub].theirLastSeenTime) {
el.find('.seen').show();
el.find('.seen').toggleClass('yes', true);
}
});
// set seen msgs

View File

@ -156,10 +156,14 @@ header #back-button {
}
.msg .seen {
display: none;
color: rgba(0, 0, 0, 0.45);
user-select: none;
}
.msg .seen.yes {
color: #4fc3f7;
}
.msg .seen svg {
width: 15px;
}