1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-11-14 10:50:04 -05:00
moneygo/js/components/MoneyGoApp.js

93 lines
2.7 KiB
JavaScript
Raw Normal View History

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;
var TopBarContainer = require('../containers/TopBarContainer');
var NewUserModalContainer = require('../containers/NewUserModalContainer');
var AccountSettingsModalContainer = require('../containers/AccountSettingsModalContainer');
var AccountsTabContainer = require('../containers/AccountsTabContainer');
var SecuritiesTabContainer = require('../containers/SecuritiesTabContainer');
2017-02-11 20:39:38 -05:00
var ReportsTabContainer = require('../containers/ReportsTabContainer');
class MoneyGoApp extends React.Component {
constructor() {
super();
this.state = {
showNewUserModal: false,
showAccountSettingsModal: false
};
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();
}
handleShowSettings() {
this.setState({showAccountSettingsModal: true});
}
handleHideSettings(user) {
this.setState({showAccountSettingsModal: false});
}
handleShowNewUser() {
this.setState({showNewUserModal: true});
}
handleHideNewUser() {
this.setState({showNewUserModal: false});
}
render() {
var mainContent;
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>
</Tabs>);
else
mainContent = (
<Jumbotron>
<center>
<h1>Money<i>Go</i></h1>
<p><i>Go</i> manage your money.</p>
</center>
</Jumbotron>);
return (
<div className="fullheight ui">
2016-10-05 13:36:47 -04:00
<TopBarContainer
onCreateNewUser={this.onShowNewUser}
onAccountSettings={this.onShowSettings} />
{mainContent}
<NewUserModalContainer
show={this.state.showNewUserModal}
onSubmit={this.onHideNewUser}
onCancel={this.onHideNewUser}/>
2016-10-05 13:36:47 -04:00
<AccountSettingsModalContainer
show={this.state.showAccountSettingsModal}
onSubmit={this.onHideSettings}
onCancel={this.onHideSettings}/>
</div>
);
}
}
module.exports = MoneyGoApp;