import {LitElement, html} from './lit-all.min.js'; import * as tfrpc from '/static/tfrpc.js'; import {styles} from './tf-styles.js'; class TfUserElement extends LitElement { static get properties() { return { id: {type: String}, users: {type: Object}, }; } static styles = styles; constructor() { super(); this.id = null; this.users = {}; } render() { let image = html`?`; let name = this.users?.[this.id]?.name; name = name !== undefined ? html`${name}` : html`${this.id}`; if (this.users[this.id]) { let image_link = this.users[this.id].image; image_link = typeof image_link == 'string' ? image_link : image_link?.link; if (image_link !== undefined) { image = html``; } } return html`
${image} ${name}
`; } } customElements.define('tf-user', TfUserElement);