Bläddra i källkod

Fixed issue where you can't deselect all queue playlists.

KrisVos130 7 år sedan
förälder
incheckning
1c83e89c72

+ 13 - 0
frontend/app/js/ducks/stationInfo.js

@@ -14,6 +14,7 @@ const PAUSE = "STATION_INFO::PAUSE";
 const RESUME = "STATION_INFO::RESUME";
 const SELECT_PLAYLIST = "STATION_INFO::SELECT_PLAYLIST";
 const SELECT_PLAYLIST_QUEUE = "STATION_INFO::SELECT_PLAYLIST_QUEUE";
+const DESELECT_PLAYLIST_QUEUE = "STATION_INFO::DESELECT_PLAYLIST_QUEUE";
 
 function joinStation(station) {
 	return {
@@ -111,6 +112,12 @@ function selectPlaylistQueue(playlistId) {
 	}
 }
 
+function deselectPlaylistQueue() {
+	return {
+		type: DESELECT_PLAYLIST_QUEUE,
+	}
+}
+
 
 
 const initialState = Map({
@@ -245,6 +252,10 @@ function reducer(state = initialState, action) {
 		return state.merge({
 			privatePlaylistQueue: action.playlistId,
 		});
+	case DESELECT_PLAYLIST_QUEUE:
+		return state.merge({
+			privatePlaylistQueue: null,
+		});
 	}
 	return state;
 }
@@ -264,6 +275,7 @@ const actionCreators = {
 	resume,
 	selectPlaylist,
 	selectPlaylistQueue,
+	deselectPlaylistQueue,
 };
 
 const actionTypes = {
@@ -281,6 +293,7 @@ const actionTypes = {
 	RESUME,
 	SELECT_PLAYLIST,
 	SELECT_PLAYLIST_QUEUE,
+	DESELECT_PLAYLIST_QUEUE,
 };
 
 export {

+ 9 - 4
frontend/app/js/views/Station/Views/Queue/index.jsx

@@ -4,13 +4,15 @@ import PropTypes from "prop-types";
 import CustomInput from "components/CustomInput.jsx";
 import CustomErrors from "components/CustomMessages.jsx";
 
+import { actionCreators as stationInfoActionCreators } from "ducks/stationInfo";
+import { bindActionCreators } from "redux";
+
 import SongList from "./SongList.jsx";
 import PlaylistList from "./PlaylistList.jsx";
 
 import { connect } from "react-redux";
 
 import { closeOverlay1, openOverlay2, closeOverlay2 } from "actions/stationOverlay";
-import { selectPlaylist, deselectPlaylists } from "actions/playlistQueue";
 
 import io from "io";
 
@@ -23,7 +25,7 @@ import io from "io";
 	station: {
 		stationId: state.station.info.get("stationId"),
 		owner: state.station.info.get("ownerId"),
-		playlistSelectedId: state.station.info.get("playlistSelected"),
+		privatePlaylistQueue: state.station.info.get("privatePlaylistQueue"),
 		songList: state.station.info.get("songList"),
 	},
 	song: {
@@ -33,6 +35,9 @@ import io from "io";
 		duration: state.station.currentSong.getIn(["timings", "duration"]),
 		thumbnail: state.station.currentSong.get("thumbnail"),
 	},
+}),
+(dispatch) => ({
+	onDeselectPlaylistQueue: bindActionCreators(stationInfoActionCreators.deselectPlaylistQueue, dispatch),
 }))
 export default class QueueList extends Component {
 	constructor(props) {
@@ -59,7 +64,7 @@ export default class QueueList extends Component {
 	};
 
 	deselectAll = () => {
-		this.props.dispatch(deselectPlaylists());
+		this.props.onDeselectPlaylistQueue();
 	}
 
 	close = () => {
@@ -79,7 +84,7 @@ export default class QueueList extends Component {
 					<hr/>
 					<PlaylistList/>
 					{
-						(this.props.station.playlistSelectedId)
+						(this.props.station.privatePlaylistQueue)
 							? <button onClick={ this.deselectAll }>Deselect all playlists</button>
 							: null
 					}