Clearing queue also clears current_track

This commit is contained in:
James Barnsley
2018-06-26 15:37:50 +12:00
parent 8ede56d876
commit 403d348d2f
9 changed files with 1784 additions and 1735 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -77,7 +77,7 @@
// Release details
// These are automatically injected to built HTML
var build = "1529956787";
var build = "1529975869";
var version = "3.21.2";
// Construct the script tag

View File

@ -7,7 +7,7 @@ import { connect } from 'react-redux'
import ReactGA from 'react-ga'
import Sidebar from './components/Sidebar'
import PlaybackControls from './components/Fields/PlaybackControls'
import PlaybackControls from './components/PlaybackControls'
import ContextMenu from './components/ContextMenu'
import Dragger from './components/Dragger'
import Modal from './components/Modal/Modal'

View File

@ -4,18 +4,18 @@ import { connect } from 'react-redux'
import { Link } from 'react-router'
import { bindActionCreators } from 'redux'
import ProgressSlider from './ProgressSlider'
import VolumeControl from './VolumeControl'
import SnapcastVolumeControl from './SnapcastVolumeControl'
import Dater from './../Dater'
import ArtistSentence from './../ArtistSentence'
import Thumbnail from './../Thumbnail'
import Icon from './../Icon'
import ProgressSlider from './Fields/ProgressSlider'
import VolumeControl from './Fields/VolumeControl'
import SnapcastVolumeControl from './Fields/SnapcastVolumeControl'
import Dater from './Dater'
import ArtistSentence from './ArtistSentence'
import Thumbnail from './Thumbnail'
import Icon from './Icon'
import * as helpers from '../../helpers'
import * as uiActions from '../../services/ui/actions'
import * as coreActions from '../../services/core/actions'
import * as mopidyActions from '../../services/mopidy/actions'
import * as helpers from '../helpers'
import * as uiActions from '../services/ui/actions'
import * as coreActions from '../services/core/actions'
import * as mopidyActions from '../services/mopidy/actions'
class PlaybackControls extends React.Component{

View File

@ -66,6 +66,12 @@ export function set(data){
}
}
export function clearCurrentTrack(){
return {
type: 'CLEAR_CURRENT_TRACK'
}
}

View File

@ -349,6 +349,7 @@ const CoreMiddleware = (function(){
// Set our window title to the track title
helpers.setWindowTitle(null, store.getState().mopidy.play_state);
next(action);
break;
case 'QUEUE_LOADED':

View File

@ -807,16 +807,22 @@ const MopidyMiddleware = (function(){
break;
case 'MOPIDY_CLEAR_TRACKLIST':
request(socket, store, 'tracklist.clear');
store.dispatch(pusherActions.deliverBroadcast(
'notification',
{
notification: {
type: 'info',
content: store.getState().pusher.username +' cleared queue'
}
}
));
request(socket, store, 'tracklist.clear')
.then(
response => {
store.dispatch(coreActions.clearCurrentTrack());
store.dispatch(pusherActions.deliverBroadcast(
'notification',
{
notification: {
type: 'info',
content: store.getState().pusher.username +' cleared queue'
}
}
));
}
);
break;
@ -1399,8 +1405,6 @@ const MopidyMiddleware = (function(){
key: playlist.uri,
playlist: playlist
});
console.log(playlist);
})
}
})
@ -1531,19 +1535,18 @@ const MopidyMiddleware = (function(){
break
case 'MOPIDY_SAVE_PLAYLIST':
var uri = action.key
var uri = action.key;
request(socket, store, 'playlists.lookup', { uri: action.key })
.then(response => {
var playlist = Object.assign({}, response, { name: action.name })
request(socket, store, 'playlists.save', { playlist: playlist } )
request(socket, store, 'playlists.save', { playlist: playlist })
.then(response => {
store.dispatch({
type: 'PLAYLIST_UPDATED',
type: 'PLAYLIST_LOADED',
key: action.key,
playlist: playlist
})
});
// When we rename a playlist, the URI also changes to reflect the name change
// We need to update our index, as well as redirect our current page URL
@ -2053,7 +2056,8 @@ const MopidyMiddleware = (function(){
store.dispatch({
type: 'CURRENT_TRACK_LOADED',
track: track
track: track,
uri: track.uri
});
break;

View File

@ -131,7 +131,7 @@ class Queue extends React.Component{
}
var current_track_image = null;
if (current_track){
if (current_track && this.props.current_track_uri){
if (current_track.images !== undefined && current_track.images){
current_track_image = helpers.sizedImages(current_track.images).large;
}
@ -206,6 +206,7 @@ const mapStateToProps = (state, ownProps) => {
queue: state.core.queue,
queue_tlids: state.core.queue_tlids,
queue_metadata: state.core.queue_metadata,
current_track_uri: state.core.current_track_uri,
current_track: state.core.current_track
}
}