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