]>
Commit | Line | Data |
---|---|---|
67ed6552 | 1 | import { Subscription } from 'rxjs' |
734a5ceb | 2 | import { Component, OnDestroy, OnInit } from '@angular/core' |
67ed6552 C |
3 | import { MarkdownService } from '@app/core' |
4 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' | |
170726f5 C |
5 | |
6 | @Component({ | |
7 | selector: 'my-video-channel-about', | |
8 | templateUrl: './video-channel-about.component.html', | |
9 | styleUrls: [ './video-channel-about.component.scss' ] | |
10 | }) | |
734a5ceb | 11 | export class VideoChannelAboutComponent implements OnInit, OnDestroy { |
170726f5 | 12 | videoChannel: VideoChannel |
53055a11 C |
13 | descriptionHTML = '' |
14 | supportHTML = '' | |
170726f5 | 15 | |
734a5ceb C |
16 | private videoChannelSub: Subscription |
17 | ||
170726f5 | 18 | constructor ( |
53055a11 C |
19 | private videoChannelService: VideoChannelService, |
20 | private markdownService: MarkdownService | |
170726f5 C |
21 | ) { } |
22 | ||
23 | ngOnInit () { | |
24 | // Parent get the video channel for us | |
734a5ceb | 25 | this.videoChannelSub = this.videoChannelService.videoChannelLoaded |
41d71344 | 26 | .subscribe(async videoChannel => { |
53055a11 C |
27 | this.videoChannel = videoChannel |
28 | ||
41d71344 C |
29 | this.descriptionHTML = await this.markdownService.textMarkdownToHTML(this.videoChannel.description) |
30 | this.supportHTML = await this.markdownService.enhancedMarkdownToHTML(this.videoChannel.support) | |
53055a11 | 31 | }) |
170726f5 C |
32 | } |
33 | ||
734a5ceb C |
34 | ngOnDestroy () { |
35 | if (this.videoChannelSub) this.videoChannelSub.unsubscribe() | |
36 | } | |
37 | ||
170726f5 | 38 | getVideoChannelDescription () { |
53055a11 | 39 | if (this.descriptionHTML) return this.descriptionHTML |
170726f5 | 40 | |
66357162 | 41 | return $localize`No description` |
170726f5 C |
42 | } |
43 | } |