From 746018f6b81b40e8858303662ac9ec5ce59ac6eb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Apr 2021 11:49:34 +0200 Subject: Refactor actor avatar display --- .../account-avatar.component.ts | 62 ---------------------- 1 file changed, 62 deletions(-) delete mode 100644 client/src/app/shared/shared-account-avatar/account-avatar.component.ts (limited to 'client/src/app/shared/shared-account-avatar/account-avatar.component.ts') diff --git a/client/src/app/shared/shared-account-avatar/account-avatar.component.ts b/client/src/app/shared/shared-account-avatar/account-avatar.component.ts deleted file mode 100644 index 76b696566..000000000 --- a/client/src/app/shared/shared-account-avatar/account-avatar.component.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Component, Input } from '@angular/core' -import { Account } from '../shared-main/account/account.model' - -@Component({ - selector: 'my-account-avatar', - styleUrls: [ './account-avatar.component.scss' ], - templateUrl: './account-avatar.component.html' -}) -export class AccountAvatarComponent { - @Input() account: { - name: string - avatar?: { url?: string, path: string } - url: string - } - @Input() size: '25' | '32' | '34' | '36' | '40' | '120' = '36' - - // Use an external link - @Input() href: string - // Use routerLink - @Input() internalHref: string | string[] - - @Input() set title (value) { - this._title = value - } - - defaultAvatarUrl = Account.GET_DEFAULT_AVATAR_URL() - - private _title: string - - get title () { - return this._title || $localize`${this.account.name} (account page)` - } - - get class () { - return `avatar avatar-${this.size}` + (this.avatarUrl ? '' : ` initial ${this.getColorTheme()}`) - } - - get avatarUrl () { - return Account.GET_ACTOR_AVATAR_URL(this.account) - } - - get initial () { - return this.account?.name.slice(0, 1) - } - - private getColorTheme () { - const themes = { - abc: 'blue', - def: 'green', - ghi: 'purple', - jkl: 'gray', - mno: 'yellow', - pqr: 'orange', - stv: 'red', - wxyz: 'dark-blue' - } - - const theme = Object.keys(themes).find(chars => chars.includes(this.initial)) - - return themes[theme] - } -} -- cgit v1.2.3