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