]>
Commit | Line | Data |
---|---|---|
1 | import { Component, ElementRef, ViewChild } from '@angular/core' | |
2 | import { Notifier, UserService } from '@app/core' | |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | |
4 | ||
5 | @Component({ | |
6 | selector: 'my-welcome-modal', | |
7 | templateUrl: './welcome-modal.component.html', | |
8 | styleUrls: [ './welcome-modal.component.scss' ] | |
9 | }) | |
10 | export class WelcomeModalComponent { | |
11 | @ViewChild('modal', { static: true }) modal: ElementRef | |
12 | ||
13 | constructor ( | |
14 | private userService: UserService, | |
15 | private modalService: NgbModal, | |
16 | private notifier: Notifier | |
17 | ) { } | |
18 | ||
19 | show () { | |
20 | this.modalService.open(this.modal, { | |
21 | centered: true, | |
22 | backdrop: 'static', | |
23 | keyboard: false, | |
24 | size: 'lg' | |
25 | }) | |
26 | } | |
27 | ||
28 | doNotOpenAgain () { | |
29 | this.userService.updateMyProfile({ noWelcomeModal: true }) | |
30 | .subscribe( | |
31 | () => console.log('We will not open the welcome modal again.'), | |
32 | ||
33 | err => this.notifier.error(err.message) | |
34 | ) | |
35 | } | |
36 | } |