]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-support-modal/support-modal.component.ts
Merge branch 'release/4.3.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-support-modal / support-modal.component.ts
1 import { Component, Input, ViewChild } from '@angular/core'
2 import { MarkdownService } from '@app/core'
3 import { VideoDetails } from '@app/shared/shared-main'
4 import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
5 import { VideoChannel } from '@shared/models'
6
7 @Component({
8 selector: 'my-support-modal',
9 templateUrl: './support-modal.component.html'
10 })
11 export class SupportModalComponent {
12 @Input() video: VideoDetails = null
13 @Input() videoChannel: VideoChannel = null
14
15 @ViewChild('modal', { static: true }) modal: NgbModal
16
17 htmlSupport = ''
18 displayName = ''
19
20 constructor (
21 private markdownService: MarkdownService,
22 private modalService: NgbModal
23 ) { }
24
25 show () {
26 const modalRef = this.modalService.open(this.modal, { centered: true })
27
28 const support = this.video?.support || this.videoChannel.support
29
30 this.markdownService.enhancedMarkdownToHTML(support)
31 .then(r => {
32 this.htmlSupport = r
33 })
34
35 this.displayName = this.video
36 ? this.video.channel.displayName
37 : this.videoChannel.displayName
38
39 return modalRef
40 }
41 }