]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/modal/instance-config-warning-modal.component.ts
Add ListOverflow component to prevent sub-menu overflow
[github/Chocobozzz/PeerTube.git] / client / src / app / modal / instance-config-warning-modal.component.ts
CommitLineData
43d0ea7f
C
1import { Component, ElementRef, ViewChild } from '@angular/core'
2import { Notifier } from '@app/core'
43d0ea7f 3import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
589d9f55
C
4import { About } from '@shared/models/server'
5import { UserService } from '@app/shared'
43d0ea7f
C
6
7@Component({
8 selector: 'my-instance-config-warning-modal',
9 templateUrl: './instance-config-warning-modal.component.html',
10 styleUrls: [ './instance-config-warning-modal.component.scss' ]
11})
12export class InstanceConfigWarningModalComponent {
13 @ViewChild('modal', { static: true }) modal: ElementRef
14
589d9f55
C
15 stopDisplayModal = false
16 about: About
17
43d0ea7f 18 constructor (
589d9f55 19 private userService: UserService,
43d0ea7f 20 private modalService: NgbModal,
589d9f55 21 private notifier: Notifier
43d0ea7f
C
22 ) { }
23
589d9f55
C
24 show (about: About) {
25 this.about = about
26
24e7916c 27 const ref = this.modalService.open(this.modal, { centered: true })
589d9f55
C
28
29 ref.result.finally(() => {
30 if (this.stopDisplayModal === true) this.doNotOpenAgain()
31 })
32 }
33
592c735c
C
34 isDefaultShortDescription (description: string) {
35 return description === 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly ' +
36 'in the web browser with WebTorrent and Angular.'
37 }
38
589d9f55
C
39 private doNotOpenAgain () {
40 this.userService.updateMyProfile({ noInstanceConfigWarningModal: true })
41 .subscribe(
42 () => console.log('We will not open the instance config warning modal again.'),
43
44 err => this.notifier.error(err.message)
45 )
43d0ea7f
C
46 }
47}