lbry-desktop/ui/js/component/transactionList/view.jsx

58 lines
1.4 KiB
React
Raw Normal View History

2017-06-06 23:19:12 +02:00
import React from "react";
import LinkTransaction from "component/linkTransaction";
2017-08-20 23:42:00 +02:00
import { CreditAmount } from "component/common";
2017-08-20 23:42:00 +02:00
const TransactionList = props => {
const { emptyMessage, transactions } = props;
2017-08-20 23:42:00 +02:00
if (!transactions || !transactions.length) {
return (
2017-08-20 23:42:00 +02:00
<div className="empty">
{emptyMessage || __("No transactions to list.")}
</div>
2017-06-06 23:19:12 +02:00
);
}
2017-08-20 23:42:00 +02:00
return (
<table className="table-standard table-stretch">
<thead>
<tr>
<th>{__("Date")}</th>
<th>{__("Amount")}</th>
<th>{__("Transaction")}</th>
</tr>
</thead>
<tbody>
{transactions.map(item => {
return (
<tr key={item.id}>
<td>
{item.date
? item.date.toLocaleDateString() +
" " +
item.date.toLocaleTimeString()
: <span className="empty">
{__("(Transaction pending)")}
</span>}
</td>
<td>
<CreditAmount
amount={item.amount}
look="plain"
showPlus={true}
precision={8}
/>{" "}
</td>
<td>
<LinkTransaction id={item.id} />
</td>
</tr>
);
})}
</tbody>
</table>
);
};
2017-06-06 06:21:55 +02:00
export default TransactionList;