1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute } from '@angular/router'
3 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
4 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
5 import { I18n } from '@ngx-translate/i18n-polyfill'
6 import { Subscription } from 'rxjs'
7 import { MarkdownService } from '@app/videos/shared'
10 selector: 'my-video-channel-about',
11 templateUrl: './video-channel-about.component.html',
12 styleUrls: [ './video-channel-about.component.scss' ]
14 export class VideoChannelAboutComponent implements OnInit, OnDestroy {
15 videoChannel: VideoChannel
19 private videoChannelSub: Subscription
22 private route: ActivatedRoute,
24 private videoChannelService: VideoChannelService,
25 private markdownService: MarkdownService
29 // Parent get the video channel for us
30 this.videoChannelSub = this.videoChannelService.videoChannelLoaded
31 .subscribe(videoChannel => {
32 this.videoChannel = videoChannel
34 this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.videoChannel.description)
35 this.supportHTML = this.markdownService.enhancedMarkdownToHTML(this.videoChannel.support)
40 if (this.videoChannelSub) this.videoChannelSub.unsubscribe()
43 getVideoChannelDescription () {
44 if (this.descriptionHTML) return this.descriptionHTML
46 return this.i18n('No description')