lbry-desktop/ui/page/fileListPublished/index.js

40 lines
1.3 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import {
selectIsFetchingClaimListMine,
selectMyClaimsPage,
selectMyClaimsPageItemCount,
selectFetchingMyClaimsPageError,
doClearPublish,
doFetchClaimListMine,
} from 'lbry-redux';
import { selectUploadCount } from 'lbryinc';
2019-07-13 04:59:45 +02:00
import { doCheckPendingPublishesApp } from 'redux/actions/publish';
import FileListPublished from './view';
2019-09-23 19:32:38 +02:00
import { withRouter } from 'react-router';
import { PUBLISHES_PAGE_SIZE, PAGE_PARAM, PAGE_SIZE_PARAM } from 'constants/claim';
2019-09-23 19:32:38 +02:00
const select = (state, props) => {
const { search } = props.location;
const urlParams = new URLSearchParams(search);
const page = Number(urlParams.get(PAGE_PARAM)) || '1';
const pageSize = urlParams.get(PAGE_SIZE_PARAM) || String(PUBLISHES_PAGE_SIZE);
2019-09-23 19:32:38 +02:00
return {
page,
pageSize,
2019-09-23 19:32:38 +02:00
fetching: selectIsFetchingClaimListMine(state),
urls: selectMyClaimsPage(state),
urlTotal: selectMyClaimsPageItemCount(state),
error: selectFetchingMyClaimsPageError(state),
uploadCount: selectUploadCount(state),
2019-09-23 19:32:38 +02:00
};
};
2017-06-06 06:21:55 +02:00
const perform = dispatch => ({
2019-07-13 04:59:45 +02:00
checkPendingPublishes: () => dispatch(doCheckPendingPublishesApp()),
fetchClaimListMine: (page, pageSize) => dispatch(doFetchClaimListMine(page, pageSize)),
clearPublish: () => dispatch(doClearPublish()),
2017-06-06 06:21:55 +02:00
});
export default withRouter(connect(select, perform)(FileListPublished));