]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-account-avatar/account-avatar.component.ts
Add AccountAvatarComponent (#3965)
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-account-avatar / account-avatar.component.ts
1 import { Component, Input } from '@angular/core'
2 import { Account as AccountInterface } from '@shared/models'
3 import { Account } from '../shared-main/account/account.model'
4
5 @Component({
6 selector: 'my-account-avatar',
7 styleUrls: [ './account-avatar.component.scss' ],
8 templateUrl: './account-avatar.component.html'
9 })
10 export class AccountAvatarComponent {
11 _href: string
12 _title: string
13
14 @Input() account: { name: string, avatar?: { url?: string }, url: string }
15 @Input() size = '36'
16 @Input() set href (value) {
17 this._href = value
18 }
19 @Input() set title (value) {
20 this._title = value
21 }
22
23 get href () {
24 return this._href || this.account?.url
25 }
26
27 get title () {
28 return this._title || $localize`${this.account.name} (account page)`
29 }
30
31 get class () {
32 return `avatar avatar-${this.size}`
33 }
34
35 get avatarUrl () {
36 return this.account?.avatar ? this.account.avatar.url : Account.GET_DEFAULT_AVATAR_URL()
37 }
38 }