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
|
|
|
|
2017-06-07 19:12:53 -04:00
|
|
|
class MoneyGoApp extends React.Component {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.state = {
|
2017-01-08 21:04:01 -05:00
|
|
|
showNewUserModal: false,
|
2016-02-12 20:36:59 -05:00
|
|
|
showAccountSettingsModal: false
|
|
|
|
};
|
2017-06-07 19:12:53 -04:00
|
|
|
this.onShowSettings = this.handleShowSettings.bind(this);
|
|
|
|
this.onHideSettings = this.handleHideSettings.bind(this);
|
|
|
|
this.onShowNewUser = this.handleShowNewUser.bind(this);
|
|
|
|
this.onHideNewUser = this.handleHideNewUser.bind(this);
|
|
|
|
}
|
|
|
|
componentDidMount() {
|
2016-10-05 13:36:47 -04:00
|
|
|
this.props.tryResumingSession();
|
2017-06-21 21:25:38 -04:00
|
|
|
this.props.fetchCurrencies();
|
2017-06-07 19:12:53 -04:00
|
|
|
}
|
|
|
|
handleShowSettings() {
|
2016-02-12 20:36:59 -05:00
|
|
|
this.setState({showAccountSettingsModal: true});
|
2017-06-07 19:12:53 -04:00
|
|
|
}
|
|
|
|
handleHideSettings(user) {
|
2016-02-12 20:36:59 -05:00
|
|
|
this.setState({showAccountSettingsModal: false});
|
2017-06-07 19:12:53 -04:00
|
|
|
}
|
|
|
|
handleShowNewUser() {
|
2017-01-08 21:04:01 -05:00
|
|
|
this.setState({showNewUserModal: true});
|
2017-06-07 19:12:53 -04:00
|
|
|
}
|
|
|
|
handleHideNewUser() {
|
2017-01-08 21:04:01 -05:00
|
|
|
this.setState({showNewUserModal: false});
|
2017-06-07 19:12:53 -04:00
|
|
|
}
|
|
|
|
render() {
|
2016-02-12 20:36:59 -05:00
|
|
|
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
|
2017-06-07 19:12:53 -04:00
|
|
|
onCreateNewUser={this.onShowNewUser}
|
|
|
|
onAccountSettings={this.onShowSettings} />
|
2016-02-12 20:36:59 -05:00
|
|
|
{mainContent}
|
2017-01-08 21:04:01 -05:00
|
|
|
<NewUserModalContainer
|
|
|
|
show={this.state.showNewUserModal}
|
2017-06-07 19:12:53 -04:00
|
|
|
onSubmit={this.onHideNewUser}
|
|
|
|
onCancel={this.onHideNewUser}/>
|
2016-10-05 13:36:47 -04:00
|
|
|
<AccountSettingsModalContainer
|
2016-02-12 20:36:59 -05:00
|
|
|
show={this.state.showAccountSettingsModal}
|
2017-06-07 19:12:53 -04:00
|
|
|
onSubmit={this.onHideSettings}
|
|
|
|
onCancel={this.onHideSettings}/>
|
2016-02-12 20:36:59 -05:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-06-07 19:12:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = MoneyGoApp;
|