2016-02-12 20:36:59 -05:00
|
|
|
var React = require('react');
|
|
|
|
|
|
|
|
var ReactBootstrap = require('react-bootstrap');
|
|
|
|
var Jumbotron = ReactBootstrap.Jumbotron;
|
|
|
|
var Tabs = ReactBootstrap.Tabs;
|
|
|
|
var Tab = ReactBootstrap.Tab;
|
|
|
|
var Modal = ReactBootstrap.Modal;
|
|
|
|
|
2016-10-05 13:45:09 -04:00
|
|
|
var TopBarContainer = require('../containers/TopBarContainer');
|
2017-01-08 21:04:01 -05:00
|
|
|
var NewUserModalContainer = require('../containers/NewUserModalContainer');
|
2016-10-05 13:45:09 -04:00
|
|
|
var AccountSettingsModalContainer = require('../containers/AccountSettingsModalContainer');
|
|
|
|
var AccountsTabContainer = require('../containers/AccountsTabContainer');
|
2016-10-26 06:58:14 -04:00
|
|
|
var SecuritiesTabContainer = require('../containers/SecuritiesTabContainer');
|
2017-02-11 20:39:38 -05:00
|
|
|
var ReportsTabContainer = require('../containers/ReportsTabContainer');
|
2016-02-12 20:36:59 -05:00
|
|
|
|
|
|
|
module.exports = React.createClass({
|
|
|
|
displayName: "MoneyGoApp",
|
|
|
|
getInitialState: function() {
|
|
|
|
return {
|
2017-01-08 21:04:01 -05:00
|
|
|
showNewUserModal: false,
|
2016-02-12 20:36:59 -05:00
|
|
|
showAccountSettingsModal: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
componentDidMount: function() {
|
2016-10-05 13:36:47 -04:00
|
|
|
this.props.tryResumingSession();
|
2016-02-12 20:36:59 -05:00
|
|
|
},
|
|
|
|
handleAccountSettings: function() {
|
|
|
|
this.setState({showAccountSettingsModal: true});
|
|
|
|
},
|
|
|
|
handleSettingsSubmitted: function(user) {
|
2017-01-08 21:04:01 -05:00
|
|
|
this.setState({showAccountSettingsModal: false});
|
2016-02-12 20:36:59 -05:00
|
|
|
},
|
2016-10-05 13:36:47 -04:00
|
|
|
handleSettingsCanceled: function() {
|
2016-02-12 20:36:59 -05:00
|
|
|
this.setState({showAccountSettingsModal: false});
|
|
|
|
},
|
|
|
|
handleCreateNewUser: function() {
|
2017-01-08 21:04:01 -05:00
|
|
|
this.setState({showNewUserModal: true});
|
|
|
|
},
|
|
|
|
handleNewUserCreated: function() {
|
|
|
|
this.setState({showNewUserModal: false});
|
2016-02-12 20:36:59 -05:00
|
|
|
},
|
2017-01-08 21:04:01 -05:00
|
|
|
handleNewUserCanceled: function() {
|
|
|
|
this.setState({showNewUserModal: false});
|
2016-02-12 20:36:59 -05:00
|
|
|
},
|
|
|
|
render: function() {
|
|
|
|
var mainContent;
|
2017-01-08 21:04:01 -05:00
|
|
|
if (this.props.user.isUser())
|
|
|
|
mainContent = (
|
|
|
|
<Tabs defaultActiveKey={1} id='mainNavigationTabs'>
|
|
|
|
<Tab title="Accounts" eventKey={1} >
|
|
|
|
<AccountsTabContainer
|
|
|
|
className="fullheight" />
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Securities" eventKey={2} >
|
|
|
|
<SecuritiesTabContainer
|
|
|
|
className="fullheight" />
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Scheduled Transactions" eventKey={3} >Scheduled transactions go here...</Tab>
|
|
|
|
<Tab title="Budgets" eventKey={4} >Budgets go here...</Tab>
|
2017-02-11 20:39:38 -05:00
|
|
|
<Tab title="Reports" eventKey={5} >
|
|
|
|
<ReportsTabContainer
|
|
|
|
className="fullheight" />
|
|
|
|
</Tab>
|
2017-01-08 21:04:01 -05:00
|
|
|
</Tabs>);
|
|
|
|
else
|
|
|
|
mainContent = (
|
|
|
|
<Jumbotron>
|
|
|
|
<center>
|
|
|
|
<h1>Money<i>Go</i></h1>
|
|
|
|
<p><i>Go</i> manage your money.</p>
|
|
|
|
</center>
|
|
|
|
</Jumbotron>);
|
2016-02-12 20:36:59 -05:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="fullheight ui">
|
2016-10-05 13:36:47 -04:00
|
|
|
<TopBarContainer
|
2016-02-12 20:36:59 -05:00
|
|
|
onCreateNewUser={this.handleCreateNewUser}
|
2016-10-05 13:36:47 -04:00
|
|
|
onAccountSettings={this.handleAccountSettings} />
|
2016-02-12 20:36:59 -05:00
|
|
|
{mainContent}
|
2017-01-08 21:04:01 -05:00
|
|
|
<NewUserModalContainer
|
|
|
|
show={this.state.showNewUserModal}
|
|
|
|
onSubmit={this.handleNewUserCreated}
|
|
|
|
onCancel={this.handleNewUserCanceled}/>
|
2016-10-05 13:36:47 -04:00
|
|
|
<AccountSettingsModalContainer
|
2016-02-12 20:36:59 -05:00
|
|
|
show={this.state.showAccountSettingsModal}
|
|
|
|
onSubmit={this.handleSettingsSubmitted}
|
|
|
|
onCancel={this.handleSettingsCanceled}/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|