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

55 lines
1.5 KiB
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
import React 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-03-26 23:32:43 +02:00
import type { Transaction } from 'component/transactionList/view';
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>,
};
class TransactionListRecent extends React.PureComponent<Props> {
componentDidMount() {
2017-08-20 23:42:00 +02:00
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 (
2018-03-26 23:32:43 +02:00
<section className="card card--section">
<div className="card__title">{__('Recent Transactions')}</div>
{fetchingTransactions && (
<div className="card__content">
<BusyIndicator message={__('Loading transactions')} />
</div>
)}
{!fetchingTransactions && (
<TransactionList
slim
transactions={transactions}
emptyMessage={__("Looks like you don't have any recent transactions.")}
/>
)}
2017-11-24 15:31:05 +01:00
{hasTransactions && (
2018-03-26 23:32:43 +02:00
<div className="card__actions">
<Button
button="primary"
2017-08-20 23:42:00 +02:00
navigate="/history"
label={__('Full History')}
2018-03-26 23:32:43 +02:00
icon={icons.CLOCK}
2017-08-20 23:42:00 +02:00
/>
2017-11-24 15:31:05 +01:00
</div>
)}
2017-08-20 23:42:00 +02:00
</section>
);
}
}
export default TransactionListRecent;