2020-12-18 04:07:32 +01:00
|
|
|
import AvatarElement from "../avatar";
|
|
|
|
import PopupElement, { PopupButton } from ".";
|
2020-10-15 21:52:27 +02:00
|
|
|
|
|
|
|
export default class PopupPeer extends PopupElement {
|
|
|
|
constructor(private className: string, options: Partial<{
|
2020-12-11 03:06:16 +01:00
|
|
|
peerId: number,
|
2020-10-15 21:52:27 +02:00
|
|
|
title: string,
|
|
|
|
description: string,
|
|
|
|
buttons: Array<PopupButton>
|
|
|
|
}> = {}) {
|
2021-03-19 13:14:42 +01:00
|
|
|
super('popup-peer' + (className ? ' ' + className : ''), options.buttons, {overlayClosable: true});
|
2020-10-15 21:52:27 +02:00
|
|
|
|
|
|
|
let avatarEl = new AvatarElement();
|
|
|
|
avatarEl.setAttribute('dialog', '1');
|
2020-12-11 03:06:16 +01:00
|
|
|
avatarEl.setAttribute('peer', '' + options.peerId);
|
2020-12-14 01:57:59 +01:00
|
|
|
avatarEl.classList.add('avatar-32');
|
2020-10-15 21:52:27 +02:00
|
|
|
|
|
|
|
this.title.innerText = options.title || '';
|
|
|
|
this.header.prepend(avatarEl);
|
|
|
|
|
|
|
|
let p = document.createElement('p');
|
|
|
|
p.classList.add('popup-description');
|
|
|
|
p.innerHTML = options.description;
|
|
|
|
|
|
|
|
this.container.insertBefore(p, this.header.nextElementSibling);
|
|
|
|
}
|
2021-03-13 04:53:19 +01:00
|
|
|
}
|