Selaa lähdekoodia

Updated WhatIsNew Modal to only show after the second visit of the site

theflametrooper 8 vuotta sitten
vanhempi
commit
1c70f84036

+ 1 - 1
frontend/components/Admin/Stations.vue

@@ -114,7 +114,7 @@
 			},
 			createStation: function () {
 				let _this = this;
-				let {newStation: {name, displayName, description, genres, blacklistedGenres}} = this;
+				let { newStation: { name, displayName, description, genres, blacklistedGenres } } = this;
 
 				if (name == undefined) return Toast.methods.addToast('Field (Name) cannot be empty', 3000);
 				if (displayName == undefined) return Toast.methods.addToast('Field (Display Name) cannot be empty', 3000);

+ 4 - 2
frontend/components/Modals/WhatIsNew.vue

@@ -51,11 +51,11 @@
 		},
 		ready: function () {
 			let _this = this;
-			io.getSocket(true, (socket) => {
+			io.getSocket(true, socket => {
 				_this.socket = socket;
 				_this.socket.emit('news.newest', res => {
 					_this.news = res.data;
-					if (_this.news) {
+					if (_this.news && localStorage.getItem('firstVisited')) {
 						if (localStorage.getItem('whatIsNew')) {
 							if (parseInt(localStorage.getItem('whatIsNew')) < res.data.createdAt) {
 								this.toggleModal();
@@ -65,6 +65,8 @@
 							this.toggleModal();
 							localStorage.setItem('whatIsNew', res.data.createdAt);
 						}
+					} else {
+						if (!localStorage.getItem('firstVisited')) localStorage.setItem('firstVisited', Date.now());
 					}
 				});
 			});