Przeglądaj źródła

fix(Station Queue): Add Song to Queue button should open Manage Station search tab

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 3 lat temu
rodzic
commit
f51725955c

+ 5 - 2
frontend/src/components/Queue.vue

@@ -79,7 +79,7 @@
 						!station.locked ||
 						(station.locked && isAdminOnly() && dismissedWarning))
 			"
-			@click="openModal('manageStation')"
+			@click="openModal('manageStation') & showManageStationTab('search')"
 		>
 			<i class="material-icons icon-with-button">queue</i>
 			<span class="optional-desktop-only-text"> Add Song To Queue </span>
@@ -257,7 +257,10 @@ export default {
 				}
 			});
 		},
-		...mapActions("modalVisibility", ["openModal"])
+		...mapActions("modalVisibility", ["openModal"]),
+		...mapActions({
+			showManageStationTab: "modals/manageStation/showTab"
+		})
 	}
 };
 </script>

+ 3 - 9
frontend/src/components/modals/ManageStation/index.vue

@@ -210,11 +210,6 @@ export default {
 		stationId: { type: String, default: "" },
 		sector: { type: String, default: "admin" }
 	},
-	data() {
-		return {
-			tab: "settings"
-		};
-	},
 	computed: {
 		...mapState({
 			loggedIn: state => state.user.auth.loggedIn,
@@ -222,6 +217,7 @@ export default {
 			role: state => state.user.auth.role
 		}),
 		...mapState("modals/manageStation", {
+			tab: state => state.tab,
 			station: state => state.station,
 			originalStation: state => state.originalStation,
 			songsList: state => state.songsList,
@@ -239,7 +235,7 @@ export default {
 				this.editStation(station);
 
 				if (!this.isOwnerOrAdmin() && this.station.partyMode)
-					this.tab = "search";
+					this.showTab("search");
 
 				const currentSong = res.data.station.currentSong
 					? res.data.station.currentSong
@@ -313,9 +309,6 @@ export default {
 		this.clearStation();
 	},
 	methods: {
-		showTab(tab) {
-			this.tab = tab;
-		},
 		isOwner() {
 			return this.loggedIn && this.userId === this.station.owner;
 		},
@@ -383,6 +376,7 @@ export default {
 			);
 		},
 		...mapActions("modals/manageStation", [
+			"showTab",
 			"editStation",
 			"setIncludedPlaylists",
 			"setExcludedPlaylists",

+ 7 - 0
frontend/src/store/modules/modals/manageStation.js

@@ -3,6 +3,7 @@
 export default {
 	namespaced: true,
 	state: {
+		tab: "settings",
 		originalStation: {},
 		station: {},
 		includedPlaylists: [],
@@ -13,6 +14,9 @@ export default {
 	},
 	getters: {},
 	actions: {
+		showTab: ({ commit }, tab) => {
+			commit("showTab", tab);
+		},
 		editStation: ({ commit }, station) => {
 			commit("editStation", station);
 		},
@@ -39,6 +43,9 @@ export default {
 		}
 	},
 	mutations: {
+		showTab(state, tab) {
+			state.tab = tab;
+		},
 		editStation(state, station) {
 			state.originalStation = JSON.parse(JSON.stringify(station));
 			state.station = JSON.parse(JSON.stringify(station));