2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2019-10-17 00:03:11 +02:00
|
|
|
import {
|
|
|
|
selectIsFetchingClaimListMine,
|
2020-04-24 15:51:00 +02:00
|
|
|
selectMyClaimsPage,
|
|
|
|
selectMyClaimsPageItemCount,
|
|
|
|
selectFetchingMyClaimsPageError,
|
2021-10-17 10:36:14 +02:00
|
|
|
} from 'redux/selectors/claims';
|
|
|
|
import { doFetchClaimListMine, doCheckPendingClaims } from 'redux/actions/claims';
|
|
|
|
import { doClearPublish } from 'redux/actions/publish';
|
2020-04-24 15:51:00 +02:00
|
|
|
import { selectUploadCount } from 'lbryinc';
|
2017-12-21 22:08:54 +01:00
|
|
|
import FileListPublished from './view';
|
2019-09-23 19:32:38 +02:00
|
|
|
import { withRouter } from 'react-router';
|
2020-05-11 17:54:39 +02:00
|
|
|
import { MY_CLAIMS_PAGE_SIZE, PAGE_PARAM, PAGE_SIZE_PARAM } from 'constants/claim';
|
2017-04-23 18:10:45 +02:00
|
|
|
|
2019-09-23 19:32:38 +02:00
|
|
|
const select = (state, props) => {
|
|
|
|
const { search } = props.location;
|
|
|
|
const urlParams = new URLSearchParams(search);
|
2020-04-24 15:51:00 +02:00
|
|
|
const page = Number(urlParams.get(PAGE_PARAM)) || '1';
|
2020-05-11 17:54:39 +02:00
|
|
|
const pageSize = urlParams.get(PAGE_SIZE_PARAM) || String(MY_CLAIMS_PAGE_SIZE);
|
2020-04-24 15:51:00 +02:00
|
|
|
|
2019-09-23 19:32:38 +02:00
|
|
|
return {
|
|
|
|
page,
|
2020-04-24 15:51:00 +02:00
|
|
|
pageSize,
|
2019-09-23 19:32:38 +02:00
|
|
|
fetching: selectIsFetchingClaimListMine(state),
|
2020-04-24 15:51:00 +02:00
|
|
|
urls: selectMyClaimsPage(state),
|
|
|
|
urlTotal: selectMyClaimsPageItemCount(state),
|
|
|
|
error: selectFetchingMyClaimsPageError(state),
|
|
|
|
uploadCount: selectUploadCount(state),
|
2019-09-23 19:32:38 +02:00
|
|
|
};
|
|
|
|
};
|
2017-05-01 06:51:19 +02:00
|
|
|
|
2021-03-15 10:59:48 +01:00
|
|
|
const perform = (dispatch) => ({
|
2020-07-23 16:22:57 +02:00
|
|
|
checkPendingPublishes: () => dispatch(doCheckPendingClaims()),
|
2021-03-15 10:59:48 +01:00
|
|
|
fetchClaimListMine: (page, pageSize, resolve, filterBy) =>
|
|
|
|
dispatch(doFetchClaimListMine(page, pageSize, resolve, filterBy)),
|
2020-01-08 06:29:01 +01:00
|
|
|
clearPublish: () => dispatch(doClearPublish()),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-05-01 06:51:19 +02:00
|
|
|
|
2020-04-24 15:51:00 +02:00
|
|
|
export default withRouter(connect(select, perform)(FileListPublished));
|