aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/modal/welcome-modal.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-20 15:11:00 +0200
committerChocobozzz <me@florianbigard.com>2021-04-20 15:18:37 +0200
commit9929fbd6f4e209346cd31d05888417a94949da84 (patch)
tree762006f2e0eb2d0cb094dc97b407ae5ea35689a1 /client/src/app/modal/welcome-modal.component.ts
parent4024c44f9027a32809931de0692d40d001df721c (diff)
downloadPeerTube-9929fbd6f4e209346cd31d05888417a94949da84.tar.gz
PeerTube-9929fbd6f4e209346cd31d05888417a94949da84.tar.zst
PeerTube-9929fbd6f4e209346cd31d05888417a94949da84.zip
Fix welcome/warning modal
Diffstat (limited to 'client/src/app/modal/welcome-modal.component.ts')
-rw-r--r--client/src/app/modal/welcome-modal.component.ts10
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 @@
1import { Component, ElementRef, ViewChild } from '@angular/core' 1import { Component, ElementRef, ViewChild } from '@angular/core'
2import { Notifier, UserService } from '@app/core' 2import { Notifier, UserService } from '@app/core'
3import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 3import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
4import { 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'
10export class WelcomeModalComponent { 11export 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.'),