import tpl_group from "./group.js"; import { __ } from 'i18n'; import { _converse, api } from "@converse/headless/core"; import { contactsComparator, groupsComparator } from '@converse/headless/plugins/roster/utils.js'; import { html } from "lit"; import { repeat } from 'lit/directives/repeat.js'; import { shouldShowContact, shouldShowGroup, populateContactsMap } from '../utils.js'; export default (el) => { const i18n_heading_contacts = __('Contacts'); const i18n_title_add_contact = __('Add a contact'); const i18n_title_sync_contacts = __('Re-sync your contacts'); const roster = _converse.roster || []; const contacts_map = roster.reduce((acc, contact) => populateContactsMap(acc, contact), {}); const groupnames = Object.keys(contacts_map).filter(shouldShowGroup); groupnames.sort(groupsComparator); return html`