44 lines
859 B
JavaScript
44 lines
859 B
JavaScript
var React = require('react');
|
|
var LauncherView = require('./components/launcher/launcher-view.jsx');
|
|
var EditView = require('./components/edit/edit-view.jsx');
|
|
var Provider = require('react-redux').Provider;
|
|
var connect = require('react-redux').connect;
|
|
var store = require('./store');
|
|
|
|
// Main component
|
|
var App = React.createClass({
|
|
|
|
render: function() {
|
|
|
|
var editMode = this.props.processOpts.edit || false;
|
|
|
|
var view = editMode ? <EditView /> : <LauncherView />;
|
|
|
|
return (
|
|
<div id="pitaya">
|
|
{view}
|
|
</div>
|
|
);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
// Select props to inject from store state
|
|
function select(state) {
|
|
return {
|
|
processOpts: state.processOpts
|
|
}
|
|
}
|
|
|
|
// Connect App to Redux store
|
|
App = connect(select)(App);
|
|
|
|
React.render(
|
|
<Provider store={store}>
|
|
{ function() { return <App />; } }
|
|
</Provider>
|
|
,
|
|
document.body
|
|
);
|