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');
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() {
		this.props.tryResumingSession();
		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 = (
				 Go manage your money.MoneyGo