2021-04-14 22:56:59 +02:00
|
|
|
import { html } from "lit";
|
2021-02-22 20:20:19 +01:00
|
|
|
import { __ } from 'i18n';
|
2020-01-26 18:36:25 +01:00
|
|
|
import tpl_occupant from "./occupant.js";
|
|
|
|
|
2020-01-28 19:25:21 +01:00
|
|
|
|
2020-01-26 18:36:25 +01:00
|
|
|
const PRETTY_CHAT_STATUS = {
|
|
|
|
'offline': 'Offline',
|
|
|
|
'unavailable': 'Unavailable',
|
|
|
|
'xa': 'Extended Away',
|
|
|
|
'away': 'Away',
|
|
|
|
'dnd': 'Do not disturb',
|
|
|
|
'chat': 'Chattty',
|
|
|
|
'online': 'Online'
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-08-16 23:33:17 +02:00
|
|
|
export default (o) => {
|
|
|
|
const i18n_occupant_hint = (occupant) => __('Click to mention %1$s in your message.', occupant.get('nick'))
|
|
|
|
const i18n_participants = __('Participants');
|
2020-10-23 20:49:10 +02:00
|
|
|
const occupant_tpls = o.occupants.map(occupant => {
|
|
|
|
return tpl_occupant(Object.assign({
|
|
|
|
'jid': '',
|
|
|
|
'hint_show': PRETTY_CHAT_STATUS[occupant.get('show')],
|
2021-03-17 12:12:16 +01:00
|
|
|
'hint_occupant': i18n_occupant_hint(occupant),
|
|
|
|
'onOccupantClicked': o.onOccupantClicked
|
2020-10-23 20:49:10 +02:00
|
|
|
}, occupant.toJSON()));
|
|
|
|
});
|
|
|
|
|
2020-08-16 23:33:17 +02:00
|
|
|
return html`
|
|
|
|
<div class="occupants-header">
|
2021-11-14 09:09:58 +01:00
|
|
|
<i class="hide-occupants" @click=${o.closeSidebar}>
|
|
|
|
<converse-icon color="var(--text-color)" class="fa fa-times" size="1em"></converse-icon>
|
|
|
|
</i>
|
2020-08-16 23:33:17 +02:00
|
|
|
<div class="occupants-header--title">
|
|
|
|
<span class="occupants-heading">${i18n_participants}</span>
|
|
|
|
</div>
|
2020-01-27 13:20:23 +01:00
|
|
|
</div>
|
2020-08-16 23:33:17 +02:00
|
|
|
<div class="dragresize dragresize-occupants-left"></div>
|
2020-10-23 20:49:10 +02:00
|
|
|
<ul class="occupant-list">${occupant_tpls}</ul>
|
2020-08-16 23:33:17 +02:00
|
|
|
`;
|
|
|
|
}
|