Pagination rebase #206

Merged
jessopb merged 3 commits from paginationHellRebase into master 2019-09-26 17:18:09 +02:00
4 changed files with 60 additions and 2 deletions

21
dist/bundle.es.js vendored
View file

@ -1494,7 +1494,6 @@ function concatClaims(claimList = [], concatClaimList = []) {
}
//
const selectState$2 = state => state.claims || {};
const selectClaimsById = reselect.createSelector(selectState$2, state => state.byId || {});
@ -1843,6 +1842,14 @@ const selectUpdatingChannel = reselect.createSelector(selectState$2, state => st
const selectUpdateChannelError = reselect.createSelector(selectState$2, state => state.updateChannelError);
const makeSelectMyStreamUrlsForPage = (page = 1) => reselect.createSelector(selectMyClaimUrisWithoutChannels, urls => {
const start = (Number(page) - 1) * Number(PAGE_SIZE);
const end = Number(page) * Number(PAGE_SIZE);
return urls && urls.length ? urls.slice(start, end) : [];
});
const selectMyStreamUrlsCount = reselect.createSelector(selectMyClaimUrisWithoutChannels, channels => channels.length);
function formatCredits(amount, precision, shortFormat = false) {
let actualAmount = parseFloat(amount),
suffix = '';
@ -2707,6 +2714,14 @@ const makeSelectFileNameForUri = uri => reselect.createSelector(makeSelectFileIn
return fileInfo && fileInfo.file_name;
});
const makeSelectDownloadUrlsForPage = (page = 1) => reselect.createSelector(selectDownloadedUris, urls => {
const start = (Number(page) - 1) * Number(PAGE_SIZE);
const end = Number(page) * Number(PAGE_SIZE);
return urls && urls.length ? urls.slice(start, end) : [];
});
const selectDownloadUrlsCount = reselect.createSelector(selectDownloadedUris, uris => uris.length);
//
const selectState$4 = state => state.file || {};
@ -5059,6 +5074,7 @@ exports.makeSelectContentTypeForUri = makeSelectContentTypeForUri;
exports.makeSelectCoverForUri = makeSelectCoverForUri;
exports.makeSelectDateForUri = makeSelectDateForUri;
exports.makeSelectDownloadPathForUri = makeSelectDownloadPathForUri;
exports.makeSelectDownloadUrlsForPage = makeSelectDownloadUrlsForPage;
exports.makeSelectDownloadingForUri = makeSelectDownloadingForUri;
exports.makeSelectFetchingChannelClaims = makeSelectFetchingChannelClaims;
exports.makeSelectFileInfoForUri = makeSelectFileInfoForUri;
@ -5071,6 +5087,7 @@ exports.makeSelectLoadingForUri = makeSelectLoadingForUri;
exports.makeSelectMediaTypeForUri = makeSelectMediaTypeForUri;
exports.makeSelectMetadataForUri = makeSelectMetadataForUri;
exports.makeSelectMetadataItemForUri = makeSelectMetadataItemForUri;
exports.makeSelectMyStreamUrlsForPage = makeSelectMyStreamUrlsForPage;
exports.makeSelectNsfwCountForChannel = makeSelectNsfwCountForChannel;
exports.makeSelectNsfwCountFromUris = makeSelectNsfwCountFromUris;
exports.makeSelectPendingByUri = makeSelectPendingByUri;
@ -5116,6 +5133,7 @@ exports.selectClaimsByUri = selectClaimsByUri;
exports.selectCreateChannelError = selectCreateChannelError;
exports.selectCreatingChannel = selectCreatingChannel;
exports.selectCurrentChannelPage = selectCurrentChannelPage;
exports.selectDownloadUrlsCount = selectDownloadUrlsCount;
exports.selectDownloadedUris = selectDownloadedUris;
exports.selectDownloadingByOutpoint = selectDownloadingByOutpoint;
exports.selectDownloadingFileInfos = selectDownloadingFileInfos;
@ -5152,6 +5170,7 @@ exports.selectMyClaims = selectMyClaims;
exports.selectMyClaimsOutpoints = selectMyClaimsOutpoints;
exports.selectMyClaimsRaw = selectMyClaimsRaw;
exports.selectMyClaimsWithoutChannels = selectMyClaimsWithoutChannels;
exports.selectMyStreamUrlsCount = selectMyStreamUrlsCount;
exports.selectPendingById = selectPendingById;
exports.selectPendingClaims = selectPendingClaims;
exports.selectPlayingUri = selectPlayingUri;

View file

@ -206,6 +206,8 @@ export {
selectCreatingChannel,
selectCreateChannelError,
selectChannelImportPending,
makeSelectMyStreamUrlsForPage,
selectMyStreamUrlsCount,
} from 'redux/selectors/claims';
export { makeSelectCommentsForUri } from 'redux/selectors/comments';
@ -230,6 +232,8 @@ export {
makeSelectDownloadPathForUri,
makeSelectFileNameForUri,
makeSelectFilePartlyDownloaded,
makeSelectDownloadUrlsForPage,
selectDownloadUrlsCount,
} from 'redux/selectors/file_info';
export {

View file

@ -5,7 +5,7 @@ import { selectSupportsByOutpoint } from 'redux/selectors/wallet';
import { createSelector } from 'reselect';
import { isClaimNsfw, createNormalizedClaimSearchKey } from 'util/claim';
import { getSearchQueryString } from 'util/query-params';
import { PAGE_SIZE } from 'constants/claim';
const selectState = state => state.claims || {};
export const selectClaimsById = createSelector(
@ -591,3 +591,20 @@ export const selectUpdateChannelError = createSelector(
selectState,
state => state.updateChannelError
);
export const makeSelectMyStreamUrlsForPage = (page: number = 1) =>
createSelector(
selectMyClaimUrisWithoutChannels,
urls => {
const start = ((Number(page) - 1) * Number(PAGE_SIZE));
const end = (Number(page) * Number(PAGE_SIZE));
return (urls && urls.length)
? urls.slice(start, end)
: [];
}
);
export const selectMyStreamUrlsCount = createSelector(
selectMyClaimUrisWithoutChannels,
channels => channels.length
);

View file

@ -9,6 +9,7 @@ import {
import { createSelector } from 'reselect';
import { buildURI } from 'lbryURI';
import Lbry from 'lbry';
import { PAGE_SIZE } from 'constants/claim';
export const selectState = state => state.fileInfo || {};
@ -202,3 +203,20 @@ export const makeSelectFileNameForUri = uri =>
return fileInfo && fileInfo.file_name;
}
);
export const makeSelectDownloadUrlsForPage = (page = 1) =>
createSelector(
selectDownloadedUris,
urls => {
const start = ((Number(page) - 1) * Number(PAGE_SIZE));
const end = (Number(page) * Number(PAGE_SIZE));
return (urls && urls.length)
? urls.slice(start, end)
: [];
}
);
export const selectDownloadUrlsCount = createSelector(
selectDownloadedUris,
uris => uris.length
);