Files
Iris/src/components/Queue.js

52 lines
995 B
JavaScript
Raw Normal View History

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 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);
}
renderTracks(){
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>
{ this.renderTracks() }
</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)