lbry-desktop/src/renderer/component/transactionListRecent/view.jsx

67 lines
2 KiB
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
2018-11-08 18:13:36 +01:00
import type { Transaction } from 'component/transactionList/view';
import React, { Fragment } from 'react';
2018-03-26 23:32:43 +02:00
import BusyIndicator from 'component/common/busy-indicator';
import Button from 'component/button';
import TransactionList from 'component/transactionList';
import * as icons from 'constants/icons';
2018-11-08 18:13:36 +01:00
import RefreshTransactionButton from 'component/transactionRefreshButton';
2017-08-20 23:42:00 +02:00
2018-03-26 23:32:43 +02:00
type Props = {
fetchTransactions: () => void,
fetchingTransactions: boolean,
hasTransactions: boolean,
transactions: Array<Transaction>,
fetchMyClaims: () => void,
2018-03-26 23:32:43 +02:00
};
class TransactionListRecent extends React.PureComponent<Props> {
componentDidMount() {
const { fetchMyClaims, fetchTransactions } = this.props;
fetchMyClaims();
fetchTransactions();
2017-08-20 23:42:00 +02:00
}
render() {
2018-11-08 18:13:36 +01:00
const { fetchingTransactions, hasTransactions, transactions } = this.props;
2017-08-20 23:42:00 +02:00
return (
2018-03-26 23:32:43 +02:00
<section className="card card--section">
<div className="card__title card--space-between">
{__('Recent Transactions')}
2018-11-08 18:13:36 +01:00
<RefreshTransactionButton />
</div>
2018-10-04 06:11:08 +02:00
<div className="card__subtitle">
{__('To view all of your transactions, navigate to the')}{' '}
<Button button="link" navigate="/history" label={__('transactions page')} />.
</div>
{fetchingTransactions &&
!hasTransactions && (
<div className="card__content">
<BusyIndicator message={__('Loading transactions')} />
</div>
)}
2017-11-24 15:31:05 +01:00
{hasTransactions && (
<Fragment>
<TransactionList
slim
transactions={transactions}
emptyMessage={__("Looks like you don't have any recent transactions.")}
2017-08-20 23:42:00 +02:00
/>
<div className="card__actions">
<Button
button="primary"
navigate="/history"
label={__('Full History')}
icon={icons.CLOCK}
/>
</div>
</Fragment>
2017-11-24 15:31:05 +01:00
)}
2017-08-20 23:42:00 +02:00
</section>
);
}
}
export default TransactionListRecent;