aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-account-avatar
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-account-avatar')
-rw-r--r--client/src/app/shared/shared-account-avatar/account-avatar.component.html21
-rw-r--r--client/src/app/shared/shared-account-avatar/account-avatar.component.ts25
2 files changed, 27 insertions, 19 deletions
diff --git a/client/src/app/shared/shared-account-avatar/account-avatar.component.html b/client/src/app/shared/shared-account-avatar/account-avatar.component.html
index 6bec0b5f3..ca4ceb12f 100644
--- a/client/src/app/shared/shared-account-avatar/account-avatar.component.html
+++ b/client/src/app/shared/shared-account-avatar/account-avatar.component.html
@@ -1,8 +1,15 @@
1<a *ngIf="account" [href]="href" target="_blank" rel="noopener noreferrer" [title]="title"> 1<ng-template #img>
2 <img 2 <img [class]="class" [src]="avatarUrl" i18n-alt alt="Account avatar" />
3 [class]="class" 3</ng-template>
4 [src]="avatarUrl" 4
5 i18n-alt 5<a *ngIf="account && href" [href]="href" target="_blank" rel="noopener noreferrer" [title]="title">
6 alt="Account avatar" 6 <ng-template *ngTemplateOutlet="img"></ng-template>
7 />
8</a> 7</a>
8
9<a *ngIf="account && internalHref" [routerLink]="internalHref" [title]="title">
10 <ng-template *ngTemplateOutlet="img"></ng-template>
11</a>
12
13<ng-container *ngIf="!account || (!href && !internalHref)">
14 <ng-template *ngTemplateOutlet="img"></ng-template>
15</ng-container>
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
index d5533d459..02a0a18bf 100644
--- a/client/src/app/shared/shared-account-avatar/account-avatar.component.ts
+++ b/client/src/app/shared/shared-account-avatar/account-avatar.component.ts
@@ -1,5 +1,4 @@
1import { Component, Input } from '@angular/core' 1import { Component, Input } from '@angular/core'
2import { Account as AccountInterface } from '@shared/models'
3import { Account } from '../shared-main/account/account.model' 2import { Account } from '../shared-main/account/account.model'
4 3
5@Component({ 4@Component({
@@ -8,21 +7,23 @@ import { Account } from '../shared-main/account/account.model'
8 templateUrl: './account-avatar.component.html' 7 templateUrl: './account-avatar.component.html'
9}) 8})
10export class AccountAvatarComponent { 9export class AccountAvatarComponent {
11 _href: string 10 @Input() account: {
12 _title: string 11 name: string
13 12 avatar?: { url?: string, path: string }
14 @Input() account: { name: string, avatar?: { url?: string }, url: string } 13 url: string
15 @Input() size = '36'
16 @Input() set href (value) {
17 this._href = value
18 } 14 }
15 @Input() size: '25' | '34' | '36' | '40' | '120' = '36'
16
17 // Use an external link
18 @Input() href: string
19 // Use routerLink
20 @Input() internalHref: string | string[]
21
19 @Input() set title (value) { 22 @Input() set title (value) {
20 this._title = value 23 this._title = value
21 } 24 }
22 25
23 get href () { 26 private _title: string
24 return this._href || this.account?.url
25 }
26 27
27 get title () { 28 get title () {
28 return this._title || $localize`${this.account.name} (account page)` 29 return this._title || $localize`${this.account.name} (account page)`
@@ -33,6 +34,6 @@ export class AccountAvatarComponent {
33 } 34 }
34 35
35 get avatarUrl () { 36 get avatarUrl () {
36 return this.account?.avatar ? this.account.avatar.url : Account.GET_DEFAULT_AVATAR_URL() 37 return Account.GET_ACTOR_AVATAR_URL(this.account)
37 } 38 }
38} 39}