1 import { Component, Input } from '@angular/core'
2 import { Account } from '../shared-main/account/account.model'
5 selector: 'my-account-avatar',
6 styleUrls: [ './account-avatar.component.scss' ],
7 templateUrl: './account-avatar.component.html'
9 export class AccountAvatarComponent {
12 avatar?: { url?: string, path: string }
15 @Input() size: '25' | '32' | '34' | '36' | '40' | '120' = '36'
17 // Use an external link
20 @Input() internalHref: string | string[]
22 @Input() set title (value) {
26 defaultAvatarUrl = Account.GET_DEFAULT_AVATAR_URL()
28 private _title: string
31 return this._title || $localize`${this.account.name} (account page)`
35 return `avatar avatar-${this.size}` + (this.avatarUrl ? '' : ` initial ${this.getColorTheme()}`)
39 return Account.GET_ACTOR_AVATAR_URL(this.account)
43 return this.account?.name.slice(0, 1)
46 private getColorTheme () {
58 const theme = Object.keys(themes).find(chars => chars.includes(this.initial))