mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 12:25:16 +00:00
Create base call window
This commit is contained in:
@ -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"
|
||||
}
|
||||
}
|
39
assets/js/typings/Utils.d.ts
vendored
Normal file
39
assets/js/typings/Utils.d.ts
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Typescript typing rules for Utils
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
declare interface CreateElem2Args {
|
||||
type : string,
|
||||
appendTo ?: HTMLElement,
|
||||
insertBefore ?: HTMLElement,
|
||||
insertAsFirstChild ?: HTMLElement,
|
||||
class ?: string,
|
||||
id ?: string,
|
||||
title ?: string,
|
||||
src ?: string,
|
||||
href ?: string,
|
||||
internalHref ?: string,
|
||||
name ?: string,
|
||||
elemType ?: string,
|
||||
value ?: string,
|
||||
placeholder ?: string,
|
||||
innerHTML ?: string,
|
||||
innerLang ?: string,
|
||||
innerHTMLprefix ?: string,
|
||||
disabled ?: boolean,
|
||||
children ?: HTMLElement[],
|
||||
onclick ?: Function,
|
||||
ondblclick ?: Function
|
||||
}
|
||||
|
||||
declare function createElem(nodeType : string, appendTo : string) : HTMLElement;
|
||||
|
||||
declare function createElem2(infos : CreateElem2Args) : HTMLElement;
|
||||
|
||||
declare function byId(id : string) : HTMLElement;
|
||||
|
||||
declare function emptyElem(target : HTMLElement) : void;
|
||||
|
||||
declare function checkMail(emailAddress : string) : boolean;
|
Reference in New Issue
Block a user