import { Component, Input } from '@angular/core'
-import { SafeResourceUrl } from '@angular/platform-browser'
import { VideoChannel } from '../shared-main'
import { Account } from '../shared-main/account/account.model'
templateUrl: './actor-avatar.component.html'
})
export class ActorAvatarComponent {
+ private _title: string
+
@Input() account: ActorInput
@Input() channel: ActorInput
- @Input() previewImage: SafeResourceUrl
+ @Input() previewImage: string
@Input() size: ActorAvatarSize
this._title = value
}
- private _title: string
-
get title () {
if (this._title) return this._title
if (this.account) return $localize`${this.account.name} (account page)`
return ''
}
- getClass (type: 'avatar' | 'initial') {
- const base = [ 'avatar' ]
-
- if (this.size) base.push(`avatar-${this.size}`)
-
- if (this.channel) base.push('channel')
- else base.push('account')
-
- if (type === 'initial' && this.initial) {
- base.push('initial')
- base.push(this.getColorTheme())
- }
-
- return base
- }
-
get defaultAvatarUrl () {
if (this.channel) return VideoChannel.GET_DEFAULT_AVATAR_URL()
return name.slice(0, 1)
}
+ getClass (type: 'avatar' | 'initial') {
+ const base = [ 'avatar' ]
+
+ if (this.size) base.push(`avatar-${this.size}`)
+
+ if (this.channel) base.push('channel')
+ else base.push('account')
+
+ if (type === 'initial' && this.initial) {
+ base.push('initial')
+ base.push(this.getColorTheme())
+ }
+
+ return base
+ }
+
hasActor () {
return !!this.account || !!this.channel
}