2021-03-24 11:59:09 +01:00
|
|
|
import 'shared/components/dropdown.js';
|
|
|
|
import 'shared/components/rich-text.js';
|
2021-02-11 11:43:02 +01:00
|
|
|
import { __ } from 'i18n';
|
2022-04-19 21:54:10 +02:00
|
|
|
import { _converse, api } from "@converse/headless/core.js";
|
|
|
|
import { getHeadingDropdownItem, getHeadingStandaloneButton } from 'plugins/chatview/utils.js';
|
2021-04-14 22:56:59 +02:00
|
|
|
import { html } from "lit";
|
|
|
|
import { until } from 'lit/directives/until.js';
|
2020-02-10 11:23:55 +01:00
|
|
|
|
2020-02-07 14:58:26 +01:00
|
|
|
|
2022-04-19 21:54:10 +02:00
|
|
|
export default (el) => {
|
|
|
|
const o = el.model.toJSON();
|
|
|
|
const subject_hidden = el.user_settings?.get('mucs_with_hidden_subject', [])?.includes(el.model.get('jid'));
|
2020-08-16 23:33:17 +02:00
|
|
|
const i18n_hide_topic = __('Hide the groupchat topic');
|
|
|
|
const i18n_bookmarked = __('This groupchat is bookmarked');
|
2021-03-24 11:38:54 +01:00
|
|
|
const subject = o.subject ? o.subject.text : '';
|
2022-04-19 21:54:10 +02:00
|
|
|
const show_subject = (subject && !subject_hidden);
|
|
|
|
const muc_vcard = el.model.vcard?.get('image');
|
2020-02-07 14:58:26 +01:00
|
|
|
return html`
|
2020-02-10 11:23:55 +01:00
|
|
|
<div class="chatbox-title ${ show_subject ? '' : "chatbox-title--no-desc"}">
|
2022-04-19 21:54:10 +02:00
|
|
|
|
|
|
|
${ muc_vcard && muc_vcard !== _converse.DEFAULT_IMAGE ? html`
|
|
|
|
<converse-avatar class="avatar align-self-center"
|
|
|
|
.data=${el.model.vcard?.attributes}
|
|
|
|
nonce=${el.model.vcard?.get('vcard_updated')}
|
|
|
|
height="40" width="40"></converse-avatar>` : ''
|
|
|
|
}
|
|
|
|
|
2022-02-19 22:21:25 +01:00
|
|
|
<div class="chatbox-title--row">
|
|
|
|
${ (!_converse.api.settings.get("singleton")) ? html`<converse-controlbox-navback jid="${o.jid}"></converse-controlbox-navback>` : '' }
|
2022-04-19 21:54:10 +02:00
|
|
|
<div class="chatbox-title__text" title="${ (api.settings.get('locked_muc_domain') !== 'hidden') ? o.jid : '' }">${ el.model.getDisplayName() }
|
2022-02-19 22:21:25 +01:00
|
|
|
${ (o.bookmarked) ? html`<i class="fa fa-bookmark chatbox-title__text--bookmarked" title="${i18n_bookmarked}"></i>` : '' }
|
|
|
|
</div>
|
2020-02-10 11:23:55 +01:00
|
|
|
</div>
|
2020-02-07 14:58:26 +01:00
|
|
|
<div class="chatbox-title__buttons row no-gutters">
|
2022-04-19 21:54:10 +02:00
|
|
|
${ until(el.getHeadingButtons(subject_hidden).then((buttons) => {
|
|
|
|
const dropdown_btns = buttons.filter(b => !b.standalone).map(b => getHeadingDropdownItem(b));
|
|
|
|
return html`
|
|
|
|
${ buttons.filter(b => b.standalone).reverse().map(b => until(getHeadingStandaloneButton(b), '')) }
|
|
|
|
${ dropdown_btns.length ? html`<converse-dropdown class="dropleft" color="var(--chatroom-head-color)" .items=${dropdown_btns}></converse-dropdown>` : '' }`
|
|
|
|
}), '') }
|
2020-02-07 14:58:26 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-03-24 11:38:54 +01:00
|
|
|
${ show_subject ? html`<p class="chat-head__desc" title="${i18n_hide_topic}">
|
|
|
|
<converse-rich-text text=${subject} render_styling></converse-rich-text>
|
|
|
|
</p>` : '' }
|
2020-02-07 14:58:26 +01:00
|
|
|
`;
|
|
|
|
}
|