pitaya-launcher/js/app.js

44 lines
855 B
JavaScript

var React = require('react');
var LauncherView = require('./components/launcher/launcher-view.js');
var EditView = require('./components/edit/edit-view.js');
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 = process.env.PITAYA_MODE === 'edit';
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
);