2016-10-03 14:44:27 +13:00
|
|
|
|
|
|
|
|
import React, { PropTypes } from 'react'
|
|
|
|
|
import { connect } from 'react-redux'
|
|
|
|
|
import { bindActionCreators } from 'redux'
|
|
|
|
|
|
|
|
|
|
import Services from '../services/Services'
|
2016-10-03 15:22:15 +13:00
|
|
|
import TrackList from '../components/TrackList'
|
2016-10-03 21:21:14 +13:00
|
|
|
import Track from '../components/Track'
|
2016-10-03 20:05:44 +13:00
|
|
|
import * as actions from '../actions/mopidy'
|
2016-10-03 14:44:27 +13:00
|
|
|
|
2016-10-03 20:05:44 +13:00
|
|
|
class Queue extends React.Component{
|
2016-10-03 14:44:27 +13:00
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-03 21:21:14 +13:00
|
|
|
renderTrackInFocus(){
|
|
|
|
|
if( this.props.mopidy && this.props.mopidy.trackInFocus ){
|
|
|
|
|
return (
|
2016-10-06 16:38:06 +13:00
|
|
|
<div>{ this.props.mopidy.trackInFocus.track.name }</div>
|
2016-10-03 21:21:14 +13:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
renderTrackList(){
|
2016-10-03 20:05:44 +13:00
|
|
|
if( this.props.mopidy && this.props.mopidy.tracks ){
|
2016-10-03 14:44:27 +13:00
|
|
|
return (
|
2016-10-03 20:05:44 +13:00
|
|
|
<TrackList tracks={this.props.mopidy.tracks} />
|
2016-10-03 14:44:27 +13:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<h3>Now playing</h3>
|
2016-10-03 21:21:14 +13:00
|
|
|
{ this.renderTrackInFocus() }
|
|
|
|
|
<h4>Other tracks</h4>
|
|
|
|
|
{ this.renderTrackList() }
|
2016-10-03 14:44:27 +13:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Export our component
|
|
|
|
|
*
|
|
|
|
|
* We also integrate our global store, using connect()
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state, ownProps) => {
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
|
|
|
return {
|
2016-10-03 20:05:44 +13:00
|
|
|
actions: bindActionCreators(actions, dispatch)
|
2016-10-03 14:44:27 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-03 20:05:44 +13:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Queue)
|