Remove unneeded ControlBoxPane view

This commit is contained in:
JC Brand 2021-01-22 15:36:00 +01:00
parent bb7d1c5cba
commit 6ca2183e24
4 changed files with 7 additions and 49 deletions

View File

@ -7,7 +7,6 @@ import "../../components/brand-heading";
import "../chatview/index.js";
import './loginpanel.js';
import ControlBoxMixin from './model.js';
import ControlBoxPane from './pane.js';
import ControlBoxToggle from './toggle.js';
import ControlBoxView from './view.js';
import controlbox_api from './api.js';
@ -96,7 +95,6 @@ converse.plugins.add('converse-controlbox', {
_converse.ControlBoxView = ControlBoxView;
_converse.ControlBox = _converse.ChatBox.extend(ControlBoxMixin);
_converse.ControlBoxPane = ControlBoxPane;
_converse.ControlBoxToggle = ControlBoxToggle;
/******************** Event Handlers ********************/

View File

@ -1,19 +0,0 @@
import { View } from '@converse/skeletor/src/view';
import { api } from '@converse/headless/core';
const ControlBoxPane = View.extend({
tagName: 'div',
className: 'controlbox-pane',
initialize () {
/**
* Triggered once the {@link _converse.ControlBoxPane} has been initialized
* @event _converse#controlBoxPaneInitialized
* @type { _converse.ControlBoxPane }
* @example _converse.api.listen.on('controlBoxPaneInitialized', view => { ... });
*/
api.trigger('controlBoxPaneInitialized', this);
}
});
export default ControlBoxPane;

View File

@ -9,13 +9,15 @@ export default (o) => html`
<div class="controlbox-panes">
${ o.connected
? html`
<converse-headlines-panel></converse-headlines-panel>
<converse-rooms-list></converse-rooms-list>
<converse-bookmarks></converse-bookmarks>`
<div class="controlbox-pane">
<converse-headlines-panel></converse-headlines-panel>
<converse-rooms-list></converse-rooms-list>
<converse-bookmarks></converse-bookmarks>
</div>`
: (
o['active-form'] === 'register'
? html`<converse-login-panel></converse-login-panel>`
: html`<converse-register-panel></converse-headlines-panel>`
? html`<converse-login-panel></converse-login-panel>`
: html`<converse-register-panel></converse-headlines-panel>`
)
}
</div>

View File

@ -48,8 +48,6 @@ class ControlBoxView extends ElementView {
const connection = _converse?.connection;
if (!connection?.connected || !connection?.authenticated || connection?.disconnecting) {
this.classList.add('logged-out');
} else if (this.model.get('connected')) {
this.renderControlBoxPane();
}
}
@ -57,27 +55,6 @@ class ControlBoxView extends ElementView {
this.model.get('connected') && this.render();
}
/**
* Renders the "Contacts" panel of the controlbox.
* This will only be called after the user has already been logged in.
* @private
* @method _converse.ControlBoxView.renderControlBoxPane
*/
renderControlBoxPane () {
if (this.loginpanel) {
this.loginpanel.remove();
delete this.loginpanel;
}
if (this.controlbox_pane && u.isVisible(this.controlbox_pane.el)) {
return;
}
this.classList.remove('logged-out');
this.controlbox_pane = new _converse.ControlBoxPane();
this
.querySelector('.controlbox-panes')
.insertAdjacentElement('afterBegin', this.controlbox_pane.el);
}
async close (ev) {
if (ev && ev.preventDefault) {
ev.preventDefault();