]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-support-modal/support-modal.component.ts
Move to sass module
[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 => this.htmlSupport = r)
32
33 this.displayName = this.video
34 ? this.video.channel.displayName
35 : this.videoChannel.displayName
36
37 return modalRef
38 }
39 }