|
@@ -319,7 +319,18 @@
|
|
|
|
|
|
<!-- Vote to Skip Button -->
|
|
<!-- Vote to Skip Button -->
|
|
<button
|
|
<button
|
|
- v-if="loggedIn"
|
|
|
|
|
|
+ v-if="!skipVotesLoaded"
|
|
|
|
+ class="button is-primary disabled"
|
|
|
|
+ content="Skip votes have not been loaded yet"
|
|
|
|
+ v-tippy
|
|
|
|
+ >
|
|
|
|
+ <i
|
|
|
|
+ class="material-icons icon-with-button"
|
|
|
|
+ >skip_next</i
|
|
|
|
+ >
|
|
|
|
+ </button>
|
|
|
|
+ <button
|
|
|
|
+ v-else-if="loggedIn"
|
|
class="button is-primary"
|
|
class="button is-primary"
|
|
@click="voteSkipStation()"
|
|
@click="voteSkipStation()"
|
|
content="Vote to Skip Song"
|
|
content="Vote to Skip Song"
|
|
@@ -392,6 +403,7 @@
|
|
<!-- Ratings (Like/Dislike) Buttons -->
|
|
<!-- Ratings (Like/Dislike) Buttons -->
|
|
<div
|
|
<div
|
|
id="ratings"
|
|
id="ratings"
|
|
|
|
+ v-if="ratingsLoaded"
|
|
:class="{
|
|
:class="{
|
|
liked: liked,
|
|
liked: liked,
|
|
disliked: disliked
|
|
disliked: disliked
|
|
@@ -429,6 +441,33 @@
|
|
>{{ currentSong.dislikes }}
|
|
>{{ currentSong.dislikes }}
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div id="ratings" class="disabled" v-else>
|
|
|
|
+ <!-- Like Song Button -->
|
|
|
|
+ <button
|
|
|
|
+ class="button is-success like-song disabled"
|
|
|
|
+ id="like-song"
|
|
|
|
+ content="Ratings have not been loaded yet"
|
|
|
|
+ v-tippy
|
|
|
|
+ >
|
|
|
|
+ <i
|
|
|
|
+ class="material-icons icon-with-button"
|
|
|
|
+ >thumb_up_alt</i
|
|
|
|
+ >
|
|
|
|
+ </button>
|
|
|
|
+
|
|
|
|
+ <!-- Dislike Song Button -->
|
|
|
|
+ <button
|
|
|
|
+ class="button is-danger dislike-song disabled"
|
|
|
|
+ id="dislike-song"
|
|
|
|
+ content="Ratings have not been loaded yet"
|
|
|
|
+ v-tippy
|
|
|
|
+ >
|
|
|
|
+ <i
|
|
|
|
+ class="material-icons icon-with-button"
|
|
|
|
+ >thumb_down_alt</i
|
|
|
|
+ >
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
|
|
<!-- Add Song To Playlist Button & Dropdown -->
|
|
<!-- Add Song To Playlist Button & Dropdown -->
|
|
<add-to-playlist-dropdown
|
|
<add-to-playlist-dropdown
|
|
@@ -472,7 +511,7 @@
|
|
</div>
|
|
</div>
|
|
<div id="right-buttons" v-else>
|
|
<div id="right-buttons" v-else>
|
|
<!-- Disabled Ratings (Like/Dislike) Buttons -->
|
|
<!-- Disabled Ratings (Like/Dislike) Buttons -->
|
|
- <div id="ratings">
|
|
|
|
|
|
+ <div id="ratings" v-if="ratingsLoaded">
|
|
<!-- Disabled Like Song Button -->
|
|
<!-- Disabled Like Song Button -->
|
|
<button
|
|
<button
|
|
class="button is-success disabled"
|
|
class="button is-success disabled"
|
|
@@ -499,6 +538,33 @@
|
|
>{{ currentSong.dislikes }}
|
|
>{{ currentSong.dislikes }}
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div id="ratings" v-else>
|
|
|
|
+ <!-- Disabled Like Song Button -->
|
|
|
|
+ <button
|
|
|
|
+ class="button is-success disabled"
|
|
|
|
+ id="like-song"
|
|
|
|
+ content="Ratings have not been loaded yet"
|
|
|
|
+ v-tippy="{ theme: 'info' }"
|
|
|
|
+ >
|
|
|
|
+ <i
|
|
|
|
+ class="material-icons icon-with-button"
|
|
|
|
+ >thumb_up_alt</i
|
|
|
|
+ >
|
|
|
|
+ </button>
|
|
|
|
+
|
|
|
|
+ <!-- Disabled Dislike Song Button -->
|
|
|
|
+ <button
|
|
|
|
+ class="button is-danger disabled"
|
|
|
|
+ id="dislike-song"
|
|
|
|
+ content="Ratings have not been loaded yet"
|
|
|
|
+ v-tippy="{ theme: 'info' }"
|
|
|
|
+ >
|
|
|
|
+ <i
|
|
|
|
+ class="material-icons icon-with-button"
|
|
|
|
+ >thumb_down_alt</i
|
|
|
|
+ >
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
<!-- Disabled Add Song To Playlist Button & Dropdown -->
|
|
<!-- Disabled Add Song To Playlist Button & Dropdown -->
|
|
<div id="add-song-to-playlist">
|
|
<div id="add-song-to-playlist">
|
|
<div class="control has-addons">
|
|
<div class="control has-addons">
|
|
@@ -681,7 +747,6 @@ export default {
|
|
liked: false,
|
|
liked: false,
|
|
disliked: false,
|
|
disliked: false,
|
|
timeBeforePause: 0,
|
|
timeBeforePause: 0,
|
|
- skipVotes: 0,
|
|
|
|
systemDifference: 0,
|
|
systemDifference: 0,
|
|
attemptsToPlayVideo: 0,
|
|
attemptsToPlayVideo: 0,
|
|
canAutoplay: true,
|
|
canAutoplay: true,
|
|
@@ -703,6 +768,22 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
|
|
+ skipVotesLoaded() {
|
|
|
|
+ return (
|
|
|
|
+ !this.noSong &&
|
|
|
|
+ Number.isInteger(this.currentSong.skipVotes) &&
|
|
|
|
+ this.currentSong.skipVotes >= 0
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ ratingsLoaded() {
|
|
|
|
+ return (
|
|
|
|
+ !this.noSong &&
|
|
|
|
+ Number.isInteger(this.currentSong.likes) &&
|
|
|
|
+ Number.isInteger(this.currentSong.dislikes) &&
|
|
|
|
+ this.currentSong.likes >= 0 &&
|
|
|
|
+ this.currentSong.dislikes >= 0
|
|
|
|
+ );
|
|
|
|
+ },
|
|
...mapState("modalVisibility", {
|
|
...mapState("modalVisibility", {
|
|
modals: state => state.modals
|
|
modals: state => state.modals
|
|
}),
|
|
}),
|
|
@@ -853,8 +934,7 @@ export default {
|
|
this.socket.on("event:song.liked", res => {
|
|
this.socket.on("event:song.liked", res => {
|
|
if (!this.noSong) {
|
|
if (!this.noSong) {
|
|
if (res.data.youtubeId === this.currentSong.youtubeId) {
|
|
if (res.data.youtubeId === this.currentSong.youtubeId) {
|
|
- this.currentSong.dislikes = res.data.dislikes;
|
|
|
|
- this.currentSong.likes = res.data.likes;
|
|
|
|
|
|
+ this.updateCurrentSongRatings(res.data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -862,8 +942,7 @@ export default {
|
|
this.socket.on("event:song.disliked", res => {
|
|
this.socket.on("event:song.disliked", res => {
|
|
if (!this.noSong) {
|
|
if (!this.noSong) {
|
|
if (res.data.youtubeId === this.currentSong.youtubeId) {
|
|
if (res.data.youtubeId === this.currentSong.youtubeId) {
|
|
- this.currentSong.dislikes = res.data.dislikes;
|
|
|
|
- this.currentSong.likes = res.data.likes;
|
|
|
|
|
|
+ this.updateCurrentSongRatings(res.data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -871,8 +950,7 @@ export default {
|
|
this.socket.on("event:song.unliked", res => {
|
|
this.socket.on("event:song.unliked", res => {
|
|
if (!this.noSong) {
|
|
if (!this.noSong) {
|
|
if (res.data.youtubeId === this.currentSong.youtubeId) {
|
|
if (res.data.youtubeId === this.currentSong.youtubeId) {
|
|
- this.currentSong.dislikes = res.data.dislikes;
|
|
|
|
- this.currentSong.likes = res.data.likes;
|
|
|
|
|
|
+ this.updateCurrentSongRatings(res.data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -880,8 +958,7 @@ export default {
|
|
this.socket.on("event:song.undisliked", res => {
|
|
this.socket.on("event:song.undisliked", res => {
|
|
if (!this.noSong) {
|
|
if (!this.noSong) {
|
|
if (res.data.youtubeId === this.currentSong.youtubeId) {
|
|
if (res.data.youtubeId === this.currentSong.youtubeId) {
|
|
- this.currentSong.dislikes = res.data.dislikes;
|
|
|
|
- this.currentSong.likes = res.data.likes;
|
|
|
|
|
|
+ this.updateCurrentSongRatings(res.data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -945,7 +1022,7 @@ export default {
|
|
});
|
|
});
|
|
|
|
|
|
this.socket.on("event:station.voteSkipSong", () => {
|
|
this.socket.on("event:station.voteSkipSong", () => {
|
|
- if (this.currentSong) this.currentSong.skipVotes += 1;
|
|
|
|
|
|
+ if (this.currentSong) this.updateCurrentSongSkipVotes(this.currentSong.skipVotes + 1);
|
|
});
|
|
});
|
|
|
|
|
|
this.socket.on("event:privatePlaylist.selected", res => {
|
|
this.socket.on("event:privatePlaylist.selected", res => {
|
|
@@ -1191,6 +1268,17 @@ export default {
|
|
}, this.getTimeRemaining());
|
|
}, this.getTimeRemaining());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ this.socket.dispatch(
|
|
|
|
+ "songs.getSongRatings",
|
|
|
|
+ currentSong._id,
|
|
|
|
+ res => {
|
|
|
|
+ if (currentSong._id === this.currentSong._id) {
|
|
|
|
+ const { likes, dislikes } = res.data;
|
|
|
|
+ this.updateCurrentSongRatings({ likes, dislikes });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+
|
|
this.socket.dispatch(
|
|
this.socket.dispatch(
|
|
"songs.getOwnSongRatings",
|
|
"songs.getOwnSongRatings",
|
|
currentSong.youtubeId,
|
|
currentSong.youtubeId,
|
|
@@ -2026,7 +2114,9 @@ export default {
|
|
"updateNoSong",
|
|
"updateNoSong",
|
|
"updateIfStationIsFavorited",
|
|
"updateIfStationIsFavorited",
|
|
"setIncludedPlaylists",
|
|
"setIncludedPlaylists",
|
|
- "setExcludedPlaylists"
|
|
|
|
|
|
+ "setExcludedPlaylists",
|
|
|
|
+ "updateCurrentSongRatings",
|
|
|
|
+ "updateCurrentSongSkipVotes"
|
|
]),
|
|
]),
|
|
...mapActions("modals/editSong", ["stopVideo"])
|
|
...mapActions("modals/editSong", ["stopVideo"])
|
|
}
|
|
}
|