pitaya-launcher/js/app.jsx

40 lines
884 B
JavaScript

var React = require('react');
var minimist = require('minimist');
var gui = global.window.require('nw.gui');
var LauncherView = require('./components/launcher-view.jsx');
var EditView = require('./components/edit-view.jsx');
// Internal constants
var DEFAULT_PROFILE = './default-profile.json';
var PROCESS_OPTS = minimist(gui.App.argv);
// Main component
var App = React.createClass({
getInitialState: function() {
return {
profilePath: PROCESS_OPTS.profile,
editMode: PROCESS_OPTS.edit || false
};
},
render: function() {
var view = this.state.editMode ?
<EditView profilePath={this.state.profilePath} /> :
<LauncherView profilePath={this.state.profilePath ? this.state.profilePath : DEFAULT_PROFILE } />
;
return (
<div id="pitaya">
{view}
</div>
);
},
});
React.render(<App />, document.body);