import { __ } from 'i18n'; import { api } from "@converse/headless/core.js"; import { html } from "lit"; import { STATUSES } from '../constants.js'; const tplRemoveLink = (el, item) => { const display_name = item.getDisplayName(); const i18n_remove = __('Click to remove %1$s as a contact', display_name); return html` `; } export default (el, item) => { const show = item.presence.get('show') || 'offline'; let classes, color; if (show === 'online') { [classes, color] = ['fa fa-circle', 'chat-status-online']; } else if (show === 'dnd') { [classes, color] = ['fa fa-minus-circle', 'chat-status-busy']; } else if (show === 'away') { [classes, color] = ['fa fa-circle', 'chat-status-away']; } else { [classes, color] = ['fa fa-circle', 'subdued-color']; } const desc_status = STATUSES[show]; const num_unread = item.get('num_unread') || 0; const display_name = item.getDisplayName(); const i18n_chat = __('Click to chat with %1$s (XMPP address: %2$s)', display_name, el.model.get('jid')); return html` ${ num_unread ? html`${ num_unread }` : '' } ${display_name} ${ api.settings.get('allow_contact_removal') ? tplRemoveLink(el, item) : '' }`; }