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.
48 lines
1.3 KiB
48 lines
1.3 KiB
/* |
|
* https://github.com/morethanwords/tweb |
|
* Copyright (C) 2019-2021 Eduard Kuzmenko |
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE |
|
*/ |
|
|
|
import {GroupCall} from '../../layer'; |
|
import GroupCallInstance from '../../lib/calls/groupCallInstance'; |
|
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'); |
|
} |
|
|
|
public detach() { |
|
this.descriptionIntl.element.remove(); |
|
} |
|
|
|
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; |
|
descriptionIntl.compareAndUpdate({ |
|
key, |
|
args |
|
}); |
|
|
|
if(!this.descriptionIntl.element.parentElement) { |
|
this.appendTo.append(this.descriptionIntl.element); |
|
} |
|
} |
|
}
|
|
|