New moderator app WIP:

* #144: moderator notes WIP,
* plugin size: adding an API,
* refactoring the code from the task app, to create a new MUC App
  system.
This commit is contained in:
John Livingston
2024-07-29 18:58:02 +02:00
parent 34da786b65
commit 074e688ed8
20 changed files with 496 additions and 32 deletions

View File

@ -3,35 +3,19 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { api } from '@converse/headless'
import { CustomElement } from 'shared/components/element.js'
import { MUCApp } from '../../../shared/components/muc-app.js'
import { tplMUCTaskApp } from '../templates/muc-task-app.js'
import '../styles/muc-task-app.scss'
/**
* Custom Element to display the Task Application.
*/
export default class MUCTaskApp extends CustomElement {
static get properties () {
return {
model: { type: Object, attribute: true }, // mucModel
show: { type: Boolean, attribute: false }
}
}
async initialize () {
this.show = api.settings.get('livechat_task_app_restore') &&
(window.sessionStorage?.getItem?.('livechat-converse-task-app-show') === '1')
}
export default class MUCTaskApp extends MUCApp {
enableSettingName = 'livechat_task_app_restore'
sessionStorangeShowKey = 'livechat-converse-task-app-show'
render () {
return tplMUCTaskApp(this, this.model)
}
toggleApp () {
this.show = !this.show
window.sessionStorage?.setItem?.('livechat-converse-task-app-show', this.show ? '1' : '')
}
}
api.elements.define('livechat-converse-muc-task-app', MUCTaskApp)

View File

@ -1,51 +0,0 @@
/*
* SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
.conversejs {
livechat-converse-muc-task-app {
border: var(--occupants-border-left);
display: flex;
flex-flow: column nowrap;
flex: 0 1 100%;
padding: var(--occupants-padding);
.livechat-converse-muc-app-header {
column-gap: 0.25em;
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
font-family: var(--heading-font);
padding-left: 0;
margin-right: 1em;
width: 100%;
h5 {
color: var(--groupchats-header-color-dark);
display: inline;
flex-grow: 2;
}
.livechat-converse-muc-app-close {
background: unset;
border: 0;
}
}
.livechat-converse-muc-app-body {
padding-right: 2em; // let some place for the scrollbar.
overflow-y: auto;
}
}
&[livechat-converse-root-width="small"],
&[livechat-converse-root-width="medium"] {
converse-muc-chatarea livechat-converse-muc-task-app:not(.hidden) ~ * {
// on small and medium width, we hide all subsequent siblings of the task app
// (when app is not hidden)
display: none !important;
}
}
}