Telegram Web K with changes to work inside I2P
https://web.telegram.i2p/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
3 years ago
|
/*
|
||
|
* https://github.com/morethanwords/tweb
|
||
|
* Copyright (C) 2019-2021 Eduard Kuzmenko
|
||
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
||
|
*/
|
||
|
|
||
|
import { deepEqual } from "../../helpers/object";
|
||
|
import { GroupCall } from "../../layer";
|
||
|
import { GroupCallInstance } from "../../lib/appManagers/appGroupCallsManager";
|
||
|
import GROUP_CALL_STATE from "../../lib/calls/groupCallState";
|
||
|
import I18n, { LangPackKey, FormatterArguments } from "../../lib/langPack";
|
||
|
|
||
|
export default class GroupCallDescriptionElement {
|
||
|
private descriptionIntl: I18n.IntlElement;
|
||
|
|
||
|
constructor(private appendTo: HTMLElement) {
|
||
|
this.descriptionIntl = new I18n.IntlElement({
|
||
|
key: 'VoiceChat.Status.Connecting'
|
||
|
});
|
||
|
|
||
|
this.descriptionIntl.element.classList.add('group-call-description');
|
||
|
|
||
|
appendTo.append(this.descriptionIntl.element);
|
||
|
}
|
||
|
|
||
|
public update(instance: GroupCallInstance) {
|
||
|
const {state} = instance;
|
||
|
|
||
|
let key: LangPackKey, args: FormatterArguments;
|
||
|
if(state === GROUP_CALL_STATE.CONNECTING) {
|
||
|
key = 'VoiceChat.Status.Connecting';
|
||
|
} else {
|
||
|
key = 'VoiceChat.Status.Members';
|
||
|
args = [(instance.groupCall as GroupCall.groupCall).participants_count];
|
||
|
}
|
||
|
|
||
|
const {descriptionIntl} = this;
|
||
|
|
||
|
if(descriptionIntl.key !== key || !deepEqual(descriptionIntl.args, args)) {
|
||
|
descriptionIntl.key = key;
|
||
|
descriptionIntl.args = args;
|
||
|
descriptionIntl.update();
|
||
|
}
|
||
|
}
|
||
|
}
|