Create base call window

This commit is contained in:
Pierre HUBERT 2020-04-10 13:18:26 +02:00
parent a59b9b6441
commit 119a6f1626
5 changed files with 75 additions and 1 deletions

View File

@ -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)
} }
} }

View 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
View File

@ -0,0 +1,6 @@
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs"
}
}

View File

@ -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",