-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31c4e5a
commit 704e660
Showing
11 changed files
with
165 additions
and
22 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
conversejs/custom/plugins/notes/components/muc-note-occupant-view.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/> | ||
// | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
import { CustomElement } from 'shared/components/element.js' | ||
import { tplMucNoteOccupant } from '../templates/muc-note-occupant' | ||
import { api } from '@converse/headless' | ||
|
||
import '../styles/muc-note-occupant.scss' | ||
|
||
export default class MUCNoteOccupantView extends CustomElement { | ||
static get properties () { | ||
return { | ||
model: { type: Object, attribute: true }, | ||
full_display: { type: Boolean, attribute: true } | ||
} | ||
} | ||
|
||
async initialize () { | ||
this.listenTo(this.model, 'change', () => this.requestUpdate()) | ||
} | ||
|
||
render () { | ||
return tplMucNoteOccupant(this, this.model) | ||
} | ||
} | ||
|
||
api.elements.define('livechat-converse-muc-note-occupant', MUCNoteOccupantView) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
conversejs/custom/plugins/notes/styles/muc-note-occupant.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/> | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
.conversejs { | ||
livechat-converse-muc-note-occupant { | ||
display: flex; | ||
flex-flow: row nowrap; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 0.25em; | ||
|
||
& > a { | ||
display: flex; | ||
flex-flow: row nowrap; | ||
align-items: center; | ||
|
||
span { | ||
font-weight: bold; | ||
margin-left: 0.5em; | ||
max-width: 200px; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
} | ||
|
||
& > ul { | ||
list-style: none; | ||
text-align: right; | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
conversejs/custom/plugins/notes/templates/muc-note-occupant.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/> | ||
// | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
import { html } from 'lit' | ||
import { api } from '@converse/headless' | ||
import { getAuthorStyle } from '../../../../src/utils/color.js' | ||
import { __ } from 'i18n' | ||
|
||
export function tplMucNoteOccupant (el, occupant) { | ||
const authorStyle = getAuthorStyle(occupant) | ||
const jid = occupant.get('jid') | ||
const occupantId = occupant.get('occupant_id') | ||
|
||
return html` | ||
<a @click=${(ev) => { | ||
api.modal.show('converse-muc-occupant-modal', { model: occupant }, ev) | ||
}}> | ||
<converse-avatar | ||
.model=${occupant} | ||
class="avatar chat-msg__avatar" | ||
name="${occupant.getDisplayName()}" | ||
nonce=${occupant.vcard?.get('vcard_updated')} | ||
height="30" width="30"></converse-avatar> | ||
<span style=${authorStyle}>${occupant.getDisplayName()}</span> | ||
</a> | ||
${ | ||
el.full_display | ||
? html`<ul> | ||
${jid ? html`<li title=${__('XMPP Address')}>${jid}</li>` : ''} | ||
${occupantId ? html`<li title=${__('Occupant Id')}>${occupantId}</li>` : ''} | ||
</ul>` | ||
: '' | ||
} | ||
` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters