2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
2019-06-17 22:32:38 +02:00
|
|
|
import React from 'react';
|
2017-12-21 22:08:54 +01:00
|
|
|
import TransactionList from 'component/transactionList';
|
2019-11-01 20:17:06 +01:00
|
|
|
import { TX_LIST } from 'lbry-redux';
|
2017-08-20 23:42:00 +02:00
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
type Props = {
|
2019-11-01 20:17:06 +01:00
|
|
|
fetchTransactions: (number, number) => void,
|
2020-02-11 23:40:04 +01:00
|
|
|
fetchClaimListMine: () => void,
|
2018-03-26 23:32:43 +02:00
|
|
|
fetchingTransactions: boolean,
|
|
|
|
hasTransactions: boolean,
|
|
|
|
transactions: Array<Transaction>,
|
2020-02-11 23:40:04 +01:00
|
|
|
myClaims: ?Array<StreamClaim>,
|
2018-03-26 23:32:43 +02:00
|
|
|
};
|
|
|
|
|
2020-02-11 23:40:04 +01:00
|
|
|
function TransactionListRecent(props: Props) {
|
|
|
|
const { transactions, fetchTransactions, myClaims, fetchClaimListMine } = props;
|
2018-11-07 20:35:47 +01:00
|
|
|
|
2020-02-11 23:40:04 +01:00
|
|
|
React.useEffect(() => {
|
2019-11-01 20:17:06 +01:00
|
|
|
fetchTransactions(1, TX_LIST.LATEST_PAGE_SIZE);
|
2020-02-11 23:40:04 +01:00
|
|
|
}, [fetchTransactions]);
|
2017-08-20 23:42:00 +02:00
|
|
|
|
2020-02-11 23:40:04 +01:00
|
|
|
const myClaimsString = myClaims && myClaims.map(channel => channel.permanent_url).join(',');
|
|
|
|
React.useEffect(() => {
|
|
|
|
if (myClaimsString === '') {
|
|
|
|
fetchClaimListMine();
|
|
|
|
}
|
|
|
|
}, [myClaimsString, fetchClaimListMine]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<section className="card">
|
|
|
|
<TransactionList
|
|
|
|
slim
|
|
|
|
title={__('Latest Transactions')}
|
|
|
|
transactions={transactions}
|
|
|
|
emptyMessage={__("Looks like you don't have any transactions.")}
|
|
|
|
/>
|
|
|
|
</section>
|
|
|
|
);
|
2017-08-20 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default TransactionListRecent;
|