1 import { Subscription } from 'rxjs'
2 import { Component, OnDestroy, OnInit } from '@angular/core'
3 import { MarkdownService } from '@app/core'
4 import { VideoChannel, VideoChannelService } from '@app/shared/shared-main'
5 import { I18n } from '@ngx-translate/i18n-polyfill'
8 selector: 'my-video-channel-about',
9 templateUrl: './video-channel-about.component.html',
10 styleUrls: [ './video-channel-about.component.scss' ]
12 export class VideoChannelAboutComponent implements OnInit, OnDestroy {
13 videoChannel: VideoChannel
17 private videoChannelSub: Subscription
21 private videoChannelService: VideoChannelService,
22 private markdownService: MarkdownService
26 // Parent get the video channel for us
27 this.videoChannelSub = this.videoChannelService.videoChannelLoaded
28 .subscribe(async videoChannel => {
29 this.videoChannel = videoChannel
31 this.descriptionHTML = await this.markdownService.textMarkdownToHTML(this.videoChannel.description)
32 this.supportHTML = await this.markdownService.enhancedMarkdownToHTML(this.videoChannel.support)
37 if (this.videoChannelSub) this.videoChannelSub.unsubscribe()
40 getVideoChannelDescription () {
41 if (this.descriptionHTML) return this.descriptionHTML
43 return this.i18n('No description')