2024-05-23 09:42:14 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-07-11 15:53:50 +00:00
|
|
|
import { api } from '@converse/headless'
|
2024-05-11 15:37:20 +00:00
|
|
|
import { CustomElement } from 'shared/components/element.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 () {
|
2024-05-12 14:02:13 +00:00
|
|
|
this.show = api.settings.get('livechat_task_app_restore') &&
|
|
|
|
(window.sessionStorage?.getItem?.('livechat-converse-task-app-show') === '1')
|
2024-05-11 15:37:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
return tplMUCTaskApp(this, this.model)
|
|
|
|
}
|
|
|
|
|
|
|
|
toggleApp () {
|
|
|
|
this.show = !this.show
|
2024-05-12 14:02:13 +00:00
|
|
|
window.sessionStorage?.setItem?.('livechat-converse-task-app-show', this.show ? '1' : '')
|
2024-05-11 15:37:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
api.elements.define('livechat-converse-muc-task-app', MUCTaskApp)
|