selectClaimIdIsPending

This commit is contained in:
zeppi 2021-06-23 10:43:17 -04:00
parent 508e8d36fd
commit acb7a3b0d8
3 changed files with 19 additions and 6 deletions

7
dist/bundle.es.js vendored
View file

@ -2418,6 +2418,10 @@ const makeSelectClaimIsPending = uri => reselect.createSelector(selectClaimIdsBy
return false; return false;
}); });
const makeSelectClaimIdIsPending = claimId => reselect.createSelector(selectPendingIds, pendingIds => {
return pendingIds.some(i => i === claimId);
});
const makeSelectClaimIdForUri = uri => reselect.createSelector(selectClaimIdsByUri, claimIds => claimIds[uri]); const makeSelectClaimIdForUri = uri => reselect.createSelector(selectClaimIdsByUri, claimIds => claimIds[uri]);
const selectReflectingById = reselect.createSelector(selectState$1, state => state.reflectingById); const selectReflectingById = reselect.createSelector(selectState$1, state => state.reflectingById);
@ -2632,7 +2636,7 @@ const selectMyClaims = reselect.createSelector(selectMyActiveClaims, selectClaim
return [...claims]; return [...claims];
}); });
const selectMyClaimsWithoutChannels = reselect.createSelector(selectMyClaims, myClaims => myClaims.filter(claim => !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp)); const selectMyClaimsWithoutChannels = reselect.createSelector(selectMyClaims, myClaims => myClaims.filter(claim => claim && !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp));
const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsWithoutChannels, myClaims => { const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsWithoutChannels, myClaims => {
return myClaims.sort((a, b) => { return myClaims.sort((a, b) => {
@ -7927,6 +7931,7 @@ exports.makeSelectClaimForClaimId = makeSelectClaimForClaimId;
exports.makeSelectClaimForUri = makeSelectClaimForUri; exports.makeSelectClaimForUri = makeSelectClaimForUri;
exports.makeSelectClaimHasSource = makeSelectClaimHasSource; exports.makeSelectClaimHasSource = makeSelectClaimHasSource;
exports.makeSelectClaimIdForUri = makeSelectClaimIdForUri; exports.makeSelectClaimIdForUri = makeSelectClaimIdForUri;
exports.makeSelectClaimIdIsPending = makeSelectClaimIdIsPending;
exports.makeSelectClaimIdsForCollectionId = makeSelectClaimIdsForCollectionId; exports.makeSelectClaimIdsForCollectionId = makeSelectClaimIdsForCollectionId;
exports.makeSelectClaimIsMine = makeSelectClaimIsMine; exports.makeSelectClaimIsMine = makeSelectClaimIsMine;
exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw; exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw;

View file

@ -282,6 +282,7 @@ export {
selectUpdateCollectionError, selectUpdateCollectionError,
selectCreatingCollection, selectCreatingCollection,
selectCreateCollectionError, selectCreateCollectionError,
makeSelectClaimIdIsPending,
} from 'redux/selectors/claims'; } from 'redux/selectors/claims';
export { export {

View file

@ -95,6 +95,13 @@ export const makeSelectClaimIsPending = (uri: string) =>
} }
); );
export const makeSelectClaimIdIsPending = (claimId: string) => createSelector(
selectPendingIds,
(pendingIds) => {
return pendingIds.some(i => i === claimId);
}
);
export const makeSelectClaimIdForUri = (uri: string) => export const makeSelectClaimIdForUri = (uri: string) =>
createSelector( createSelector(
selectClaimIdsByUri, selectClaimIdsByUri,
@ -279,8 +286,8 @@ export const makeSelectMyPurchasesForPage = (query: ?string, page: number = 1) =
const end = Number(page) * Number(CLAIM.PAGE_SIZE); const end = Number(page) * Number(CLAIM.PAGE_SIZE);
return matchingFileInfos && matchingFileInfos.length return matchingFileInfos && matchingFileInfos.length
? matchingFileInfos ? matchingFileInfos
.slice(start, end) .slice(start, end)
.map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url) .map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url)
: []; : [];
} }
); );
@ -386,8 +393,8 @@ export const makeSelectDateForUri = (uri: string) =>
(claim.value.release_time (claim.value.release_time
? claim.value.release_time * 1000 ? claim.value.release_time * 1000
: claim.meta && claim.meta.creation_timestamp : claim.meta && claim.meta.creation_timestamp
? claim.meta.creation_timestamp * 1000 ? claim.meta.creation_timestamp * 1000
: null); : null);
if (!timestamp) { if (!timestamp) {
return undefined; return undefined;
} }
@ -493,7 +500,7 @@ export const selectMyClaims = createSelector(
export const selectMyClaimsWithoutChannels = createSelector( export const selectMyClaimsWithoutChannels = createSelector(
selectMyClaims, selectMyClaims,
myClaims => myClaims =>
myClaims.filter(claim => !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp) myClaims.filter(claim => claim && !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp)
); );
export const selectMyClaimUrisWithoutChannels = createSelector( export const selectMyClaimUrisWithoutChannels = createSelector(