aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
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
parent4024c44f9027a32809931de0692d40d001df721c (diff)
downloadPeerTube-9929fbd6f4e209346cd31d05888417a94949da84.tar.gz
PeerTube-9929fbd6f4e209346cd31d05888417a94949da84.tar.zst
PeerTube-9929fbd6f4e209346cd31d05888417a94949da84.zip
Fix welcome/warning modal
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/modal/instance-config-warning-modal.component.ts14
-rw-r--r--client/src/app/modal/welcome-modal.component.ts10
2 files changed, 24 insertions, 0 deletions
diff --git a/client/src/app/modal/instance-config-warning-modal.component.ts b/client/src/app/modal/instance-config-warning-modal.component.ts
index c42413fc0..8bf7672be 100644
--- a/client/src/app/modal/instance-config-warning-modal.component.ts
+++ b/client/src/app/modal/instance-config-warning-modal.component.ts
@@ -1,6 +1,8 @@
1import { Location } from '@angular/common'
1import { Component, ElementRef, ViewChild } from '@angular/core' 2import { Component, ElementRef, ViewChild } from '@angular/core'
2import { Notifier, UserService } from '@app/core' 3import { Notifier, UserService } from '@app/core'
3import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 4import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
5import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
4import { About } from '@shared/models/server' 6import { About } from '@shared/models/server'
5 7
6@Component({ 8@Component({
@@ -14,13 +16,23 @@ export class InstanceConfigWarningModalComponent {
14 stopDisplayModal = false 16 stopDisplayModal = false
15 about: About 17 about: About
16 18
19 private LOCAL_STORAGE_KEYS = {
20 NO_INSTANCE_CONFIG_WARNING_MODAL: 'no_instance_config_warning_modal'
21 }
22
17 constructor ( 23 constructor (
18 private userService: UserService, 24 private userService: UserService,
25 private location: Location,
19 private modalService: NgbModal, 26 private modalService: NgbModal,
20 private notifier: Notifier 27 private notifier: Notifier
21 ) { } 28 ) { }
22 29
23 show (about: About) { 30 show (about: About) {
31 const result = peertubeLocalStorage.getItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL)
32 if (result === 'true') return
33
34 if (this.location.path().startsWith('/admin/config/edit-custom')) return
35
24 this.about = about 36 this.about = about
25 37
26 const ref = this.modalService.open(this.modal, { centered: true }) 38 const ref = this.modalService.open(this.modal, { centered: true })
@@ -35,6 +47,8 @@ export class InstanceConfigWarningModalComponent {
35 } 47 }
36 48
37 private doNotOpenAgain () { 49 private doNotOpenAgain () {
50 peertubeLocalStorage.setItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL, 'true')
51
38 this.userService.updateMyProfile({ noInstanceConfigWarningModal: true }) 52 this.userService.updateMyProfile({ noInstanceConfigWarningModal: true })
39 .subscribe( 53 .subscribe(
40 () => console.log('We will not open the instance config warning modal again.'), 54 () => console.log('We will not open the instance config warning modal again.'),
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.'),