added chat reording based on most recent interaction
This commit is contained in:
parent
76e8669066
commit
86755a1118
12
css/main.css
12
css/main.css
@ -544,6 +544,18 @@ sm-button[variant=primary] .icon {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat {
|
||||||
|
animation: slide-up 0.3s forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slide-up {
|
||||||
|
from {
|
||||||
|
transform: translateY(1rem);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
.contact {
|
.contact {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
2
css/main.min.css
vendored
2
css/main.min.css
vendored
File diff suppressed because one or more lines are too long
@ -496,7 +496,17 @@ sm-button[variant="primary"]{
|
|||||||
border-radius: 2rem;
|
border-radius: 2rem;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
.chat{
|
||||||
|
animation: slide-up 0.3s forwards;
|
||||||
|
}
|
||||||
|
@keyframes slide-up{
|
||||||
|
from{
|
||||||
|
transform: translateY(1rem);
|
||||||
|
}
|
||||||
|
to{
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
.contact{
|
.contact{
|
||||||
position: relative;
|
position: relative;
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
20
index.html
20
index.html
@ -1179,7 +1179,6 @@
|
|||||||
function renderDirectUI(data) {
|
function renderDirectUI(data) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
renderMessages(data.messages);
|
renderMessages(data.messages);
|
||||||
renderChatList()
|
|
||||||
renderMailList(data.mails)
|
renderMailList(data.mails)
|
||||||
if(Object.keys(data.messages).length && activePage.button !== getRef('chat_page_button')){
|
if(Object.keys(data.messages).length && activePage.button !== getRef('chat_page_button')){
|
||||||
getRef('chat_page_button').setAttribute('data-notifications', Object.keys(data.messages).length)
|
getRef('chat_page_button').setAttribute('data-notifications', Object.keys(data.messages).length)
|
||||||
@ -1576,7 +1575,10 @@
|
|||||||
let time = Date.now()
|
let time = Date.now()
|
||||||
render.messageBubble(receiver, message, time, 'sent', true)
|
render.messageBubble(receiver, message, time, 'sent', true)
|
||||||
getRef('chat_container').scrollTo({left: 0, top: getRef('chat_container').scrollHeight, behavior: 'smooth'})
|
getRef('chat_container').scrollTo({left: 0, top: getRef('chat_container').scrollHeight, behavior: 'smooth'})
|
||||||
console.log(activeChat)
|
const cloneContact = activeChat.cloneNode(true)
|
||||||
|
activeChat.remove()
|
||||||
|
activeChat = cloneContact
|
||||||
|
getRef('dm_container').prepend(cloneContact)
|
||||||
messenger.sendMessage(message, receiver).then(data => {
|
messenger.sendMessage(message, receiver).then(data => {
|
||||||
getRef(`${receiver}_${time}`).classList.remove('unconfirmed')
|
getRef(`${receiver}_${time}`).classList.remove('unconfirmed')
|
||||||
}).catch(error => notify(error, "error"));
|
}).catch(error => notify(error, "error"));
|
||||||
@ -1614,7 +1616,6 @@
|
|||||||
getRef('dm_container').innerHTML = ''
|
getRef('dm_container').innerHTML = ''
|
||||||
for (floID of messenger.getChatOrder().direct)
|
for (floID of messenger.getChatOrder().direct)
|
||||||
render.contactCard(floID, floGlobals.contacts[floID], 'chat')
|
render.contactCard(floID, floGlobals.contacts[floID], 'chat')
|
||||||
console.log()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderMarked(data) {
|
function renderMarked(data) {
|
||||||
@ -1628,8 +1629,13 @@
|
|||||||
for (let m in data) {
|
for (let m in data) {
|
||||||
let {floID, message, time, category} = data[m]
|
let {floID, message, time, category} = data[m]
|
||||||
render.messageBubble(floID, message, time, category, unconfirmed)
|
render.messageBubble(floID, message, time, category, unconfirmed)
|
||||||
if (markUnread)
|
if (markUnread){
|
||||||
getRef('contacts').querySelector(`[flo-id='${floID}']`).classList.add("unread");
|
const contact = getRef('contacts').querySelector(`.chat[flo-id='${floID}']`)
|
||||||
|
contact.classList.add("unread");
|
||||||
|
const cloneContact = contact.cloneNode(true)
|
||||||
|
contact.remove()
|
||||||
|
getRef('dm_container').prepend(cloneContact)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getRef('chat_container').scrollTo(0, getRef('chat_container').scrollHeight)
|
getRef('chat_container').scrollTo(0, getRef('chat_container').scrollHeight)
|
||||||
}
|
}
|
||||||
@ -1646,9 +1652,9 @@
|
|||||||
getRef("receiver_name").textContent = floGlobals.contacts[floID] || name || ' ';
|
getRef("receiver_name").textContent = floGlobals.contacts[floID] || name || ' ';
|
||||||
getRef("receiver_floID").textContent = floID;
|
getRef("receiver_floID").textContent = floID;
|
||||||
if (floGlobals.pubKeys[floID])
|
if (floGlobals.pubKeys[floID])
|
||||||
getRef("warn_no_encryption").classList.add("hide-completely");
|
getRef("warn_no_encryption").classList.add("hide-completely");
|
||||||
else
|
else
|
||||||
getRef("warn_no_encryption").classList.remove("hide-completely");
|
getRef("warn_no_encryption").classList.remove("hide-completely");
|
||||||
renderMessages(await messenger.getChat(floID), false)
|
renderMessages(await messenger.getChat(floID), false)
|
||||||
getRef('chat_container').scrollTo(0, getRef('chat_container').scrollHeight)
|
getRef('chat_container').scrollTo(0, getRef('chat_container').scrollHeight)
|
||||||
messenger.removeMark(floID, "unread");
|
messenger.removeMark(floID, "unread");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user