mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 11:44:19 +00:00 
			
		
		
		
	Ready to implement conversation message writing notifier
This commit is contained in:
		@@ -130,6 +130,8 @@ const ConvChatWindow = {
 | 
			
		||||
			class: "create-message-form"
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		new ConversationWritingNotifier(conversationFormContainer, infosBox.conversationID)
 | 
			
		||||
 | 
			
		||||
		//Create input group
 | 
			
		||||
		var inputGroup = createElem2({
 | 
			
		||||
			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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user