2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
2020-05-11 11:54:39 -04:00
|
|
|
import {
|
|
|
|
makeSelectSearchDownloadUrlsForPage,
|
|
|
|
selectDownloadUrlsCount,
|
|
|
|
selectIsFetchingFileList,
|
|
|
|
makeSelectMyPurchasesForPage,
|
|
|
|
selectIsFetchingMyPurchases,
|
|
|
|
selectMyPurchasesCount,
|
|
|
|
} from 'lbry-redux';
|
2017-12-21 18:08:54 -03:00
|
|
|
import FileListDownloaded from './view';
|
2019-09-23 13:32:38 -04:00
|
|
|
import { withRouter } from 'react-router';
|
2017-04-23 23:10:45 +07:00
|
|
|
|
2019-09-23 13:32:38 -04:00
|
|
|
const select = (state, props) => {
|
2020-05-11 11:54:39 -04:00
|
|
|
const { history, location } = props;
|
2019-10-03 17:20:55 -04:00
|
|
|
const { search } = location;
|
2019-09-23 13:32:38 -04:00
|
|
|
const urlParams = new URLSearchParams(search);
|
2019-10-03 17:20:55 -04:00
|
|
|
const query = urlParams.get('query') || '';
|
2019-09-25 17:17:23 -04:00
|
|
|
const page = Number(urlParams.get('page')) || 1;
|
2019-09-23 13:32:38 -04:00
|
|
|
return {
|
|
|
|
page,
|
2019-10-03 17:20:55 -04:00
|
|
|
history,
|
|
|
|
query,
|
2020-05-11 11:54:39 -04:00
|
|
|
downloadedUrlsCount: selectDownloadUrlsCount(state),
|
|
|
|
myPurchasesCount: selectMyPurchasesCount(state),
|
|
|
|
myPurchases: makeSelectMyPurchasesForPage(query, page)(state),
|
|
|
|
myDownloads: makeSelectSearchDownloadUrlsForPage(query, page)(state),
|
|
|
|
fetchingFileList: selectIsFetchingFileList(state),
|
|
|
|
fetchingMyPurchases: selectIsFetchingMyPurchases(state),
|
2019-09-23 13:32:38 -04:00
|
|
|
};
|
|
|
|
};
|
2017-04-23 23:10:45 +07:00
|
|
|
|
2020-05-21 11:38:28 -04:00
|
|
|
export default withRouter(connect(select)(FileListDownloaded));
|