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'
8 selector: 'my-support-modal',
9 templateUrl: './support-modal.component.html',
10 styleUrls: [ './support-modal.component.scss' ]
12 export class SupportModalComponent {
13 @Input() video: VideoDetails = null
14 @Input() videoChannel: VideoChannel = null
16 @ViewChild('modal', { static: true }) modal: NgbModal
22 private markdownService: MarkdownService,
23 private modalService: NgbModal
27 const modalRef = this.modalService.open(this.modal, { centered: true })
29 const support = this.video?.support || this.videoChannel.support
31 this.markdownService.enhancedMarkdownToHTML(support)
32 .then(r => this.htmlSupport = r)
34 this.displayName = this.video
35 ? this.video.channel.displayName
36 : this.videoChannel.displayName