Browse Source

fix: station editsong local paused didn't work anymore

Kristian Vos 2 years ago
parent
commit
d2f0356e0b
1 changed files with 23 additions and 12 deletions
  1. 23 12
      frontend/src/pages/Station/index.vue

+ 23 - 12
frontend/src/pages/Station/index.vue

@@ -903,18 +903,29 @@ export default {
 		})
 		})
 	},
 	},
 	async mounted() {
 	async mounted() {
-		// TODO fix
-		// this.editSongModalWatcher = this.$store.watch(
-		// 	state => state.modals.editSong.video.paused,
-		// 	paused => {
-		// 		if (paused && !this.beforeEditSongModalLocalPaused) {
-		// 			this.resumeLocalStation();
-		// 		} else if (!paused) {
-		// 			this.beforeEditSongModalLocalPaused = this.localPaused;
-		// 			this.pauseLocalStation();
-		// 		}
-		// 	}
-		// );
+		this.editSongModalWatcher = this.$store.watch(
+			state =>
+				state.modalVisibility.activeModals.length > 0 &&
+				state.modalVisibility.modals[
+					state.modalVisibility.activeModals[
+						state.modalVisibility.activeModals.length - 1
+					]
+				] === "editSong"
+					? state.modals.editSong[
+							state.modalVisibility.activeModals[
+								state.modalVisibility.activeModals.length - 1
+							]
+					  ].video.paused
+					: null,
+			paused => {
+				if (paused && !this.beforeEditSongModalLocalPaused) {
+					this.resumeLocalStation();
+				} else if (!paused) {
+					this.beforeEditSongModalLocalPaused = this.localPaused;
+					this.pauseLocalStation();
+				}
+			}
+		);
 
 
 		window.scrollTo(0, 0);
 		window.scrollTo(0, 0);