2017-12-21 22:08:54 +01:00
|
|
|
import React from 'react';
|
2018-03-26 23:32:43 +02:00
|
|
|
import BusyIndicator from 'component/common/busy-indicator';
|
2017-12-21 22:08:54 +01:00
|
|
|
import TransactionList from 'component/transactionList';
|
2018-03-26 23:32:43 +02:00
|
|
|
import Page from 'component/page';
|
2017-08-19 05:08:01 +02:00
|
|
|
|
2017-08-20 23:42:00 +02:00
|
|
|
class TransactionHistoryPage extends React.PureComponent {
|
|
|
|
componentWillMount() {
|
|
|
|
this.props.fetchTransactions();
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { fetchingTransactions, transactions } = this.props;
|
2017-09-18 02:52:57 +02:00
|
|
|
|
2017-08-20 23:42:00 +02:00
|
|
|
return (
|
2018-03-26 23:32:43 +02:00
|
|
|
<Page>
|
|
|
|
<section className="card card--section">
|
2017-09-18 02:52:57 +02:00
|
|
|
<div
|
2018-03-26 23:32:43 +02:00
|
|
|
className={`card__title ${
|
2017-12-21 22:08:54 +01:00
|
|
|
fetchingTransactions && transactions.length ? 'reloading' : ''
|
|
|
|
}`}
|
2017-09-18 02:52:57 +02:00
|
|
|
>
|
2017-12-21 22:08:54 +01:00
|
|
|
<h3>{__('Transaction History')}</h3>
|
2017-08-20 23:42:00 +02:00
|
|
|
</div>
|
2018-03-26 23:32:43 +02:00
|
|
|
{fetchingTransactions && !transactions.length ? (
|
|
|
|
<div className="card__content">
|
|
|
|
<BusyIndicator message={__('Loading transactions')} />
|
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
''
|
|
|
|
)}
|
|
|
|
{transactions && transactions.length ? (
|
|
|
|
<TransactionList transactions={transactions} />
|
|
|
|
) : (
|
2018-06-18 08:34:59 +02:00
|
|
|
<div className="card__content">{__("Looks like you don't have any transactions")}</div>
|
2018-03-26 23:32:43 +02:00
|
|
|
)}
|
2017-08-20 23:42:00 +02:00
|
|
|
</section>
|
2018-03-26 23:32:43 +02:00
|
|
|
</Page>
|
2017-08-20 23:42:00 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2017-08-19 05:08:01 +02:00
|
|
|
|
|
|
|
export default TransactionHistoryPage;
|