sipp11 9 years ago
parent
commit
534078a7bb
  1. 24
      src/components/Account.js
  2. 2
      src/components/AuthenticatedApp.js
  3. 14
      src/components/Tx.js

24
src/components/Account.js

@ -23,11 +23,11 @@ class Account extends React.Component {
}
componentDidMount() {
if (this.state.accounts.length < 1) {
AccountStore.addChangeListener(this._onChange);
if (this.state.accounts == null || this.state.accounts.length < 1) {
this.fetchAllAccounts();
}
AccountStore.addChangeListener(this._onChange);
}
componentWillUnmount() {
@ -40,17 +40,8 @@ class Account extends React.Component {
getAccountState() {
return {
accounts: this.getAllAccountsState(),
account: this.getOneAccountsState()
}
accounts: AccountStore.accounts
}
getAllAccountsState() {
return AccountStore.accounts
}
getOneAccountsState() {
return AccountStore.account
}
renderAccounts(act, index) {
@ -89,6 +80,11 @@ class Account extends React.Component {
accountView = this.renderAccountView();
}
var accountList = <li>No account yet</li>
if (this.state.accounts != null) {
accountList = this.state.accounts.map(this.renderAccounts)
}
if (this.props.params.accountId) {
return (
<div className="grid-block">
@ -104,7 +100,7 @@ class Account extends React.Component {
<div className="grid-block">
<div className="large-4 medium-4 small-12">
<ul>
{this.state.accounts.map(this.renderAccounts)}
{accountList}
</ul>
</div>
<div className="large-6 medium-6 small-12">

2
src/components/AuthenticatedApp.js

@ -58,7 +58,7 @@ export default class AuthenticatedApp extends React.Component {
if (!this.state.userLoggedIn) {
return (
<div className="title-bar">
<div className="center title"><a>getExpensy</a></div>
<div className="center title"><Link to={`/`}>getExpensy</Link></div>
<span className="left hide-for-medium"><a zf-toggle="sub-nav">Menu</a></span>
<span className="right"><Link to={`signup`}>Sign Up</Link></span>
</div>

14
src/components/Tx.js

@ -108,16 +108,18 @@ class Tx extends React.Component {
}
render() {
var txsList = (
<li>No transaction yet</li>
);
if (this.state.txs.length) {
var txsList = <li>No transaction yet</li>
if (this.state.txs.length)
txsList = this.state.txs.map(this.renderTx);
}
var act_title = '';
if (this._account)
act_title = this._account.title;
return (
<div className="grid-block">
<div className="large-2 medium-2 small-12">
<h1>{this.props.account.title}</h1>
<h1>{act_title}</h1>
</div>
<div className="large-5 medium-5 small-12">
<hr/>

Loading…
Cancel
Save