]>
Commit | Line | Data |
---|---|---|
c2caa99b RK |
1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { Video } from '../video/video.model' | |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | |
dd4f25ee RK |
4 | |
5 | @Component({ | |
6 | selector: 'avatar-channel', | |
7 | templateUrl: './avatar.component.html', | |
8 | styleUrls: [ './avatar.component.scss' ] | |
9 | }) | |
c2caa99b RK |
10 | export class AvatarComponent implements OnInit { |
11 | @Input() video: Video | |
12 | @Input() size: 'md' | 'sm' = 'md' | |
b40a2193 | 13 | @Input() genericChannel: boolean |
c2caa99b RK |
14 | |
15 | channelLinkTitle = '' | |
16 | accountLinkTitle = '' | |
17 | ||
18 | constructor ( | |
19 | private i18n: I18n | |
20 | ) {} | |
21 | ||
22 | ngOnInit () { | |
23 | this.channelLinkTitle = this.i18n( | |
d6d951dd | 24 | '{{name}} (channel page)', |
c2caa99b RK |
25 | { name: this.video.channel.name, handle: this.video.byVideoChannel } |
26 | ) | |
27 | this.accountLinkTitle = this.i18n( | |
d6d951dd | 28 | '{{name}} (account page)', |
c2caa99b RK |
29 | { name: this.video.account.name, handle: this.video.byAccount } |
30 | ) | |
31 | } | |
b40a2193 K |
32 | |
33 | isChannelAvatarNull () { | |
34 | return this.video.channel.avatar === null | |
35 | } | |
dd4f25ee | 36 | } |