import React from 'react';
import {
Address,
BusyMessage,
CreditAmount
} from 'component/common';
class TransactionList extends React.Component{
componentWillMount() {
this.props.fetchTransactions()
}
render() {
const {
fetchingTransactions,
transactionItems,
} = this.props
const rows = []
if (transactionItems.length > 0) {
transactionItems.forEach(function (item) {
rows.push(
{ (item.amount > 0 ? '+' : '' ) + item.amount } |
{ item.date ? item.date.toLocaleDateString() : (Transaction pending) } |
{ item.date ? item.date.toLocaleTimeString() : (Transaction pending) } |
{item.id.substr(0, 7)}
|
);
});
}
return (
Transaction History
{ fetchingTransactions &&
}
{ !fetchingTransactions && rows.length === 0 ?
You have no transactions.
: '' }
{ rows.length > 0 ?
Amount |
Date |
Time |
Transaction |
{rows}
: ''
}
)
}
}
export default TransactionList