lbry-desktop/ui/component/transactionListRecent/view.jsx

42 lines
1.1 KiB
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
2019-06-17 22:32:38 +02:00
import React from 'react';
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,
fetchClaimListMine: () => void,
2018-03-26 23:32:43 +02:00
fetchingTransactions: boolean,
hasTransactions: boolean,
transactions: Array<Transaction>,
myClaims: ?Array<StreamClaim>,
2018-03-26 23:32:43 +02:00
};
function TransactionListRecent(props: Props) {
const { transactions, fetchTransactions, myClaims, fetchClaimListMine } = props;
React.useEffect(() => {
2019-11-01 20:17:06 +01:00
fetchTransactions(1, TX_LIST.LATEST_PAGE_SIZE);
}, [fetchTransactions]);
2017-08-20 23:42:00 +02: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;