2021-07-15 13:24:46 +02:00
|
|
|
import DOMPurify from 'dompurify';
|
2021-09-17 12:17:43 +02:00
|
|
|
import { __ } from 'i18n';
|
2022-08-21 13:03:32 +02:00
|
|
|
import { _converse, api } from "@converse/headless/core.js";
|
2021-04-14 22:56:59 +02:00
|
|
|
import { html } from "lit";
|
|
|
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
2020-01-23 10:18:41 +01:00
|
|
|
|
|
|
|
|
2022-08-21 13:03:32 +02:00
|
|
|
const tpl_navigation = (el) => {
|
2020-08-16 23:33:17 +02:00
|
|
|
const i18n_about = __('About');
|
|
|
|
const i18n_commands = __('Commands');
|
|
|
|
return html`
|
|
|
|
<ul class="nav nav-pills justify-content-center">
|
|
|
|
<li role="presentation" class="nav-item">
|
2022-08-21 13:03:32 +02:00
|
|
|
<a class="nav-link ${el.tab === "about" ? "active" : ""}"
|
|
|
|
id="about-tab"
|
|
|
|
href="#about-tabpanel"
|
|
|
|
aria-controls="about-tabpanel"
|
|
|
|
role="tab"
|
|
|
|
data-toggle="tab"
|
|
|
|
data-name="about"
|
|
|
|
@click=${ev => el.switchTab(ev)}>${i18n_about}</a>
|
2020-08-16 23:33:17 +02:00
|
|
|
</li>
|
|
|
|
<li role="presentation" class="nav-item">
|
2022-08-21 13:03:32 +02:00
|
|
|
<a class="nav-link ${el.tab === "commands" ? "active" : ""}"
|
|
|
|
id="commands-tab"
|
|
|
|
href="#commands-tabpanel"
|
|
|
|
aria-controls="commands-tabpanel"
|
|
|
|
role="tab"
|
|
|
|
data-toggle="tab"
|
|
|
|
data-name="commands"
|
|
|
|
@click=${ev => el.switchTab(ev)}>${i18n_commands}</a>
|
2020-08-16 23:33:17 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
`;
|
|
|
|
}
|
2020-04-15 13:59:55 +02:00
|
|
|
|
2020-01-23 10:18:41 +01:00
|
|
|
|
2022-08-21 13:03:32 +02:00
|
|
|
export default (el) => {
|
2020-08-16 23:33:17 +02:00
|
|
|
const first_subtitle = __(
|
|
|
|
'%1$s Open Source %2$s XMPP chat client brought to you by %3$s Opkode %2$s',
|
|
|
|
'<a target="_blank" rel="nofollow" href="https://conversejs.org">',
|
|
|
|
'</a>',
|
|
|
|
'<a target="_blank" rel="nofollow" href="https://opkode.com">'
|
|
|
|
);
|
|
|
|
|
|
|
|
const second_subtitle = __(
|
|
|
|
'%1$s Translate %2$s it into your own language',
|
|
|
|
'<a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">',
|
|
|
|
'</a>'
|
|
|
|
);
|
2020-04-17 13:14:23 +02:00
|
|
|
const show_client_info = api.settings.get('show_client_info');
|
|
|
|
const allow_adhoc_commands = api.settings.get('allow_adhoc_commands');
|
|
|
|
const show_both_tabs = show_client_info && allow_adhoc_commands;
|
2022-08-21 13:03:32 +02:00
|
|
|
|
2020-04-17 13:14:23 +02:00
|
|
|
return html`
|
2022-08-21 13:03:32 +02:00
|
|
|
${ show_both_tabs ? tpl_navigation(el) : '' }
|
2020-04-15 13:59:55 +02:00
|
|
|
|
2022-08-21 13:03:32 +02:00
|
|
|
<div class="tab-content">
|
|
|
|
${ show_client_info ? html`
|
|
|
|
<div class="tab-pane tab-pane--columns ${ el.tab === 'about' ? 'active' : ''}"
|
|
|
|
id="about-tabpanel" role="tabpanel" aria-labelledby="about-tab">
|
2020-04-17 13:14:23 +02:00
|
|
|
|
2022-08-21 13:03:32 +02:00
|
|
|
<span class="modal-alert"></span>
|
|
|
|
<br/>
|
|
|
|
<div class="container">
|
|
|
|
<h6 class="brand-heading">Converse</h6>
|
|
|
|
<p class="brand-subtitle">${_converse.VERSION_NAME}</p>
|
|
|
|
<p class="brand-subtitle">${unsafeHTML(DOMPurify.sanitize(first_subtitle))}</p>
|
|
|
|
<p class="brand-subtitle">${unsafeHTML(DOMPurify.sanitize(second_subtitle))}</p>
|
2020-04-15 13:59:55 +02:00
|
|
|
</div>
|
2022-08-21 13:03:32 +02:00
|
|
|
</div>` : '' }
|
2020-04-15 13:59:55 +02:00
|
|
|
|
2022-08-21 13:03:32 +02:00
|
|
|
${ allow_adhoc_commands ? html`
|
|
|
|
<div class="tab-pane tab-pane--columns ${ el.tab === 'commands' ? 'active' : ''}"
|
|
|
|
id="commands-tabpanel"
|
|
|
|
role="tabpanel"
|
|
|
|
aria-labelledby="commands-tab">
|
|
|
|
<converse-adhoc-commands/>
|
|
|
|
</div> ` : '' }
|
2020-01-23 10:18:41 +01:00
|
|
|
</div>
|
2020-04-17 13:14:23 +02:00
|
|
|
`};
|