diff options
Diffstat (limited to 'client/src/app/modal/welcome-modal.component.ts')
-rw-r--r-- | client/src/app/modal/welcome-modal.component.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/client/src/app/modal/welcome-modal.component.ts b/client/src/app/modal/welcome-modal.component.ts index c2f289600..72ae20b43 100644 --- a/client/src/app/modal/welcome-modal.component.ts +++ b/client/src/app/modal/welcome-modal.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, ElementRef, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, ViewChild } from '@angular/core' |
2 | import { Notifier, UserService } from '@app/core' | 2 | import { Notifier, UserService } from '@app/core' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | ||
4 | 5 | ||
5 | @Component({ | 6 | @Component({ |
6 | selector: 'my-welcome-modal', | 7 | selector: 'my-welcome-modal', |
@@ -10,6 +11,10 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | |||
10 | export class WelcomeModalComponent { | 11 | export class WelcomeModalComponent { |
11 | @ViewChild('modal', { static: true }) modal: ElementRef | 12 | @ViewChild('modal', { static: true }) modal: ElementRef |
12 | 13 | ||
14 | private LOCAL_STORAGE_KEYS = { | ||
15 | NO_WELCOME_MODAL: 'no_welcome_modal' | ||
16 | } | ||
17 | |||
13 | constructor ( | 18 | constructor ( |
14 | private userService: UserService, | 19 | private userService: UserService, |
15 | private modalService: NgbModal, | 20 | private modalService: NgbModal, |
@@ -17,6 +22,9 @@ export class WelcomeModalComponent { | |||
17 | ) { } | 22 | ) { } |
18 | 23 | ||
19 | show () { | 24 | show () { |
25 | const result = peertubeLocalStorage.getItem(this.LOCAL_STORAGE_KEYS.NO_WELCOME_MODAL) | ||
26 | if (result === 'true') return | ||
27 | |||
20 | this.modalService.open(this.modal, { | 28 | this.modalService.open(this.modal, { |
21 | centered: true, | 29 | centered: true, |
22 | backdrop: 'static', | 30 | backdrop: 'static', |
@@ -26,6 +34,8 @@ export class WelcomeModalComponent { | |||
26 | } | 34 | } |
27 | 35 | ||
28 | doNotOpenAgain () { | 36 | doNotOpenAgain () { |
37 | peertubeLocalStorage.setItem(this.LOCAL_STORAGE_KEYS.NO_WELCOME_MODAL, 'true') | ||
38 | |||
29 | this.userService.updateMyProfile({ noWelcomeModal: true }) | 39 | this.userService.updateMyProfile({ noWelcomeModal: true }) |
30 | .subscribe( | 40 | .subscribe( |
31 | () => console.log('We will not open the welcome modal again.'), | 41 | () => console.log('We will not open the welcome modal again.'), |