Files
Iris/src/js/components/App.js

60 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-10-03 14:44:27 +13:00
import React, { PropTypes } from 'react';
import ReactDOM from 'react-dom';
import { createStore, bindActionCreators } from 'redux'
import { Link } from 'react-router'
import { connect } from 'react-redux'
2016-10-03 15:22:15 +13:00
import * as actions from '../actions/index'
import * as mopidyActions from '../services/mopidy/actions'
2016-10-03 14:44:27 +13:00
2016-10-14 18:15:34 +13:00
/**
* Root level application
**/
2016-10-03 14:44:27 +13:00
class App extends React.Component{
constructor(props){
super(props);
}
componentDidMount(){
this.props.mopidyActions.connect();
}
2016-10-03 14:44:27 +13:00
render(){
return (
<div>
<ul role="nav">
2016-10-03 15:22:15 +13:00
<li><Link to="/queue">Now playing</Link></li>
2016-10-03 14:44:27 +13:00
<li><Link to="/album/6N51k5TP5pSZYPf7bLffLe">808's and Heartbreak</Link></li>
<li><Link to="/album/1PgfRdl3lPyACfUGH4pquG">A million</Link></li>
<li><Link to="/library/albums">Library: Albums</Link></li>
<li><Link to="/album">Album</Link></li>
<li><a onClick={this.handleClick}>Authorize</a></li>
</ul>
{this.props.children}
</div>
);
}
}
/**
* Export our component
*
* We also integrate our global store, using connect()
**/
const mapStateToProps = (state, ownProps) => {
return state;
}
const mapDispatchToProps = (dispatch) => {
return {
actions: bindActionCreators(actions, dispatch),
mopidyActions: bindActionCreators(mopidyActions, dispatch)
2016-10-03 14:44:27 +13:00
}
}
export default connect(mapStateToProps, mapDispatchToProps)(App)