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