2015-08-27 18:24:29 +02:00
|
|
|
var React = require('react');
|
2015-09-04 12:10:08 +02:00
|
|
|
var LauncherView = require('./components/launcher/launcher-view.jsx');
|
|
|
|
var EditView = require('./components/edit/edit-view.jsx');
|
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-09-04 12:10:08 +02:00
|
|
|
var editMode = this.props.processOpts.edit || false;
|
|
|
|
|
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
|
|
|
|
);
|