Reordering local playlist tracks; Lazy-loading track details

This commit is contained in:
James Barnsley
2016-11-16 13:13:35 +13:00
parent af32551ddf
commit 98770441cc
8 changed files with 123 additions and 59 deletions

View File

@ -73,8 +73,12 @@ class Playlist extends React.Component{
this.props.mopidyActions.deletePlaylist( this.props.params.uri )
}
removeTracks( track_indexes ){
this.props.uiActions.removeTracksFromPlaylist( this.props.playlist.uri, track_indexes )
reorderTracks( indexes, index ){
this.props.uiActions.reorderPlaylistTracks( this.props.playlist.uri, indexes, index )
}
removeTracks( tracks_indexes ){
this.props.uiActions.removeTracksFromPlaylist( this.props.playlist.uri, tracks_indexes )
}
renderEditButtons(){
@ -138,7 +142,7 @@ class Playlist extends React.Component{
</div>
<section className="list-wrapper">
{ this.props.playlist.tracks ? <TrackList context="editable-playlist" tracks={ this.props.playlist.tracks } removeTracks={ track_indexes => this.removeTracks(track_indexes) } /> : null }
{ this.props.playlist.tracks ? <TrackList context="editable-playlist" tracks={ this.props.playlist.tracks } removeTracks={ tracks_indexes => this.removeTracks(tracks_indexes) } reorderTracks={ (indexes, index) => this.reorderTracks(indexes, index) } /> : null }
<LazyLoadListener loadMore={ () => this.loadMore() }/>
</section>

View File

@ -37,6 +37,10 @@ class Queue extends React.Component{
this.props.mopidyActions.changeTrack( tracks[0].tlid )
}
reorderTracks( indexes, index ){
this.props.mopidyActions.reorderTracklist( indexes, index )
}
render(){
return (
<div className="view queue-view">
@ -50,7 +54,8 @@ class Queue extends React.Component{
tracks={this.props.current_tracklist}
removeTracks={ tracks => this.removeTracks( tracks ) }
playTracks={ tracks => this.playTracks( tracks ) }
playTrack={ track => this.playTrack( track ) } />
playTrack={ track => this.playTrack( track ) }
reorderTracks={ (indexes, index) => this.reorderTracks(indexes, index) } />
</section>
</div>