]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/shared-support-modal/support-modal.component.ts
Support ICU in TS components
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-support-modal / support-modal.component.ts
CommitLineData
100d9ce2
C
1import { Component, Input, ViewChild } from '@angular/core'
2import { MarkdownService } from '@app/core'
3import { VideoDetails } from '@app/shared/shared-main'
4import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
5import { VideoChannel } from '@shared/models'
6
7@Component({
8 selector: 'my-support-modal',
266947e5 9 templateUrl: './support-modal.component.html'
100d9ce2
C
10})
11export 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}