From d5ffdeaec42470bcdb46d41c2ba7d8f8c5f0e37d Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 4 Nov 2019 13:43:33 -0500 Subject: [PATCH] keep selectRecentTransactions --- dist/bundle.es.js | 13 +++++++++++++ src/index.js | 1 + src/redux/selectors/wallet.js | 15 +++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 3cc1426..d863ca5 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -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; diff --git a/src/index.js b/src/index.js index f197c20..f44c3c6 100644 --- a/src/index.js +++ b/src/index.js @@ -277,6 +277,7 @@ export { selectSupportsByOutpoint, selectTotalSupports, selectTransactionItems, + selectRecentTransactions, selectHasTransactions, selectIsFetchingTransactions, selectIsSendingSupport, diff --git a/src/redux/selectors/wallet.js b/src/redux/selectors/wallet.js index a2c1c0f..950b092 100644 --- a/src/redux/selectors/wallet.js +++ b/src/redux/selectors/wallet.js @@ -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