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.

38 lines
1.1 KiB

3 years ago
/*
* https://github.com/morethanwords/tweb
* Copyright (C) 2019-2021 Eduard Kuzmenko
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import setInnerHTML from "../../helpers/dom/setInnerHTML";
import { GroupCall } from "../../layer";
import GroupCallInstance from "../../lib/calls/groupCallInstance";
2 years ago
import wrapEmojiText from "../../lib/richTextProcessor/wrapEmojiText";
3 years ago
import PeerTitle from "../peerTitle";
export default class GroupCallTitleElement {
private peerTitle: PeerTitle;
constructor(private appendTo: HTMLElement) {
this.peerTitle = new PeerTitle({peerId: 0});
}
public update(instance: GroupCallInstance) {
const {peerTitle, appendTo} = this;
const groupCall = instance.groupCall as GroupCall.groupCall;
const peerId = instance.chatId.toPeerId(true);
if(groupCall.title) {
2 years ago
setInnerHTML(appendTo, wrapEmojiText(groupCall.title));
} else {
if(peerTitle.peerId !== peerId) {
peerTitle.peerId = peerId;
peerTitle.update();
}
if(peerTitle.element.parentElement !== appendTo) {
appendTo.append(peerTitle.element);
}
}
3 years ago
}
}