Files
Iris/src/js/components/Queue.js

66 lines
1.3 KiB
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 FontAwesome from 'react-fontawesome'
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'
import Player from '../components/Player'
import * as actions from '../services/mopidy/actions'
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() }
<Player />
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)