From 86cac34ef37af0a9e21289991f3f9ace9d974286 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Mon, 29 Jul 2024 23:26:29 +0200 Subject: [PATCH] Muc-app: cleaning code. --- .../custom/plugins/notes/templates/muc-note-app.js | 5 ----- .../custom/plugins/tasks/templates/muc-task-app.js | 5 ----- conversejs/custom/shared/components/muc-app.js | 10 ++++++++++ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/conversejs/custom/plugins/notes/templates/muc-note-app.js b/conversejs/custom/plugins/notes/templates/muc-note-app.js index ec409bcb..ad471ca9 100644 --- a/conversejs/custom/plugins/notes/templates/muc-note-app.js +++ b/conversejs/custom/plugins/notes/templates/muc-note-app.js @@ -9,22 +9,17 @@ import { __ } from 'i18n' export function tplMUCNoteApp (el, mucModel) { if (!mucModel) { // should not happen - el.classList.add('hidden') // we must do this, otherwise will have CSS side effects return html`` } if (!mucModel.notes) { // too soon, not initialized yet (this will happen) - el.classList.add('hidden') // we must do this, otherwise will have CSS side effects return html`` } if (!el.show) { - el.classList.add('hidden') return html`` } - el.classList.remove('hidden') - // eslint-disable-next-line no-undef const i18nNotes = __(LOC_moderator_notes) // eslint-disable-next-line no-undef diff --git a/conversejs/custom/plugins/tasks/templates/muc-task-app.js b/conversejs/custom/plugins/tasks/templates/muc-task-app.js index 5dcbd8a3..33255a8d 100644 --- a/conversejs/custom/plugins/tasks/templates/muc-task-app.js +++ b/conversejs/custom/plugins/tasks/templates/muc-task-app.js @@ -9,22 +9,17 @@ import { __ } from 'i18n' export function tplMUCTaskApp (el, mucModel) { if (!mucModel) { // should not happen - el.classList.add('hidden') // we must do this, otherwise will have CSS side effects return html`` } if (!mucModel.tasklists) { // too soon, not initialized yet (this will happen) - el.classList.add('hidden') // we must do this, otherwise will have CSS side effects return html`` } if (!el.show) { - el.classList.add('hidden') return html`` } - el.classList.remove('hidden') - // eslint-disable-next-line no-undef const i18nTasks = __(LOC_tasks) // eslint-disable-next-line no-undef diff --git a/conversejs/custom/shared/components/muc-app.js b/conversejs/custom/shared/components/muc-app.js index 8ab03c5e..40f13911 100644 --- a/conversejs/custom/shared/components/muc-app.js +++ b/conversejs/custom/shared/components/muc-app.js @@ -51,6 +51,16 @@ export class MUCApp extends CustomElement { return '' } + updated () { + if (this.innerText.trim() === '') { + this.classList.add('hidden') // we must do this, otherwise will have CSS side effects + } else { + this.classList.remove('hidden') + } + + super.updated() + } + toggleApp () { this.show = !this.show if (this.sessionStorangeShowKey) {