Browse Source

feat: modals can now be easily stacked

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 4 years ago
parent
commit
75556c57d4

+ 0 - 1
frontend/src/App.vue

@@ -98,7 +98,6 @@ export default {
 			shift: false,
 			ctrl: false,
 			handler: () => {
-				console.log(this.currentlyActive);
 				if (Object.keys(this.currentlyActive).length !== 0)
 					this.closeCurrentModal();
 			}

+ 2 - 1
frontend/src/components/modals/EditPlaylist/components/PlaylistSongItem.vue

@@ -34,8 +34,9 @@
 			<i
 				class="material-icons"
 				@click="showPlaylistDropdown = !showPlaylistDropdown"
-				>queue</i
 			>
+				queue
+			</i>
 		</div>
 	</div>
 </template>

+ 9 - 8
frontend/src/store/modules/modalVisibility.js

@@ -26,7 +26,7 @@ const state = {
 			viewPunishment: false
 		}
 	},
-	currentlyActive: {}
+	currentlyActive: []
 };
 
 const getters = {};
@@ -37,7 +37,9 @@ const actions = {
 			const recaptchaEnabled = await lofig.get("recaptcha.enabled");
 			if (recaptchaEnabled) window.location.reload();
 		}
+
 		commit("closeModal", data);
+		commit("closeCurrentModal");
 	},
 	openModal: ({ commit }, data) => {
 		commit("openModal", data);
@@ -49,18 +51,17 @@ const actions = {
 
 const mutations = {
 	closeModal(state, data) {
-		const { sector, modal } = data;
-		state.modals[sector][modal] = false;
+		state.modals[data.sector][data.modal] = false;
 	},
 	openModal(state, data) {
-		const { sector, modal } = data;
-		state.modals[sector][modal] = true;
-		state.currentlyActive = { sector, modal };
+		state.modals[data.sector][data.modal] = true;
+		state.currentlyActive.unshift(data);
 	},
 	closeCurrentModal(state) {
-		const { sector, modal } = state.currentlyActive;
+		const { sector, modal } = state.currentlyActive[0];
 		state.modals[sector][modal] = false;
-		state.currentlyActive = {};
+
+		state.currentlyActive.shift();
 	}
 };