mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Ready to implement conversation message writing notifier
This commit is contained in:
parent
a545860795
commit
3a55f18b96
12
assets/css/components/conversations/writingNotifier.css
Normal file
12
assets/css/components/conversations/writingNotifier.css
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Conversation message writing notifier
|
||||||
|
*/
|
||||||
|
|
||||||
|
.user-writing-message {
|
||||||
|
font-size: 80%;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
#conversationsElem .user-writing-message {
|
||||||
|
margin-top: -12px;
|
||||||
|
}
|
@ -197,6 +197,10 @@ class UserWebSocket {
|
|||||||
SendEvent("newNumberUnreadConvs", msg.data)
|
SendEvent("newNumberUnreadConvs", msg.data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "writing_message_in_conv":
|
||||||
|
SendEvent("WritingMessageInConv", msg.data);
|
||||||
|
break;
|
||||||
|
|
||||||
case "new_conv_message":
|
case "new_conv_message":
|
||||||
SendEvent("newConvMessage", msg.data);
|
SendEvent("newConvMessage", msg.data);
|
||||||
break;
|
break;
|
||||||
|
@ -130,6 +130,8 @@ const ConvChatWindow = {
|
|||||||
class: "create-message-form"
|
class: "create-message-form"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
new ConversationWritingNotifier(conversationFormContainer, infosBox.conversationID)
|
||||||
|
|
||||||
//Create input group
|
//Create input group
|
||||||
var inputGroup = createElem2({
|
var inputGroup = createElem2({
|
||||||
appendTo: conversationFormContainer,
|
appendTo: conversationFormContainer,
|
||||||
|
31
assets/js/components/conversations/writingNotifier.js
Normal file
31
assets/js/components/conversations/writingNotifier.js
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -407,6 +407,8 @@ const ConversationPageConvPart = {
|
|||||||
emptyElem(formContainer);
|
emptyElem(formContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new ConversationWritingNotifier(formContainer, this._conv_info.id)
|
||||||
|
|
||||||
//Add message input
|
//Add message input
|
||||||
var inputGroup = createElem2({
|
var inputGroup = createElem2({
|
||||||
appendTo: formContainer,
|
appendTo: formContainer,
|
||||||
|
@ -208,6 +208,7 @@ class Dev {
|
|||||||
"css/components/conversations/windows.css",
|
"css/components/conversations/windows.css",
|
||||||
"css/components/conversations/list.css",
|
"css/components/conversations/list.css",
|
||||||
"css/components/conversations/unreadDropdown.css",
|
"css/components/conversations/unreadDropdown.css",
|
||||||
|
"css/components/conversations/writingNotifier.css",
|
||||||
|
|
||||||
//User selector stylesheet
|
//User selector stylesheet
|
||||||
"css/components/userSelect/userSelect.css",
|
"css/components/userSelect/userSelect.css",
|
||||||
@ -405,6 +406,7 @@ class Dev {
|
|||||||
"js/components/conversations/utils.js",
|
"js/components/conversations/utils.js",
|
||||||
"js/components/conversations/unreadDropdown.js",
|
"js/components/conversations/unreadDropdown.js",
|
||||||
"js/components/conversations/messageEditor.js",
|
"js/components/conversations/messageEditor.js",
|
||||||
|
"js/components/conversations/writingNotifier.js",
|
||||||
|
|
||||||
//User selector
|
//User selector
|
||||||
"js/components/userSelect/userSelect.js",
|
"js/components/userSelect/userSelect.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user