]>
Commit | Line | Data |
---|---|---|
100d9ce2 C |
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', | |
266947e5 | 9 | templateUrl: './support-modal.component.html' |
100d9ce2 C |
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) | |
9df52d66 C |
31 | .then(r => { |
32 | this.htmlSupport = r | |
33 | }) | |
100d9ce2 C |
34 | |
35 | this.displayName = this.video | |
36 | ? this.video.channel.displayName | |
37 | : this.videoChannel.displayName | |
38 | ||
39 | return modalRef | |
40 | } | |
41 | } |