]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts
Fix player lint
[github/Chocobozzz/PeerTube.git] / client / src / app / +video-channels / video-channel-about / video-channel-about.component.ts
CommitLineData
734a5ceb 1import { Component, OnDestroy, OnInit } from '@angular/core'
170726f5 2import { ActivatedRoute } from '@angular/router'
170726f5
C
3import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
4import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
b1d40cff 5import { I18n } from '@ngx-translate/i18n-polyfill'
734a5ceb 6import { Subscription } from 'rxjs'
53055a11 7import { MarkdownService } from '@app/videos/shared'
170726f5
C
8
9@Component({
10 selector: 'my-video-channel-about',
11 templateUrl: './video-channel-about.component.html',
12 styleUrls: [ './video-channel-about.component.scss' ]
13})
734a5ceb 14export class VideoChannelAboutComponent implements OnInit, OnDestroy {
170726f5 15 videoChannel: VideoChannel
53055a11
C
16 descriptionHTML = ''
17 supportHTML = ''
170726f5 18
734a5ceb
C
19 private videoChannelSub: Subscription
20
170726f5 21 constructor (
b1d40cff
C
22 private route: ActivatedRoute,
23 private i18n: I18n,
53055a11
C
24 private videoChannelService: VideoChannelService,
25 private markdownService: MarkdownService
170726f5
C
26 ) { }
27
28 ngOnInit () {
29 // Parent get the video channel for us
734a5ceb 30 this.videoChannelSub = this.videoChannelService.videoChannelLoaded
53055a11
C
31 .subscribe(videoChannel => {
32 this.videoChannel = videoChannel
33
34 this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.videoChannel.description)
35 this.supportHTML = this.markdownService.enhancedMarkdownToHTML(this.videoChannel.support)
36 })
170726f5
C
37 }
38
734a5ceb
C
39 ngOnDestroy () {
40 if (this.videoChannelSub) this.videoChannelSub.unsubscribe()
41 }
42
170726f5 43 getVideoChannelDescription () {
53055a11 44 if (this.descriptionHTML) return this.descriptionHTML
170726f5 45
b1d40cff 46 return this.i18n('No description')
170726f5
C
47 }
48}