From d41a2a8a30428360af6cbe123c9500f4d75814c7 Mon Sep 17 00:00:00 2001 From: jessop Date: Sun, 28 Jul 2019 23:24:31 -0400 Subject: [PATCH] adds blocked channel count --- src/index.js | 2 +- src/redux/reducers/blocked.js | 1 - src/redux/selectors/blocked.js | 7 ++++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 8f03f36..1d28615 100644 --- a/src/index.js +++ b/src/index.js @@ -273,4 +273,4 @@ export { export { selectFollowedTags, selectUnfollowedTags } from 'redux/selectors/tags'; -export { selectBlockedChannels, selectChannelIsBlocked } from 'redux/selectors/blocked'; +export { selectBlockedChannels, selectChannelIsBlocked, selectBlockedChannelsCount } from 'redux/selectors/blocked'; diff --git a/src/redux/reducers/blocked.js b/src/redux/reducers/blocked.js index 92f9200..dc90d01 100644 --- a/src/redux/reducers/blocked.js +++ b/src/redux/reducers/blocked.js @@ -11,7 +11,6 @@ export const blockChannelReducer = handleActions( [ACTIONS.TOGGLE_BLOCK_CHANNEL]: (state: BlocklistState, action: BlocklistAction): BlocklistState => { const { blockedChannels } = state; const { uri } = action.data; - console.log('test', uri) let newBlockedChannels = blockedChannels.slice(); if (newBlockedChannels.includes(uri)) { diff --git a/src/redux/selectors/blocked.js b/src/redux/selectors/blocked.js index 7ab7af5..a5946a8 100644 --- a/src/redux/selectors/blocked.js +++ b/src/redux/selectors/blocked.js @@ -5,7 +5,12 @@ const selectState = (state: { blockedChannels: BlocklistState }) => state.blocke export const selectBlockedChannels = createSelector( selectState, - (state: BlocklistState) => state + (state: BlocklistState) => state.blockedChannels +); + +export const selectBlockedChannelsCount = createSelector( + selectState, + (state: BlocklistState) => state.blockedChannels.length ); export const selectChannelIsBlocked = (uri: string) => createSelector(