2020-02-10 11:23:55 +01:00
|
|
|
import '../components/dropdown.js';
|
|
|
|
import { __ } from '@converse/headless/i18n';
|
2020-02-07 14:58:26 +01:00
|
|
|
import { html } from "lit-html";
|
|
|
|
import { until } from 'lit-html/directives/until.js';
|
2020-04-23 13:22:31 +02:00
|
|
|
import { converse } from "@converse/headless/converse-core";
|
2020-02-07 14:58:26 +01:00
|
|
|
|
|
|
|
const u = converse.env.utils;
|
2020-02-10 11:23:55 +01:00
|
|
|
const i18n_hide_topic = __('Hide the groupchat topic');
|
2020-02-21 15:30:28 +01:00
|
|
|
const i18n_bookmarked = __('This groupchat is bookmarked');
|
2020-02-10 11:23:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
const tpl_standalone_btns = (o) => o.standalone_btns.reverse().map(b => until(b, ''));
|
2020-02-07 14:58:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
export default (o) => {
|
2020-05-15 14:33:31 +02:00
|
|
|
const subject = o.subject ? u.addHyperlinks(o.subject.text) : '';
|
2020-02-18 17:26:49 +01:00
|
|
|
const show_subject = (subject && !o.subject_hidden);
|
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"}">
|
|
|
|
${ (o._converse.standalone) ? html`<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>` : '' }
|
|
|
|
<div class="chatbox-title__text" title="${ (o._converse.locked_muc_domain !== 'hidden') ? o.jid : '' }">${ o.title }
|
2020-02-21 15:30:28 +01:00
|
|
|
${ (o.bookmarked) ? html`<i class="fa fa-bookmark chatbox-title__text--bookmarked" title="${i18n_bookmarked}"></i>` : '' }
|
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">
|
2020-02-10 11:23:55 +01:00
|
|
|
${ o.standalone_btns.length ? tpl_standalone_btns(o) : '' }
|
|
|
|
${ o.dropdown_btns.length ? html`<converse-dropdown .items=${o.dropdown_btns}></converse-dropdown>` : '' }
|
2020-02-07 14:58:26 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-15 14:33:31 +02:00
|
|
|
${ show_subject ? html`<p class="chat-head__desc" title="${i18n_hide_topic}">${subject}</p>` : '' }
|
2020-02-07 14:58:26 +01:00
|
|
|
`;
|
|
|
|
}
|