mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 12:09:21 +00:00
Create base call window
This commit is contained in:
parent
a59b9b6441
commit
119a6f1626
@ -4,6 +4,11 @@
|
||||
* @author Pierre Hubert
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {Map<number, CallWindow>}
|
||||
*/
|
||||
let OpenConversations = new Map();
|
||||
|
||||
class CallsController {
|
||||
|
||||
/**
|
||||
@ -12,7 +17,14 @@ class CallsController {
|
||||
* @param {Conversation} conv Information about the target conversation
|
||||
*/
|
||||
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
|
||||
"js/components/calls/controller.js",
|
||||
"js/components/calls/window.js",
|
||||
|
||||
// Web app component
|
||||
"js/components/webApp/interface.js",
|
||||
|
Loading…
Reference in New Issue
Block a user