1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
3 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
4 import { I18n } from '@ngx-translate/i18n-polyfill'
5 import { Subscription } from 'rxjs'
6 import { MarkdownService } from '@app/shared/renderer'
9 selector: 'my-video-channel-about',
10 templateUrl: './video-channel-about.component.html',
11 styleUrls: [ './video-channel-about.component.scss' ]
13 export class VideoChannelAboutComponent implements OnInit, OnDestroy {
14 videoChannel: VideoChannel
18 private videoChannelSub: Subscription
22 private videoChannelService: VideoChannelService,
23 private markdownService: MarkdownService
27 // Parent get the video channel for us
28 this.videoChannelSub = this.videoChannelService.videoChannelLoaded
29 .subscribe(async videoChannel => {
30 this.videoChannel = videoChannel
32 this.descriptionHTML = await this.markdownService.textMarkdownToHTML(this.videoChannel.description)
33 this.supportHTML = await this.markdownService.enhancedMarkdownToHTML(this.videoChannel.support)
38 if (this.videoChannelSub) this.videoChannelSub.unsubscribe()
41 getVideoChannelDescription () {
42 if (this.descriptionHTML) return this.descriptionHTML
44 return this.i18n('No description')