2017-12-21 22:08:54 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { BusyMessage } from 'component/common';
|
|
|
|
import Link from 'component/link';
|
|
|
|
import TransactionList from 'component/transactionList';
|
|
|
|
import * as icons from 'constants/icons';
|
2017-08-20 23:42:00 +02:00
|
|
|
|
|
|
|
class TransactionListRecent extends React.PureComponent {
|
|
|
|
componentWillMount() {
|
|
|
|
this.props.fetchTransactions();
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { fetchingTransactions, hasTransactions, transactions } = this.props;
|
2017-08-21 05:38:34 +02:00
|
|
|
|
2017-08-20 23:42:00 +02:00
|
|
|
return (
|
|
|
|
<section className="card">
|
|
|
|
<div className="card__title-primary">
|
2017-12-21 22:08:54 +01:00
|
|
|
<h3>{__('Recent Transactions')}</h3>
|
2017-08-20 23:42:00 +02:00
|
|
|
</div>
|
|
|
|
<div className="card__content">
|
2017-12-21 22:08:54 +01:00
|
|
|
{fetchingTransactions && <BusyMessage message={__('Loading transactions')} />}
|
2017-11-24 15:31:05 +01:00
|
|
|
{!fetchingTransactions && (
|
2017-08-20 23:42:00 +02:00
|
|
|
<TransactionList
|
|
|
|
transactions={transactions}
|
2017-12-21 22:08:54 +01:00
|
|
|
emptyMessage={__('You have no recent transactions.')}
|
2017-11-24 15:31:05 +01:00
|
|
|
/>
|
|
|
|
)}
|
2017-08-20 23:42:00 +02:00
|
|
|
</div>
|
2017-11-24 15:31:05 +01:00
|
|
|
{hasTransactions && (
|
2017-08-26 05:21:26 +02:00
|
|
|
<div className="card__actions card__actions--bottom">
|
2017-08-20 23:42:00 +02:00
|
|
|
<Link
|
|
|
|
navigate="/history"
|
2017-12-21 22:08:54 +01:00
|
|
|
label={__('Full History')}
|
2017-10-15 03:42:47 +02:00
|
|
|
icon={icons.HISTORY}
|
|
|
|
className="no-underline"
|
2017-08-20 23:42:00 +02:00
|
|
|
button="text"
|
|
|
|
/>
|
2017-11-24 15:31:05 +01:00
|
|
|
</div>
|
|
|
|
)}
|
2017-08-20 23:42:00 +02:00
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TransactionListRecent;
|