From 20cb668e09fd6badf6a5fd48ef08a9b202ae3b2e Mon Sep 17 00:00:00 2001 From: John Livingston Date: Mon, 29 Jul 2024 23:50:06 +0200 Subject: [PATCH] Muc-app: some refactoring. --- .../notes/components/muc-note-app-view.js | 2 +- .../plugins/notes/templates/muc-note-app.js | 23 +++++++----------- .../tasks/components/muc-task-app-view.js | 2 +- .../plugins/tasks/templates/muc-task-app.js | 23 +++++++----------- .../{muc-app.js => muc-app/index.js} | 0 .../{ => muc-app}/styles/muc-app.scss | 0 .../components/muc-app/templates/muc-app.js | 24 +++++++++++++++++++ 7 files changed, 42 insertions(+), 32 deletions(-) rename conversejs/custom/shared/components/{muc-app.js => muc-app/index.js} (100%) rename conversejs/custom/shared/components/{ => muc-app}/styles/muc-app.scss (100%) create mode 100644 conversejs/custom/shared/components/muc-app/templates/muc-app.js diff --git a/conversejs/custom/plugins/notes/components/muc-note-app-view.js b/conversejs/custom/plugins/notes/components/muc-note-app-view.js index 6b7368f0..92ac6295 100644 --- a/conversejs/custom/plugins/notes/components/muc-note-app-view.js +++ b/conversejs/custom/plugins/notes/components/muc-note-app-view.js @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { api } from '@converse/headless' -import { MUCApp } from '../../../shared/components/muc-app.js' +import { MUCApp } from '../../../shared/components/muc-app/index.js' import { tplMUCNoteApp } from '../templates/muc-note-app.js' /** diff --git a/conversejs/custom/plugins/notes/templates/muc-note-app.js b/conversejs/custom/plugins/notes/templates/muc-note-app.js index ad471ca9..24c8766d 100644 --- a/conversejs/custom/plugins/notes/templates/muc-note-app.js +++ b/conversejs/custom/plugins/notes/templates/muc-note-app.js @@ -3,6 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { converseLocalizedHelpUrl } from '../../../shared/lib/help' +import { tplMUCApp } from '../../../shared/components/muc-app/templates/muc-app.js' import { html } from 'lit' import { __ } from 'i18n' @@ -28,19 +29,11 @@ export function tplMUCNoteApp (el, mucModel) { page: 'documentation/user/streamers/notes' }) - return html` -
-
${i18nNotes}
- - -
-
- -
` + return tplMUCApp( + el, + i18nNotes, + helpUrl, + i18nHelp, + html`` + ) } diff --git a/conversejs/custom/plugins/tasks/components/muc-task-app-view.js b/conversejs/custom/plugins/tasks/components/muc-task-app-view.js index ebadd97b..c7ad938a 100644 --- a/conversejs/custom/plugins/tasks/components/muc-task-app-view.js +++ b/conversejs/custom/plugins/tasks/components/muc-task-app-view.js @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { api } from '@converse/headless' -import { MUCApp } from '../../../shared/components/muc-app.js' +import { MUCApp } from '../../../shared/components/muc-app/index.js' import { tplMUCTaskApp } from '../templates/muc-task-app.js' /** diff --git a/conversejs/custom/plugins/tasks/templates/muc-task-app.js b/conversejs/custom/plugins/tasks/templates/muc-task-app.js index 33255a8d..aeaf68e9 100644 --- a/conversejs/custom/plugins/tasks/templates/muc-task-app.js +++ b/conversejs/custom/plugins/tasks/templates/muc-task-app.js @@ -3,6 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { converseLocalizedHelpUrl } from '../../../shared/lib/help' +import { tplMUCApp } from '../../../shared/components/muc-app/templates/muc-app.js' import { html } from 'lit' import { __ } from 'i18n' @@ -28,19 +29,11 @@ export function tplMUCTaskApp (el, mucModel) { page: 'documentation/user/streamers/tasks' }) - return html` -
-
${i18nTasks}
- - -
-
- -
` + return tplMUCApp( + el, + i18nTasks, + helpUrl, + i18nHelp, + html`` + ) } diff --git a/conversejs/custom/shared/components/muc-app.js b/conversejs/custom/shared/components/muc-app/index.js similarity index 100% rename from conversejs/custom/shared/components/muc-app.js rename to conversejs/custom/shared/components/muc-app/index.js diff --git a/conversejs/custom/shared/components/styles/muc-app.scss b/conversejs/custom/shared/components/muc-app/styles/muc-app.scss similarity index 100% rename from conversejs/custom/shared/components/styles/muc-app.scss rename to conversejs/custom/shared/components/muc-app/styles/muc-app.scss diff --git a/conversejs/custom/shared/components/muc-app/templates/muc-app.js b/conversejs/custom/shared/components/muc-app/templates/muc-app.js new file mode 100644 index 00000000..9db12559 --- /dev/null +++ b/conversejs/custom/shared/components/muc-app/templates/muc-app.js @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: 2024 John Livingston +// +// SPDX-License-Identifier: AGPL-3.0-only + +import { html } from 'lit' +import { __ } from 'i18n' + +export function tplMUCApp (el, i18nTitle, helpUrl, i18nHelp, content) { + return html` +
+
${i18nTitle}
+ + +
+
+ ${content} +
` +}