]>
Commit | Line | Data |
---|---|---|
43d0ea7f | 1 | import { Component, ElementRef, ViewChild } from '@angular/core' |
67ed6552 | 2 | import { Notifier, UserService } from '@app/core' |
43d0ea7f | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
43d0ea7f C |
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 () { | |
24e7916c RK |
20 | this.modalService.open(this.modal, { |
21 | centered: true, | |
43d0ea7f C |
22 | backdrop: 'static', |
23 | keyboard: false, | |
24 | size: 'lg' | |
25 | }) | |
43d0ea7f C |
26 | } |
27 | ||
4618b686 | 28 | doNotOpenAgain () { |
43d0ea7f C |
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 | ) | |
43d0ea7f C |
35 | } |
36 | } |