|
@@ -4,7 +4,7 @@
|
|
|
:title="
|
|
|
sector === 'home' && !isOwnerOrAdmin()
|
|
|
? 'View Queue'
|
|
|
- : !isOwnerOrAdmin() && station.partyMode
|
|
|
+ : !isOwnerOrAdmin()
|
|
|
? 'Add Song to Queue'
|
|
|
: 'Manage Station'
|
|
|
"
|
|
@@ -12,169 +12,127 @@
|
|
|
class="manage-station-modal"
|
|
|
:size="isOwnerOrAdmin() || sector !== 'home' ? 'wide' : null"
|
|
|
:split="isOwnerOrAdmin() || sector !== 'home'"
|
|
|
+ :intercept-close="true"
|
|
|
+ @close="onCloseModal"
|
|
|
>
|
|
|
<template #body v-if="station && station._id">
|
|
|
<div class="left-section">
|
|
|
- <div class="section tabs-container">
|
|
|
- <div class="tab-selection">
|
|
|
- <button
|
|
|
+ <div class="section">
|
|
|
+ <div class="station-info-box-wrapper">
|
|
|
+ <station-info-box
|
|
|
+ :station="station"
|
|
|
+ :station-paused="stationPaused"
|
|
|
+ :show-go-to-station="sector !== 'station'"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div v-if="isOwnerOrAdmin() || sector !== 'home'">
|
|
|
+ <div class="tab-selection">
|
|
|
+ <button
|
|
|
+ v-if="isOwnerOrAdmin()"
|
|
|
+ class="button is-default"
|
|
|
+ :class="{ selected: tab === 'settings' }"
|
|
|
+ ref="settings-tab"
|
|
|
+ @click="showTab('settings')"
|
|
|
+ >
|
|
|
+ Settings
|
|
|
+ </button>
|
|
|
+ <button
|
|
|
+ v-if="canRequest()"
|
|
|
+ class="button is-default"
|
|
|
+ :class="{ selected: tab === 'request' }"
|
|
|
+ ref="request-tab"
|
|
|
+ @click="showTab('request')"
|
|
|
+ >
|
|
|
+ Request
|
|
|
+ </button>
|
|
|
+ <button
|
|
|
+ v-if="
|
|
|
+ isOwnerOrAdmin() && station.autofill.enabled
|
|
|
+ "
|
|
|
+ class="button is-default"
|
|
|
+ :class="{ selected: tab === 'autofill' }"
|
|
|
+ ref="autofill-tab"
|
|
|
+ @click="showTab('autofill')"
|
|
|
+ >
|
|
|
+ Autofill
|
|
|
+ </button>
|
|
|
+ <button
|
|
|
+ v-if="isOwnerOrAdmin()"
|
|
|
+ class="button is-default"
|
|
|
+ :class="{ selected: tab === 'blacklist' }"
|
|
|
+ ref="blacklist-tab"
|
|
|
+ @click="showTab('blacklist')"
|
|
|
+ >
|
|
|
+ Blacklist
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <settings
|
|
|
v-if="isOwnerOrAdmin()"
|
|
|
- class="button is-default"
|
|
|
- :class="{ selected: tab === 'settings' }"
|
|
|
- ref="settings-tab"
|
|
|
- @click="showTab('settings')"
|
|
|
- >
|
|
|
- Settings
|
|
|
- </button>
|
|
|
- <button
|
|
|
- v-if="
|
|
|
- isOwnerOrAdmin() ||
|
|
|
- (loggedIn &&
|
|
|
- station.type === 'community' &&
|
|
|
- station.partyMode &&
|
|
|
- ((station.locked && isOwnerOrAdmin()) ||
|
|
|
- !station.locked))
|
|
|
- "
|
|
|
- class="button is-default"
|
|
|
- :class="{ selected: tab === 'playlists' }"
|
|
|
- ref="playlists-tab"
|
|
|
- @click="showTab('playlists')"
|
|
|
- >
|
|
|
- Playlists
|
|
|
- </button>
|
|
|
- <button
|
|
|
- v-if="
|
|
|
- loggedIn &&
|
|
|
- station.type === 'community' &&
|
|
|
- station.partyMode &&
|
|
|
- ((station.locked && isOwnerOrAdmin()) ||
|
|
|
- !station.locked)
|
|
|
- "
|
|
|
- class="button is-default"
|
|
|
- :class="{ selected: tab === 'songs' }"
|
|
|
- ref="songs-tab"
|
|
|
- @click="showTab('songs')"
|
|
|
+ class="tab"
|
|
|
+ v-show="tab === 'settings'"
|
|
|
+ :modal-uuid="modalUuid"
|
|
|
+ ref="settingsTabComponent"
|
|
|
+ />
|
|
|
+ <request
|
|
|
+ v-if="canRequest()"
|
|
|
+ class="tab"
|
|
|
+ v-show="tab === 'request'"
|
|
|
+ :sector="'manageStation'"
|
|
|
+ :disable-auto-request="sector !== 'station'"
|
|
|
+ :modal-uuid="modalUuid"
|
|
|
+ />
|
|
|
+ <playlist-tab-base
|
|
|
+ v-if="isOwnerOrAdmin() && station.autofill.enabled"
|
|
|
+ class="tab"
|
|
|
+ v-show="tab === 'autofill'"
|
|
|
+ :type="'autofill'"
|
|
|
+ :modal-uuid="modalUuid"
|
|
|
>
|
|
|
- Add Songs
|
|
|
- </button>
|
|
|
- <button
|
|
|
+ <template #info>
|
|
|
+ <p>
|
|
|
+ Select playlists to automatically add songs
|
|
|
+ within to the queue
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ </playlist-tab-base>
|
|
|
+ <playlist-tab-base
|
|
|
v-if="isOwnerOrAdmin()"
|
|
|
- class="button is-default"
|
|
|
- :class="{ selected: tab === 'blacklist' }"
|
|
|
- ref="blacklist-tab"
|
|
|
- @click="showTab('blacklist')"
|
|
|
+ class="tab"
|
|
|
+ v-show="tab === 'blacklist'"
|
|
|
+ :type="'blacklist'"
|
|
|
+ :modal-uuid="modalUuid"
|
|
|
>
|
|
|
- Blacklist
|
|
|
- </button>
|
|
|
+ <template #info>
|
|
|
+ <p>
|
|
|
+ Blacklist a playlist to prevent all songs
|
|
|
+ within from playing in this station
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ </playlist-tab-base>
|
|
|
</div>
|
|
|
- <settings
|
|
|
- v-if="isOwnerOrAdmin()"
|
|
|
- class="tab"
|
|
|
- v-show="tab === 'settings'"
|
|
|
- />
|
|
|
- <playlists
|
|
|
- v-if="
|
|
|
- isOwnerOrAdmin() ||
|
|
|
- (loggedIn &&
|
|
|
- station.type === 'community' &&
|
|
|
- station.partyMode &&
|
|
|
- ((station.locked && isOwnerOrAdmin()) ||
|
|
|
- !station.locked))
|
|
|
- "
|
|
|
- class="tab"
|
|
|
- v-show="tab === 'playlists'"
|
|
|
- />
|
|
|
- <songs
|
|
|
- v-if="
|
|
|
- loggedIn &&
|
|
|
- station.type === 'community' &&
|
|
|
- station.partyMode &&
|
|
|
- ((station.locked && isOwnerOrAdmin()) ||
|
|
|
- !station.locked)
|
|
|
- "
|
|
|
- class="tab"
|
|
|
- v-show="tab === 'songs'"
|
|
|
- />
|
|
|
- <blacklist
|
|
|
- v-if="isOwnerOrAdmin()"
|
|
|
- class="tab"
|
|
|
- v-show="tab === 'blacklist'"
|
|
|
- />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="right-section">
|
|
|
<div class="section">
|
|
|
<div class="queue-title">
|
|
|
<h4 class="section-title">Queue</h4>
|
|
|
- <i
|
|
|
- v-if="isOwnerOrAdmin() && stationPaused"
|
|
|
- @click="resumeStation()"
|
|
|
- class="material-icons resume-station"
|
|
|
- content="Resume Station"
|
|
|
- v-tippy
|
|
|
- >
|
|
|
- play_arrow
|
|
|
- </i>
|
|
|
- <i
|
|
|
- v-if="isOwnerOrAdmin() && !stationPaused"
|
|
|
- @click="pauseStation()"
|
|
|
- class="material-icons pause-station"
|
|
|
- content="Pause Station"
|
|
|
- v-tippy
|
|
|
- >
|
|
|
- pause
|
|
|
- </i>
|
|
|
- <quick-confirm
|
|
|
- v-if="isOwnerOrAdmin()"
|
|
|
- @confirm="skipStation()"
|
|
|
- >
|
|
|
- <i
|
|
|
- class="material-icons skip-station"
|
|
|
- content="Force Skip Station"
|
|
|
- v-tippy
|
|
|
- >
|
|
|
- skip_next
|
|
|
- </i>
|
|
|
- </quick-confirm>
|
|
|
</div>
|
|
|
<hr class="section-horizontal-rule" />
|
|
|
<song-item
|
|
|
v-if="currentSong._id"
|
|
|
:song="currentSong"
|
|
|
- :requested-by="
|
|
|
- station.type === 'community' &&
|
|
|
- station.partyMode === true
|
|
|
- "
|
|
|
+ :requested-by="true"
|
|
|
header="Currently Playing.."
|
|
|
class="currently-playing"
|
|
|
/>
|
|
|
- <queue sector="manageStation" />
|
|
|
+ <queue :modal-uuid="modalUuid" sector="manageStation" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<template #footer>
|
|
|
- <router-link
|
|
|
- v-if="sector !== 'station' && station.name"
|
|
|
- :to="{
|
|
|
- name: 'station',
|
|
|
- params: { id: station.name }
|
|
|
- }"
|
|
|
- class="button is-primary"
|
|
|
- >
|
|
|
- Go To Station
|
|
|
- </router-link>
|
|
|
- <a
|
|
|
- class="button is-default"
|
|
|
- v-if="isOwnerOrAdmin() && !station.partyMode"
|
|
|
- @click="stationPlaylist()"
|
|
|
- >
|
|
|
- View Station Playlist
|
|
|
- </a>
|
|
|
<div v-if="isOwnerOrAdmin()" class="right">
|
|
|
- <quick-confirm @confirm="clearAndRefillStationQueue()">
|
|
|
- <a class="button is-danger">
|
|
|
- Clear and refill station queue
|
|
|
- </a>
|
|
|
+ <quick-confirm @confirm="resetQueue()">
|
|
|
+ <a class="button is-danger">Reset queue</a>
|
|
|
</quick-confirm>
|
|
|
<quick-confirm @confirm="removeStation()">
|
|
|
<button class="button is-danger">Delete station</button>
|
|
@@ -188,32 +146,28 @@
|
|
|
import { mapState, mapGetters, mapActions } from "vuex";
|
|
|
|
|
|
import Toast from "toasters";
|
|
|
-import ws from "@/ws";
|
|
|
|
|
|
-import QuickConfirm from "@/components/QuickConfirm.vue";
|
|
|
+import { mapModalState, mapModalActions } from "@/vuex_helpers";
|
|
|
+
|
|
|
import Queue from "@/components/Queue.vue";
|
|
|
import SongItem from "@/components/SongItem.vue";
|
|
|
-import Modal from "../../Modal.vue";
|
|
|
+import StationInfoBox from "@/components/StationInfoBox.vue";
|
|
|
|
|
|
-import Settings from "./Tabs/Settings.vue";
|
|
|
-import Playlists from "./Tabs/Playlists.vue";
|
|
|
-import Songs from "./Tabs/Songs.vue";
|
|
|
-import Blacklist from "./Tabs/Blacklist.vue";
|
|
|
+import Settings from "./Settings.vue";
|
|
|
+import PlaylistTabBase from "@/components/PlaylistTabBase.vue";
|
|
|
+import Request from "@/components/Request.vue";
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
- Modal,
|
|
|
- QuickConfirm,
|
|
|
Queue,
|
|
|
SongItem,
|
|
|
+ StationInfoBox,
|
|
|
Settings,
|
|
|
- Playlists,
|
|
|
- Songs,
|
|
|
- Blacklist
|
|
|
+ PlaylistTabBase,
|
|
|
+ Request
|
|
|
},
|
|
|
props: {
|
|
|
- stationId: { type: String, default: "" },
|
|
|
- sector: { type: String, default: "admin" }
|
|
|
+ modalUuid: { type: String, default: "" }
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState({
|
|
@@ -221,13 +175,15 @@ export default {
|
|
|
userId: state => state.user.auth.userId,
|
|
|
role: state => state.user.auth.role
|
|
|
}),
|
|
|
- ...mapState("modals/manageStation", {
|
|
|
+ ...mapModalState("modals/manageStation/MODAL_UUID", {
|
|
|
+ stationId: state => state.stationId,
|
|
|
+ sector: state => state.sector,
|
|
|
tab: state => state.tab,
|
|
|
station: state => state.station,
|
|
|
- originalStation: state => state.originalStation,
|
|
|
songsList: state => state.songsList,
|
|
|
- includedPlaylists: state => state.includedPlaylists,
|
|
|
- excludedPlaylists: state => state.excludedPlaylists,
|
|
|
+ stationPlaylist: state => state.stationPlaylist,
|
|
|
+ autofill: state => state.autofill,
|
|
|
+ blacklist: state => state.blacklist,
|
|
|
stationPaused: state => state.stationPaused,
|
|
|
currentSong: state => state.currentSong
|
|
|
}),
|
|
@@ -235,8 +191,171 @@ export default {
|
|
|
socket: "websockets/getSocket"
|
|
|
})
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ // eslint-disable-next-line
|
|
|
+ "station.requests": function (requests) {
|
|
|
+ if (this.tab === "request" && !this.canRequest()) {
|
|
|
+ if (this.isOwnerOrAdmin()) this.showTab("settings");
|
|
|
+ else if (!(this.sector === "home" && !this.isOwnerOrAdmin()))
|
|
|
+ this.closeModal("manageStation");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // eslint-disable-next-line
|
|
|
+ "station.autofill": function (autofill) {
|
|
|
+ if (this.tab === "autofill" && autofill && !autofill.enabled)
|
|
|
+ this.showTab("settings");
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
- ws.onConnect(this.init);
|
|
|
+ this.socket.dispatch(`stations.getStationById`, this.stationId, res => {
|
|
|
+ if (res.status === "success") {
|
|
|
+ const { station } = res.data;
|
|
|
+ this.editStation(station);
|
|
|
+
|
|
|
+ if (!this.isOwnerOrAdmin()) this.showTab("request");
|
|
|
+
|
|
|
+ const currentSong = res.data.station.currentSong
|
|
|
+ ? res.data.station.currentSong
|
|
|
+ : {};
|
|
|
+
|
|
|
+ this.updateCurrentSong(currentSong);
|
|
|
+
|
|
|
+ this.updateStationPaused(res.data.station.paused);
|
|
|
+
|
|
|
+ this.socket.dispatch(
|
|
|
+ "stations.getStationAutofillPlaylistsById",
|
|
|
+ this.stationId,
|
|
|
+ res => {
|
|
|
+ if (res.status === "success")
|
|
|
+ this.setAutofillPlaylists(res.data.playlists);
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.dispatch(
|
|
|
+ "stations.getStationBlacklistById",
|
|
|
+ this.stationId,
|
|
|
+ res => {
|
|
|
+ if (res.status === "success")
|
|
|
+ this.setBlacklist(res.data.playlists);
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ if (this.isOwnerOrAdmin()) {
|
|
|
+ this.socket.dispatch(
|
|
|
+ "playlists.getPlaylistForStation",
|
|
|
+ this.station._id,
|
|
|
+ true,
|
|
|
+ res => {
|
|
|
+ if (res.status === "success") {
|
|
|
+ this.updateStationPlaylist(res.data.playlist);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ this.socket.dispatch(
|
|
|
+ "stations.getQueue",
|
|
|
+ this.stationId,
|
|
|
+ res => {
|
|
|
+ if (res.status === "success")
|
|
|
+ this.updateSongsList(res.data.queue);
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.dispatch(
|
|
|
+ "apis.joinRoom",
|
|
|
+ `manage-station.${this.stationId}`
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.on(
|
|
|
+ "event:station.updated",
|
|
|
+ res => {
|
|
|
+ this.updateStation(res.data.station);
|
|
|
+ },
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.on(
|
|
|
+ "event:station.autofillPlaylist",
|
|
|
+ res => {
|
|
|
+ const { playlist } = res.data;
|
|
|
+ const playlistIndex = this.autofill
|
|
|
+ .map(autofillPlaylist => autofillPlaylist._id)
|
|
|
+ .indexOf(playlist._id);
|
|
|
+ if (playlistIndex === -1) this.autofill.push(playlist);
|
|
|
+ },
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.on(
|
|
|
+ "event:station.blacklistedPlaylist",
|
|
|
+ res => {
|
|
|
+ const { playlist } = res.data;
|
|
|
+ const playlistIndex = this.blacklist
|
|
|
+ .map(blacklistedPlaylist => blacklistedPlaylist._id)
|
|
|
+ .indexOf(playlist._id);
|
|
|
+ if (playlistIndex === -1) this.blacklist.push(playlist);
|
|
|
+ },
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.on(
|
|
|
+ "event:station.removedAutofillPlaylist",
|
|
|
+ res => {
|
|
|
+ const { playlistId } = res.data;
|
|
|
+ const playlistIndex = this.autofill
|
|
|
+ .map(playlist => playlist._id)
|
|
|
+ .indexOf(playlistId);
|
|
|
+ if (playlistIndex >= 0)
|
|
|
+ this.autofill.splice(playlistIndex, 1);
|
|
|
+ },
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.on(
|
|
|
+ "event:station.removedBlacklistedPlaylist",
|
|
|
+ res => {
|
|
|
+ const { playlistId } = res.data;
|
|
|
+ const playlistIndex = this.blacklist
|
|
|
+ .map(playlist => playlist._id)
|
|
|
+ .indexOf(playlistId);
|
|
|
+ if (playlistIndex >= 0)
|
|
|
+ this.blacklist.splice(playlistIndex, 1);
|
|
|
+ },
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.on(
|
|
|
+ "event:station.deleted",
|
|
|
+ () => {
|
|
|
+ new Toast(`The station you were editing was deleted.`);
|
|
|
+ this.closeModal("manageStation");
|
|
|
+ },
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.on(
|
|
|
+ "event:user.station.favorited",
|
|
|
+ res => {
|
|
|
+ if (res.data.stationId === this.stationId)
|
|
|
+ this.updateIsFavorited(true);
|
|
|
+ },
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.on(
|
|
|
+ "event:user.station.unfavorited",
|
|
|
+ res => {
|
|
|
+ if (res.data.stationId === this.stationId)
|
|
|
+ this.updateIsFavorited(false);
|
|
|
+ },
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ new Toast(`Station with that ID not found`);
|
|
|
+ this.closeModal("manageStation");
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
this.socket.on(
|
|
|
"event:manageStation.queue.updated",
|
|
@@ -244,7 +363,7 @@ export default {
|
|
|
if (res.data.stationId === this.station._id)
|
|
|
this.updateSongsList(res.data.queue);
|
|
|
},
|
|
|
- { modal: "manageStation" }
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
);
|
|
|
|
|
|
this.socket.on(
|
|
@@ -253,7 +372,7 @@ export default {
|
|
|
if (res.data.stationId === this.station._id)
|
|
|
this.repositionSongInList(res.data.song);
|
|
|
},
|
|
|
- { modal: "manageStation" }
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
);
|
|
|
|
|
|
this.socket.on(
|
|
@@ -262,7 +381,7 @@ export default {
|
|
|
if (res.data.stationId === this.station._id)
|
|
|
this.updateStationPaused(true);
|
|
|
},
|
|
|
- { modal: "manageStation" }
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
);
|
|
|
|
|
|
this.socket.on(
|
|
@@ -271,7 +390,7 @@ export default {
|
|
|
if (res.data.stationId === this.station._id)
|
|
|
this.updateStationPaused(false);
|
|
|
},
|
|
|
- { modal: "manageStation" }
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
);
|
|
|
|
|
|
this.socket.on(
|
|
@@ -280,8 +399,75 @@ export default {
|
|
|
if (res.data.stationId === this.station._id)
|
|
|
this.updateCurrentSong(res.data.currentSong || {});
|
|
|
},
|
|
|
- { modal: "manageStation" }
|
|
|
+ { modalUuid: this.modalUuid }
|
|
|
);
|
|
|
+
|
|
|
+ if (this.isOwnerOrAdmin()) {
|
|
|
+ this.socket.on(
|
|
|
+ "event:playlist.song.added",
|
|
|
+ res => {
|
|
|
+ if (this.stationPlaylist._id === res.data.playlistId)
|
|
|
+ this.stationPlaylist.songs.push(res.data.song);
|
|
|
+ },
|
|
|
+ {
|
|
|
+ modalUuid: this.modalUuid
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.on(
|
|
|
+ "event:playlist.song.removed",
|
|
|
+ res => {
|
|
|
+ if (this.stationPlaylist._id === res.data.playlistId) {
|
|
|
+ // remove song from array of playlists
|
|
|
+ this.stationPlaylist.songs.forEach((song, index) => {
|
|
|
+ if (song.youtubeId === res.data.youtubeId)
|
|
|
+ this.stationPlaylist.songs.splice(index, 1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ modalUuid: this.modalUuid
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ this.socket.on(
|
|
|
+ "event:playlist.songs.repositioned",
|
|
|
+ res => {
|
|
|
+ if (this.stationPlaylist._id === res.data.playlistId) {
|
|
|
+ // for each song that has a new position
|
|
|
+ res.data.songsBeingChanged.forEach(changedSong => {
|
|
|
+ this.stationPlaylist.songs.forEach(
|
|
|
+ (song, index) => {
|
|
|
+ // find song locally
|
|
|
+ if (
|
|
|
+ song.youtubeId === changedSong.youtubeId
|
|
|
+ ) {
|
|
|
+ // change song position attribute
|
|
|
+ this.stationPlaylist.songs[
|
|
|
+ index
|
|
|
+ ].position = changedSong.position;
|
|
|
+
|
|
|
+ // reposition in array if needed
|
|
|
+ if (index !== changedSong.position - 1)
|
|
|
+ this.stationPlaylist.songs.splice(
|
|
|
+ changedSong.position - 1,
|
|
|
+ 0,
|
|
|
+ this.stationPlaylist.songs.splice(
|
|
|
+ index,
|
|
|
+ 1
|
|
|
+ )[0]
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ modalUuid: this.modalUuid
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
},
|
|
|
beforeUnmount() {
|
|
|
this.socket.dispatch(
|
|
@@ -292,211 +478,21 @@ export default {
|
|
|
|
|
|
if (this.isOwnerOrAdmin()) this.showTab("settings");
|
|
|
this.clearStation();
|
|
|
+
|
|
|
+ // Delete the VueX module that was created for this modal, after all other cleanup tasks are performed
|
|
|
+ this.$store.unregisterModule([
|
|
|
+ "modals",
|
|
|
+ "manageStation",
|
|
|
+ this.modalUuid
|
|
|
+ ]);
|
|
|
},
|
|
|
methods: {
|
|
|
- init() {
|
|
|
- this.socket.dispatch(
|
|
|
- `stations.getStationById`,
|
|
|
- this.stationId,
|
|
|
- res => {
|
|
|
- if (res.status === "success") {
|
|
|
- const { station } = res.data;
|
|
|
- this.editStation(station);
|
|
|
-
|
|
|
- if (!this.isOwnerOrAdmin() && this.station.partyMode)
|
|
|
- this.showTab("songs");
|
|
|
-
|
|
|
- const currentSong = res.data.station.currentSong
|
|
|
- ? res.data.station.currentSong
|
|
|
- : {};
|
|
|
-
|
|
|
- this.updateCurrentSong(currentSong);
|
|
|
-
|
|
|
- this.updateStationPaused(res.data.station.paused);
|
|
|
-
|
|
|
- this.socket.dispatch(
|
|
|
- "stations.getStationIncludedPlaylistsById",
|
|
|
- this.stationId,
|
|
|
- res => {
|
|
|
- if (res.status === "success")
|
|
|
- this.setIncludedPlaylists(
|
|
|
- res.data.playlists
|
|
|
- );
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.dispatch(
|
|
|
- "stations.getStationExcludedPlaylistsById",
|
|
|
- this.stationId,
|
|
|
- res => {
|
|
|
- if (res.status === "success")
|
|
|
- this.setExcludedPlaylists(
|
|
|
- res.data.playlists
|
|
|
- );
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.dispatch(
|
|
|
- "stations.getQueue",
|
|
|
- this.stationId,
|
|
|
- res => {
|
|
|
- if (res.status === "success")
|
|
|
- this.updateSongsList(res.data.queue);
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.dispatch(
|
|
|
- "apis.joinRoom",
|
|
|
- `manage-station.${this.stationId}`
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.name.updated",
|
|
|
- res => {
|
|
|
- this.station.name = res.data.name;
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.displayName.updated",
|
|
|
- res => {
|
|
|
- this.station.displayName = res.data.displayName;
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.description.updated",
|
|
|
- res => {
|
|
|
- this.station.description = res.data.description;
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.partyMode.updated",
|
|
|
- res => {
|
|
|
- if (this.station.type === "community")
|
|
|
- this.station.partyMode = res.data.partyMode;
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.playMode.updated",
|
|
|
- res => {
|
|
|
- this.station.playMode = res.data.playMode;
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.theme.updated",
|
|
|
- res => {
|
|
|
- const { theme } = res.data;
|
|
|
- this.station.theme = theme;
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.privacy.updated",
|
|
|
- res => {
|
|
|
- this.station.privacy = res.data.privacy;
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.queue.lock.toggled",
|
|
|
- res => {
|
|
|
- this.station.locked = res.data.locked;
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.includedPlaylist",
|
|
|
- res => {
|
|
|
- const { playlist } = res.data;
|
|
|
- const playlistIndex = this.includedPlaylists
|
|
|
- .map(
|
|
|
- includedPlaylist => includedPlaylist._id
|
|
|
- )
|
|
|
- .indexOf(playlist._id);
|
|
|
- if (playlistIndex === -1)
|
|
|
- this.includedPlaylists.push(playlist);
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.excludedPlaylist",
|
|
|
- res => {
|
|
|
- const { playlist } = res.data;
|
|
|
- const playlistIndex = this.excludedPlaylists
|
|
|
- .map(
|
|
|
- excludedPlaylist => excludedPlaylist._id
|
|
|
- )
|
|
|
- .indexOf(playlist._id);
|
|
|
- if (playlistIndex === -1)
|
|
|
- this.excludedPlaylists.push(playlist);
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.removedIncludedPlaylist",
|
|
|
- res => {
|
|
|
- const { playlistId } = res.data;
|
|
|
- const playlistIndex = this.includedPlaylists
|
|
|
- .map(playlist => playlist._id)
|
|
|
- .indexOf(playlistId);
|
|
|
- if (playlistIndex >= 0)
|
|
|
- this.includedPlaylists.splice(
|
|
|
- playlistIndex,
|
|
|
- 1
|
|
|
- );
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.removedExcludedPlaylist",
|
|
|
- res => {
|
|
|
- const { playlistId } = res.data;
|
|
|
- const playlistIndex = this.excludedPlaylists
|
|
|
- .map(playlist => playlist._id)
|
|
|
- .indexOf(playlistId);
|
|
|
- if (playlistIndex >= 0)
|
|
|
- this.excludedPlaylists.splice(
|
|
|
- playlistIndex,
|
|
|
- 1
|
|
|
- );
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
-
|
|
|
- this.socket.on(
|
|
|
- "event:station.deleted",
|
|
|
- () => {
|
|
|
- new Toast(
|
|
|
- `The station you were editing was deleted.`
|
|
|
- );
|
|
|
- this.closeModal("manageStation");
|
|
|
- },
|
|
|
- { modal: "manageStation" }
|
|
|
- );
|
|
|
- } else {
|
|
|
- new Toast(`Station with that ID not found`);
|
|
|
- this.closeModal("manageStation");
|
|
|
- }
|
|
|
- }
|
|
|
- );
|
|
|
- },
|
|
|
isOwner() {
|
|
|
- return this.loggedIn && this.userId === this.station.owner;
|
|
|
+ return (
|
|
|
+ this.loggedIn &&
|
|
|
+ this.station &&
|
|
|
+ this.userId === this.station.owner
|
|
|
+ );
|
|
|
},
|
|
|
isAdmin() {
|
|
|
return this.loggedIn && this.role === "admin";
|
|
@@ -504,6 +500,17 @@ export default {
|
|
|
isOwnerOrAdmin() {
|
|
|
return this.isOwner() || this.isAdmin();
|
|
|
},
|
|
|
+ canRequest() {
|
|
|
+ return (
|
|
|
+ this.station &&
|
|
|
+ this.loggedIn &&
|
|
|
+ this.station.requests &&
|
|
|
+ this.station.requests.enabled &&
|
|
|
+ (this.station.requests.access === "user" ||
|
|
|
+ (this.station.requests.access === "owner" &&
|
|
|
+ this.isOwnerOrAdmin()))
|
|
|
+ );
|
|
|
+ },
|
|
|
removeStation() {
|
|
|
this.socket.dispatch("stations.remove", this.station._id, res => {
|
|
|
new Toast(res.message);
|
|
@@ -537,9 +544,9 @@ export default {
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
- clearAndRefillStationQueue() {
|
|
|
+ resetQueue() {
|
|
|
this.socket.dispatch(
|
|
|
- "stations.clearAndRefillStationQueue",
|
|
|
+ "stations.resetQueue",
|
|
|
this.station._id,
|
|
|
res => {
|
|
|
if (res.status !== "success")
|
|
@@ -551,30 +558,23 @@ export default {
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
- stationPlaylist() {
|
|
|
- this.socket.dispatch(
|
|
|
- "playlists.getPlaylistForStation",
|
|
|
- this.station._id,
|
|
|
- false,
|
|
|
- res => {
|
|
|
- if (res.status === "success") {
|
|
|
- this.editPlaylist(res.data.playlist._id);
|
|
|
- this.openModal("editPlaylist");
|
|
|
- } else {
|
|
|
- new Toast(res.message);
|
|
|
- }
|
|
|
- }
|
|
|
- );
|
|
|
+ onCloseModal() {
|
|
|
+ if (this.isOwnerOrAdmin() || this.sector !== "home")
|
|
|
+ this.$refs.settingsTabComponent.onCloseModal();
|
|
|
+ else this.closeModal("manageStation");
|
|
|
},
|
|
|
- ...mapActions("modals/manageStation", [
|
|
|
+ ...mapModalActions("modals/manageStation/MODAL_UUID", [
|
|
|
"editStation",
|
|
|
- "setIncludedPlaylists",
|
|
|
- "setExcludedPlaylists",
|
|
|
+ "setAutofillPlaylists",
|
|
|
+ "setBlacklist",
|
|
|
"clearStation",
|
|
|
"updateSongsList",
|
|
|
+ "updateStationPlaylist",
|
|
|
"repositionSongInList",
|
|
|
"updateStationPaused",
|
|
|
- "updateCurrentSong"
|
|
|
+ "updateCurrentSong",
|
|
|
+ "updateStation",
|
|
|
+ "updateIsFavorited"
|
|
|
]),
|
|
|
...mapActions({
|
|
|
showTab(dispatch, payload) {
|
|
@@ -582,11 +582,13 @@ export default {
|
|
|
this.$refs[`${payload}-tab`].scrollIntoView({
|
|
|
block: "nearest"
|
|
|
}); // Only works if the ref exists, which it doesn't always
|
|
|
- return dispatch("modals/manageStation/showTab", payload);
|
|
|
+ return dispatch(
|
|
|
+ `modals/manageStation/${this.modalUuid}/showTab`,
|
|
|
+ payload
|
|
|
+ );
|
|
|
}
|
|
|
}),
|
|
|
- ...mapActions("modalVisibility", ["openModal", "closeModal"]),
|
|
|
- ...mapActions("user/playlists", ["editPlaylist"])
|
|
|
+ ...mapActions("modalVisibility", ["openModal", "closeModal"])
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -611,16 +613,19 @@ export default {
|
|
|
.night-mode {
|
|
|
.manage-station-modal.modal .modal-card-body {
|
|
|
.left-section {
|
|
|
- .tabs-container.section {
|
|
|
+ .station-info-box-wrapper {
|
|
|
+ border: 0;
|
|
|
+ }
|
|
|
+ .section {
|
|
|
background-color: transparent !important;
|
|
|
- .tab-selection .button {
|
|
|
- background: var(--dark-grey);
|
|
|
- color: var(--white);
|
|
|
- }
|
|
|
- .tab {
|
|
|
- background-color: var(--dark-grey-3);
|
|
|
- border: 0;
|
|
|
- }
|
|
|
+ }
|
|
|
+ .tab-selection .button {
|
|
|
+ background: var(--dark-grey);
|
|
|
+ color: var(--white);
|
|
|
+ }
|
|
|
+ .tab {
|
|
|
+ background-color: var(--dark-grey-3);
|
|
|
+ border: 0;
|
|
|
}
|
|
|
}
|
|
|
.right-section .section,
|
|
@@ -632,40 +637,48 @@ export default {
|
|
|
}
|
|
|
|
|
|
.manage-station-modal.modal .modal-card-body {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ height: 100%;
|
|
|
+
|
|
|
.left-section {
|
|
|
- .tabs-container {
|
|
|
- padding: 15px 0 !important;
|
|
|
- .tab-selection {
|
|
|
- display: flex;
|
|
|
- overflow-x: auto;
|
|
|
-
|
|
|
- .button {
|
|
|
- border-radius: @border-radius @border-radius 0 0;
|
|
|
- border: 0;
|
|
|
- text-transform: uppercase;
|
|
|
- font-size: 14px;
|
|
|
- color: var(--dark-grey-3);
|
|
|
- background-color: var(--light-grey-2);
|
|
|
- flex-grow: 1;
|
|
|
- height: 32px;
|
|
|
-
|
|
|
- &:not(:first-of-type) {
|
|
|
- margin-left: 5px;
|
|
|
- }
|
|
|
- }
|
|
|
+ .station-info-box-wrapper {
|
|
|
+ border-radius: @border-radius;
|
|
|
+ border: 1px solid var(--light-grey-3);
|
|
|
+ overflow: hidden;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ }
|
|
|
|
|
|
- .selected {
|
|
|
- background-color: var(--primary-color) !important;
|
|
|
- color: var(--white) !important;
|
|
|
- font-weight: 600;
|
|
|
+ .tab-selection {
|
|
|
+ display: flex;
|
|
|
+ overflow-x: auto;
|
|
|
+
|
|
|
+ .button {
|
|
|
+ border-radius: @border-radius @border-radius 0 0;
|
|
|
+ border: 0;
|
|
|
+ text-transform: uppercase;
|
|
|
+ font-size: 14px;
|
|
|
+ color: var(--dark-grey-3);
|
|
|
+ background-color: var(--light-grey-2);
|
|
|
+ flex-grow: 1;
|
|
|
+ height: 32px;
|
|
|
+
|
|
|
+ &:not(:first-of-type) {
|
|
|
+ margin-left: 5px;
|
|
|
}
|
|
|
}
|
|
|
- .tab {
|
|
|
- border: 1px solid var(--light-grey-3);
|
|
|
- padding: 15px;
|
|
|
- border-radius: 0 0 @border-radius @border-radius;
|
|
|
+
|
|
|
+ .selected {
|
|
|
+ background-color: var(--primary-color) !important;
|
|
|
+ color: var(--white) !important;
|
|
|
+ font-weight: 600;
|
|
|
}
|
|
|
}
|
|
|
+ .tab {
|
|
|
+ border: 1px solid var(--light-grey-3);
|
|
|
+ padding: 15px 10px;
|
|
|
+ border-radius: 0 0 @border-radius @border-radius;
|
|
|
+ }
|
|
|
}
|
|
|
.right-section {
|
|
|
.section {
|