Tracklist highlighting track
This commit is contained in:
@ -117,6 +117,14 @@ class TrackList extends React.Component{
|
|||||||
|
|
||||||
// flatten nested track objects (as in the case of TlTracks)
|
// flatten nested track objects (as in the case of TlTracks)
|
||||||
if( typeof(track.track) !== 'undefined' ){
|
if( typeof(track.track) !== 'undefined' ){
|
||||||
|
|
||||||
|
// see if we're the current tlTrack
|
||||||
|
if( self.props.mopidy.trackInFocus && self.props.mopidy.trackInFocus.tlid == track.tlid ){
|
||||||
|
track.playing = true;
|
||||||
|
}else{
|
||||||
|
track.playing = false;
|
||||||
|
}
|
||||||
|
|
||||||
for( var property in track.track ){
|
for( var property in track.track ){
|
||||||
if( track.track.hasOwnProperty(property) ){
|
if( track.track.hasOwnProperty(property) ){
|
||||||
track[property] = track.track[property]
|
track[property] = track.track[property]
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import React, { PropTypes } from 'react';
|
|||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { Provider } from 'react-redux'
|
import { Provider } from 'react-redux'
|
||||||
import { createStore } from 'redux'
|
import { createStore } from 'redux'
|
||||||
import { Router, Route, Link, hashHistory } from 'react-router'
|
import { Router, Route, Link, browserHistory } from 'react-router'
|
||||||
|
|
||||||
import store from './bootstrap.js'
|
import store from './bootstrap.js'
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ import LibraryPlaylists from './views/library/LibraryPlaylists'
|
|||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<Router history={hashHistory}>
|
<Router history={browserHistory}>
|
||||||
<Route path="/" component={App}>
|
<Route path="/" component={App}>
|
||||||
|
|
||||||
<Route path="library/artists" component={LibraryArtists} />
|
<Route path="library/artists" component={LibraryArtists} />
|
||||||
|
|||||||
@ -19,10 +19,7 @@ const MopidyMiddleware = (function(){
|
|||||||
instruct( ws, store, 'tracklist.getRandom' );
|
instruct( ws, store, 'tracklist.getRandom' );
|
||||||
instruct( ws, store, 'tracklist.getRepeat' );
|
instruct( ws, store, 'tracklist.getRepeat' );
|
||||||
instruct( ws, store, 'tracklist.getTlTracks' );
|
instruct( ws, store, 'tracklist.getTlTracks' );
|
||||||
instruct( ws, store, 'playback.getCurrentTlTrack' )
|
instruct( ws, store, 'playback.getCurrentTlTrack' );
|
||||||
.then( currentTlTrack => {
|
|
||||||
store.dispatch({ type: 'MOPIDY_HIGHLIGHT_CURRENT_TLTRACK', data: currentTlTrack })
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'state:offline':
|
case 'state:offline':
|
||||||
@ -30,20 +27,14 @@ const MopidyMiddleware = (function(){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'event:tracklistChanged':
|
case 'event:tracklistChanged':
|
||||||
instruct( ws, store, 'tracklist.getTlTracks' )
|
instruct( ws, store, 'tracklist.getTlTracks' );
|
||||||
.then( currentTlTrack => {
|
|
||||||
store.dispatch({ type: 'MOPIDY_HIGHLIGHT_CURRENT_TLTRACK', data: currentTlTrack })
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//case 'event:trackPlaybackEnded':
|
//case 'event:trackPlaybackEnded':
|
||||||
case 'event:playbackStateChanged':
|
case 'event:playbackStateChanged':
|
||||||
case 'event:trackPlaybackStarted':
|
case 'event:trackPlaybackStarted':
|
||||||
instruct( ws, store, 'playback.getState' );
|
instruct( ws, store, 'playback.getState' );
|
||||||
instruct( ws, store, 'playback.getCurrentTlTrack' )
|
instruct( ws, store, 'playback.getCurrentTlTrack' );
|
||||||
.then( currentTlTrack => {
|
|
||||||
store.dispatch({ type: 'MOPIDY_HIGHLIGHT_CURRENT_TLTRACK', data: currentTlTrack })
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'event:volumeChanged':
|
case 'event:volumeChanged':
|
||||||
|
|||||||
@ -34,6 +34,7 @@ class Queue extends React.Component{
|
|||||||
if( this.props.mopidy && this.props.mopidy.tracks ){
|
if( this.props.mopidy && this.props.mopidy.tracks ){
|
||||||
return (
|
return (
|
||||||
<TrackList
|
<TrackList
|
||||||
|
type="tltrack"
|
||||||
tracks={this.props.mopidy.tracks}
|
tracks={this.props.mopidy.tracks}
|
||||||
removeTracks={ tracks => this.removeTracks( tracks ) }
|
removeTracks={ tracks => this.removeTracks( tracks ) }
|
||||||
playTracks={ null }
|
playTracks={ null }
|
||||||
|
|||||||
Reference in New Issue
Block a user