Merge pull request #206 from lbryio/paginationHellRebase

Pagination rebase
This commit is contained in:
Sean Yesmunt 2019-09-26 11:18:08 -04:00 committed by GitHub
commit 42bf926138
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 2 deletions

21
dist/bundle.es.js vendored
View file

@ -1517,7 +1517,6 @@ function concatClaims(claimList = [], concatClaimList = []) {
}
//
const selectState$2 = state => state.claims || {};
const selectClaimsById = reselect.createSelector(selectState$2, state => state.byId || {});
@ -1866,6 +1865,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 = '';
@ -2730,6 +2737,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 || {};
@ -5083,6 +5098,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;
@ -5096,6 +5112,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;
@ -5141,6 +5158,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;
@ -5179,6 +5197,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

@ -208,6 +208,8 @@ export {
selectCreatingChannel,
selectCreateChannelError,
selectChannelImportPending,
makeSelectMyStreamUrlsForPage,
selectMyStreamUrlsCount,
} from 'redux/selectors/claims';
export { makeSelectCommentsForUri } from 'redux/selectors/comments';
@ -232,6 +234,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
);