2018-03-26 14:32:43 -07:00
|
|
|
// @flow
|
2019-06-17 16:32:38 -04:00
|
|
|
import React from 'react';
|
2017-12-21 18:08:54 -03:00
|
|
|
import TransactionList from 'component/transactionList';
|
2019-11-01 15:17:06 -04:00
|
|
|
import { TX_LIST } from 'lbry-redux';
|
2017-08-20 17:42:00 -04:00
|
|
|
|
2018-03-26 14:32:43 -07:00
|
|
|
type Props = {
|
2019-11-01 15:17:06 -04:00
|
|
|
fetchTransactions: (number, number) => void,
|
2020-02-11 17:40:04 -05:00
|
|
|
fetchClaimListMine: () => void,
|
2018-03-26 14:32:43 -07:00
|
|
|
fetchingTransactions: boolean,
|
|
|
|
hasTransactions: boolean,
|
|
|
|
transactions: Array<Transaction>,
|
2020-02-11 17:40:04 -05:00
|
|
|
myClaims: ?Array<StreamClaim>,
|
2018-03-26 14:32:43 -07:00
|
|
|
};
|
|
|
|
|
2020-02-11 17:40:04 -05:00
|
|
|
function TransactionListRecent(props: Props) {
|
|
|
|
const { transactions, fetchTransactions, myClaims, fetchClaimListMine } = props;
|
2018-11-07 14:35:47 -05:00
|
|
|
|
2020-02-11 17:40:04 -05:00
|
|
|
React.useEffect(() => {
|
2019-11-01 15:17:06 -04:00
|
|
|
fetchTransactions(1, TX_LIST.LATEST_PAGE_SIZE);
|
2020-02-11 17:40:04 -05:00
|
|
|
}, [fetchTransactions]);
|
2017-08-20 17:42:00 -04:00
|
|
|
|
2020-02-11 17:40:04 -05: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 17:42:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export default TransactionListRecent;
|