2015-08-27 18:24:29 +02:00
|
|
|
var React = require('react');
|
2015-10-09 14:22:23 +02:00
|
|
|
var LauncherView = require('./components/launcher/launcher-view.js');
|
|
|
|
var EditView = require('./components/edit/edit-view.js');
|
2015-09-03 15:50:23 +02:00
|
|
|
var Provider = require('react-redux').Provider;
|
2015-09-04 12:10:08 +02:00
|
|
|
var connect = require('react-redux').connect;
|
|
|
|
var store = require('./store');
|
2015-08-27 18:24:29 +02:00
|
|
|
|
2015-08-28 10:06:25 +02:00
|
|
|
// Main component
|
2015-08-27 18:24:29 +02:00
|
|
|
var App = React.createClass({
|
|
|
|
|
|
|
|
render: function() {
|
2015-08-27 22:52:30 +02:00
|
|
|
|
2015-10-08 14:04:44 +02:00
|
|
|
var editMode = process.env.PITAYA_MODE === 'edit';
|
2015-09-04 12:10:08 +02:00
|
|
|
|
2015-09-11 16:25:45 +02:00
|
|
|
var view = editMode ? <EditView /> : <LauncherView />;
|
2015-08-27 22:52:30 +02:00
|
|
|
|
2015-08-27 18:24:29 +02:00
|
|
|
return (
|
2015-08-28 14:20:07 +02:00
|
|
|
<div id="pitaya">
|
|
|
|
{view}
|
2015-08-27 18:24:29 +02:00
|
|
|
</div>
|
|
|
|
);
|
2015-08-27 22:52:30 +02:00
|
|
|
|
|
|
|
},
|
|
|
|
|
2015-08-27 18:24:29 +02:00
|
|
|
});
|
|
|
|
|
2015-09-04 12:10:08 +02:00
|
|
|
// 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
|
|
|
|
);
|