Loëck Vézien
7 years ago
No known key found for this signature in database
GPG Key ID: CBCDCE384E853AC4
3 changed files with
14 additions and
5 deletions
-
.prettierignore
-
src/components/AccountPage.js
-
src/reducers/accounts.js
|
|
@ -0,0 +1 @@ |
|
|
|
package.json |
|
|
@ -43,7 +43,7 @@ class AccountPage extends PureComponent<Props> { |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
<Card title="Last operations"> |
|
|
|
{accountData.transactions.reverse().map(tr => ( |
|
|
|
{accountData.transactions.map(tr => ( |
|
|
|
<Box horizontal key={tr.hash}> |
|
|
|
<Box grow>{'-'}</Box> |
|
|
|
<Box>{format(tr.balance)}</Box> |
|
|
|
|
|
@ -11,12 +11,20 @@ export type AccountsState = Accounts |
|
|
|
|
|
|
|
const state: AccountsState = {} |
|
|
|
|
|
|
|
function setAccount(account: Account) { |
|
|
|
return { |
|
|
|
...account, |
|
|
|
data: { |
|
|
|
...account.data, |
|
|
|
transactions: get(account.data, 'transactions', []).reverse(), |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const handlers: Object = { |
|
|
|
ADD_ACCOUNT: (state: AccountsState, { payload: account }: { payload: Account }) => ({ |
|
|
|
...state, |
|
|
|
[account.id]: { |
|
|
|
...account, |
|
|
|
}, |
|
|
|
[account.id]: setAccount(account), |
|
|
|
}), |
|
|
|
FETCH_ACCOUNTS: (state: AccountsState, { payload: accounts }: { payload: Accounts }) => accounts, |
|
|
|
SET_ACCOUNT_DATA: ( |
|
|
@ -40,7 +48,7 @@ const handlers: Object = { |
|
|
|
|
|
|
|
return { |
|
|
|
...state, |
|
|
|
[accountID]: account, |
|
|
|
[accountID]: setAccount(account), |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|