aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/modal/welcome-modal.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-28 14:40:06 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-09-05 10:17:02 +0200
commit43d0ea7f4b88d52097172cc0c1831edd7e492503 (patch)
treed950f0a365bc1d7086992a686a06c335e14a9be9 /client/src/app/modal/welcome-modal.component.ts
parentbc20aaed463b1fc6727a2a90a7d7c4a00b95142a (diff)
downloadPeerTube-43d0ea7f4b88d52097172cc0c1831edd7e492503.tar.gz
PeerTube-43d0ea7f4b88d52097172cc0c1831edd7e492503.tar.zst
PeerTube-43d0ea7f4b88d52097172cc0c1831edd7e492503.zip
Add welcome modal
Diffstat (limited to 'client/src/app/modal/welcome-modal.component.ts')
-rw-r--r--client/src/app/modal/welcome-modal.component.ts40
1 files changed, 40 insertions, 0 deletions
diff --git a/client/src/app/modal/welcome-modal.component.ts b/client/src/app/modal/welcome-modal.component.ts
new file mode 100644
index 000000000..bff2968d4
--- /dev/null
+++ b/client/src/app/modal/welcome-modal.component.ts
@@ -0,0 +1,40 @@
1import { Component, ElementRef, ViewChild } from '@angular/core'
2import { Notifier } from '@app/core'
3import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
4import { UserService } from '@app/shared'
5
6@Component({
7 selector: 'my-welcome-modal',
8 templateUrl: './welcome-modal.component.html',
9 styleUrls: [ './welcome-modal.component.scss' ]
10})
11export class WelcomeModalComponent {
12 @ViewChild('modal', { static: true }) modal: ElementRef
13
14 constructor (
15 private userService: UserService,
16 private modalService: NgbModal,
17 private notifier: Notifier
18 ) { }
19
20 show () {
21 const ref = this.modalService.open(this.modal,{
22 backdrop: 'static',
23 keyboard: false,
24 size: 'lg'
25 })
26
27 ref.result.finally(() => this.doNotOpenAgain())
28 }
29
30 private doNotOpenAgain () {
31 this.userService.updateMyProfile({ noWelcomeModal: true })
32 .subscribe(
33 () => console.log('We will not open the welcome modal again.'),
34
35 err => this.notifier.error(err.message)
36 )
37
38 return true
39 }
40}