keep selectRecentTransactions

This commit is contained in:
Sean Yesmunt 2019-11-04 13:43:33 -05:00
parent 861880a029
commit d5ffdeaec4
3 changed files with 29 additions and 0 deletions

13
dist/bundle.es.js vendored
View file

@ -1667,6 +1667,18 @@ const selectTransactionItems = reselect.createSelector(selectTransactionsById, b
});
});
const selectRecentTransactions = reselect.createSelector(selectTransactionItems, transactions => {
const threshold = new Date();
threshold.setDate(threshold.getDate() - 7);
return transactions.filter(transaction => {
if (!transaction.date) {
return true; // pending transaction
}
return transaction.date > threshold;
});
});
const selectHasTransactions = reselect.createSelector(selectTransactionItems, transactions => transactions && transactions.length > 0);
const selectIsFetchingTransactions = reselect.createSelector(selectState$1, state => state.fetchingTransactions);
@ -5536,6 +5548,7 @@ exports.selectPublishFormValues = selectPublishFormValues;
exports.selectPurchaseUriErrorMessage = selectPurchaseUriErrorMessage;
exports.selectPurchasedUris = selectPurchasedUris;
exports.selectReceiveAddress = selectReceiveAddress;
exports.selectRecentTransactions = selectRecentTransactions;
exports.selectReservedBalance = selectReservedBalance;
exports.selectResolvingUris = selectResolvingUris;
exports.selectSearchBarFocused = selectSearchBarFocused;

View file

@ -277,6 +277,7 @@ export {
selectSupportsByOutpoint,
selectTotalSupports,
selectTransactionItems,
selectRecentTransactions,
selectHasTransactions,
selectIsFetchingTransactions,
selectIsSendingSupport,

View file

@ -215,6 +215,21 @@ export const selectTransactionItems = createSelector(
}
);
export const selectRecentTransactions = createSelector(
selectTransactionItems,
transactions => {
const threshold = new Date();
threshold.setDate(threshold.getDate() - 7);
return transactions.filter(transaction => {
if (!transaction.date) {
return true; // pending transaction
}
return transaction.date > threshold;
});
}
);
export const selectHasTransactions = createSelector(
selectTransactionItems,
transactions => transactions && transactions.length > 0