aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/account/avatar.component.ts
blob: 31f39c20013336d0906d2f3a31351192d7b94aaa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { Component, Input, OnInit } from '@angular/core'
import { Video } from '../video/video.model'
import { I18n } from '@ngx-translate/i18n-polyfill'

@Component({
  selector: 'avatar-channel',
  templateUrl: './avatar.component.html',
  styleUrls: [ './avatar.component.scss' ]
})
export class AvatarComponent implements OnInit {
  @Input() video: Video
  @Input() size: 'md' | 'sm' = 'md'

  channelLinkTitle = ''
  accountLinkTitle = ''

  constructor (
    private i18n: I18n
  ) {}

  ngOnInit () {
    this.channelLinkTitle = this.i18n(
      '{{name}} (channel page)',
      { name: this.video.channel.name, handle: this.video.byVideoChannel }
    )
    this.accountLinkTitle = this.i18n(
      '{{name}} (account page)',
      { name: this.video.account.name, handle: this.video.byAccount }
    )
  }
}