Ready to implement conversation message writing notifier

This commit is contained in:
2021-03-08 19:01:51 +01:00
parent a545860795
commit 3a55f18b96
6 changed files with 53 additions and 0 deletions

View File

@ -130,6 +130,8 @@ const ConvChatWindow = {
class: "create-message-form"
});
new ConversationWritingNotifier(conversationFormContainer, infosBox.conversationID)
//Create input group
var inputGroup = createElem2({
appendTo: conversationFormContainer,

View File

@ -0,0 +1,31 @@
/**
* Notify when a user is writing a new message
* in a conversation
*
* @author Pierre Hubert
*/
class ConversationWritingNotifier {
constructor(target, convID) {
this.messageArea = createElem2({
appendTo: target,
type: "div",
class: "user-writing-message"
})
this.setText("hello world for conv " + convID)
}
/**
* Update message. If message is empty, hide the area
*
* @param {String} msg
*/
setText(msg) {
if(msg.length == 0)
return this.messageArea.style.display = "none";
this.messageArea.style.display = "block";
this.messageArea.innerHTML = msg;
}
}