render avatar

This commit is contained in:
Mads Rasmussen
2024-04-30 21:43:04 +02:00
parent 8c10090e7b
commit d393ae527b

View File

@@ -3,7 +3,7 @@ import type { UmbDocumentAuditLogModel } from '../../../audit-log/types.js';
import { UmbDocumentAuditLogRepository } from '../../../audit-log/index.js';
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '../../document-workspace.context-token.js';
import { TimeOptions, getDocumentHistoryTagStyleAndText } from './utils.js';
import { css, html, customElement, state, nothing, repeat } from '@umbraco-cms/backoffice/external/lit';
import { css, html, customElement, state, nothing, repeat, ifDefined } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
@@ -122,13 +122,12 @@ export class UmbDocumentWorkspaceViewInfoHistoryElement extends UmbLitElement {
(item) => {
const { text, style } = getDocumentHistoryTagStyleAndText(item.logType);
const user = this.#userMap.get(item.user.unique);
//const avatar = Array.isArray(user.avatarUrls) ? user.avatarUrls[1] : undefined;
// TODO: we need to get the absolute url for the avatars from the server
//const avatarUrl = avatar ? `${this._serverUrl}${avatar}` : undefined;
const userName = user?.name ?? 'Unknown';
const avatarUrl = Array.isArray(user?.avatarUrls) ? user.avatarUrls[1] : undefined;
return html`<umb-history-item .name=${userName} detail=${this.localize.date(item.timestamp, TimeOptions)}>
<uui-avatar slot="avatar" .name="${userName}" img-src=${ifDefined(avatarUrl)}></uui-avatar>
return html`<umb-history-item
.name=${user?.name ?? 'Unknown'}
detail=${this.localize.date(item.timestamp, TimeOptions)}>
<span class="log-type">
<uui-tag look=${style.look} color=${style.color}> ${this.localize.term(text.label)} </uui-tag>
${this.localize.term(text.desc, item.parameters)}