tweb/src/components/groupCall/title.ts
morethanwords ca1213c32f Support noforwards
Fix chat date blinking
Fix displaying sent messages to new dialog
Scroll to date bubble if message is bigger than viewport
Fix releasing keyboard by inline helper
Fix clearing self user
Fix displaying sent public poll
Update contacts counter in dialogs placeholder
Improve multiselect animation
Disable lottie icon animations if they're disabled
Fix changing mtproto transport during authorization
2022-01-08 16:52:14 +04:00

38 lines
1.1 KiB
TypeScript

/*
* 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";
import RichTextProcessor from "../../lib/richtextprocessor";
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) {
setInnerHTML(appendTo, RichTextProcessor.wrapEmojiText(groupCall.title));
} else {
if(peerTitle.peerId !== peerId) {
peerTitle.peerId = peerId;
peerTitle.update();
}
if(peerTitle.element.parentElement !== appendTo) {
appendTo.append(peerTitle.element);
}
}
}
}