Explorar o código

refactor(frontend): removed unnecessary/unnecessarily code that can be simplifed by Vue

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan %!s(int64=4) %!d(string=hai) anos
pai
achega
dfce2c55fb

+ 6 - 6
frontend/src/components/modals/EditSong.vue

@@ -88,7 +88,7 @@
 										type="text"
 										id="title-input"
 										v-model="editing.song.title"
-										@keyup.ctrl.alt.68="
+										@keyup.ctrl.alt.d="
 											getAlbumData('title')
 										"
 									/>
@@ -137,7 +137,7 @@
 										class="input"
 										type="text"
 										v-model="editing.song.thumbnail"
-										@keyup.ctrl.alt.68="
+										@keyup.ctrl.alt.d="
 											getAlbumData('albumArt')
 										"
 									/>
@@ -163,7 +163,7 @@
 										@focus="focusArtistInput()"
 										@keydown="keydownArtistInput()"
 										@keyup.enter="addTag('artists')"
-										@keyup.ctrl.alt.68="
+										@keyup.ctrl.alt.d="
 											getAlbumData('artists')
 										"
 									/>
@@ -237,7 +237,7 @@
 										@focus="focusGenreInput()"
 										@keydown="keydownGenreInput()"
 										@keyup.enter="addTag('genres')"
-										@keyup.ctrl.alt.68="
+										@keyup.ctrl.alt.d="
 											getAlbumData('genres')
 										"
 									/>
@@ -404,8 +404,8 @@
 								v-for="(result, index) in discogs.apiResults"
 								:key="index"
 								tabindex="0"
-								@keydown.prevent.32
-								@keyup.13="toggleAPIResult(index)"
+								@keydown.space.prevent
+								@keyup.enter="toggleAPIResult(index)"
 							>
 								<div class="top-container">
 									<img :src="result.album.albumArt" />

+ 7 - 9
frontend/src/pages/Admin/tabs/QueueSongs.vue

@@ -46,13 +46,13 @@
 						v-for="(song, index) in filteredSongs"
 						:key="index"
 						tabindex="0"
-						@keydown.prevent.38
-						@keydown.prevent.40
-						@keyup.38="selectPrevious($event)"
-						@keyup.40="selectNext($event)"
-						@keyup.69="edit(song, index)"
-						@keyup.65="add(song)"
-						@keyup.88="remove(song._id, index)"
+						@keydown.up.prevent
+						@keydown.down.prevent
+						@keyup.up="selectPrevious($event)"
+						@keyup.down="selectNext($event)"
+						@keyup.e="edit(song, index)"
+						@keyup.a="add(song)"
+						@keyup.x="remove(song._id, index)"
 					>
 						<td>
 							<img
@@ -286,12 +286,10 @@ export default {
 			});
 		},
 		selectPrevious(event) {
-			event.preventDefault();
 			if (event.srcElement.previousElementSibling)
 				event.srcElement.previousElementSibling.focus();
 		},
 		selectNext(event) {
-			event.preventDefault();
 			if (event.srcElement.nextElementSibling)
 				event.srcElement.nextElementSibling.focus();
 		},

+ 6 - 6
frontend/src/pages/Home/index.vue

@@ -64,13 +64,15 @@
 							<div class="media-left displayName">
 								<i
 									v-if="loggedIn && !isFavorite(station)"
-									@click="favoriteStation($event, station)"
+									@click.prevent="addFavoriteStation(station)"
 									class="favorite material-icons"
 									>star_border</i
 								>
 								<i
 									v-if="loggedIn && isFavorite(station)"
-									@click="unfavoriteStation($event, station)"
+									@click.prevent="
+										removeFavoriteStation(station)
+									"
 									class="favorite material-icons"
 									>star</i
 								>
@@ -388,8 +390,7 @@ export default {
 		isPlaying(station) {
 			return typeof station.currentSong.title !== "undefined";
 		},
-		favoriteStation(event, station) {
-			event.preventDefault();
+		addFavoriteStation(station) {
 			this.socket.emit("stations.favoriteStation", station._id, res => {
 				if (res.status === "success") {
 					new Toast({
@@ -399,8 +400,7 @@ export default {
 				} else new Toast({ content: res.message, timeout: 8000 });
 			});
 		},
-		unfavoriteStation(event, station) {
-			event.preventDefault();
+		removeFavoriteStation(station) {
 			this.socket.emit("stations.unfavoriteStation", station._id, res => {
 				if (res.status === "success") {
 					new Toast({

+ 6 - 8
frontend/src/pages/Station/index.vue

@@ -20,16 +20,16 @@
 						<div class="row" id="station-name">
 							<h1>{{ station.displayName }}</h1>
 							<a href="#">
-								<!-- Favourite Station Button -->
+								<!-- Favorite Station Button -->
 								<i
 									v-if="loggedIn && favoriteStation"
-									@click="unfavoriteStation($event)"
+									@click.prevent="removefavoriteStation()"
 									class="material-icons"
 									>star</i
 								>
 								<i
 									v-if="loggedIn && !favoriteStation"
-									@click="addfavoriteStation($event)"
+									@click.prevent="addFavoriteStation()"
 									class="material-icons"
 									>star_border</i
 								>
@@ -1271,7 +1271,7 @@ export default {
 						});
 					}
 
-					/** Check if station is favourited */
+					/** Check if station is favorited */
 					this.socket.emit("users.getFavoriteStations", data => {
 						if (
 							data.status === "success" &&
@@ -1404,8 +1404,7 @@ export default {
 				}
 			});
 		},
-		addfavoriteStation(event) {
-			event.preventDefault();
+		addFavoriteStation() {
 			this.socket.emit(
 				"stations.favoriteStation",
 				this.station._id,
@@ -1419,8 +1418,7 @@ export default {
 				}
 			);
 		},
-		unfavoriteStation(event) {
-			event.preventDefault();
+		removeFavoriteStation() {
 			this.socket.emit(
 				"stations.unfavoriteStation",
 				this.station._id,