mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Create base call window
This commit is contained in:
		@@ -4,6 +4,11 @@
 | 
				
			|||||||
 * @author Pierre Hubert
 | 
					 * @author Pierre Hubert
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @type {Map<number, CallWindow>}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					let OpenConversations = new Map();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class CallsController {
 | 
					class CallsController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -12,7 +17,14 @@ class CallsController {
 | 
				
			|||||||
	 * @param {Conversation} conv Information about the target conversation
 | 
						 * @param {Conversation} conv Information about the target conversation
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	static Open(conv) {
 | 
						static Open(conv) {
 | 
				
			||||||
		alert("Open call for conversation " + conv.ID);
 | 
							if(OpenConversations.has(conv.ID))
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							console.info("Open call for conversation " + conv.ID);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// Create a new window for the conversation
 | 
				
			||||||
 | 
							const window = new CallWindow(conv);
 | 
				
			||||||
 | 
							OpenConversations.set(conv.ID, window)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										55
									
								
								assets/js/components/calls/window.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								assets/js/components/calls/window.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Calls window
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author Pierre Hubert
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class CallWindow {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Create a new call window
 | 
				
			||||||
 | 
						 * 
 | 
				
			||||||
 | 
						 * @param {Conversation} conv Information about the target conversation
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						constructor(conv) {
 | 
				
			||||||
 | 
							this.construct(conv);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						async construct(conv) {
 | 
				
			||||||
 | 
							// Check if calls target exists or not
 | 
				
			||||||
 | 
							if(!byId("callsTarget"))
 | 
				
			||||||
 | 
								createElem2({
 | 
				
			||||||
 | 
									appendTo: byId("wrapper"),
 | 
				
			||||||
 | 
									type: "div",
 | 
				
			||||||
 | 
									id: "callsTarget",
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							this.conv = conv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.rootEl = createElem2({
 | 
				
			||||||
 | 
								appendTo: byId("callsTarget"),
 | 
				
			||||||
 | 
								type: "div",
 | 
				
			||||||
 | 
								class: "call-window"
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// Construct head
 | 
				
			||||||
 | 
							const windowHead = createElem2({
 | 
				
			||||||
 | 
								appendTo: this.rootEl,
 | 
				
			||||||
 | 
								type: "div",
 | 
				
			||||||
 | 
								class: "head",
 | 
				
			||||||
 | 
								innerHTML: "<i class='fa fa-phone'></i>" +
 | 
				
			||||||
 | 
									await getConvName(conv) + 
 | 
				
			||||||
 | 
									" <span class='pull-right'></span>"
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Close button
 | 
				
			||||||
 | 
							this.closeButton = createElem2({
 | 
				
			||||||
 | 
								appendTo: windowHead.querySelector(".pull-right"),
 | 
				
			||||||
 | 
								type: "a",
 | 
				
			||||||
 | 
								innerHTML: "<i class='fa fa-cross'></i>"
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										6
									
								
								assets/js/jsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								assets/js/jsconfig.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
						"compilerOptions": {
 | 
				
			||||||
 | 
							"target": "ES6",
 | 
				
			||||||
 | 
							"module": "commonjs"
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -457,6 +457,7 @@ class Dev {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			//Calls component
 | 
								//Calls component
 | 
				
			||||||
			"js/components/calls/controller.js",
 | 
								"js/components/calls/controller.js",
 | 
				
			||||||
 | 
								"js/components/calls/window.js",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Web app component
 | 
								// Web app component
 | 
				
			||||||
			"js/components/webApp/interface.js",
 | 
								"js/components/webApp/interface.js",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user