From 5aacaf44a3510205164aafee736e959bd8a450b2 Mon Sep 17 00:00:00 2001 From: sundasnoreen12 Date: Fri, 14 Jun 2024 12:17:47 +0500 Subject: [PATCH] refactor: rename selector --- src/notification-preferences/NotificationPreferenceApp.jsx | 4 ++-- src/notification-preferences/NotificationPreferenceColumn.jsx | 4 ++-- src/notification-preferences/NotificationTypes.jsx | 4 ++-- src/notification-preferences/data/selectors.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/notification-preferences/NotificationPreferenceApp.jsx b/src/notification-preferences/NotificationPreferenceApp.jsx index 6a954e7..2d6b9a1 100644 --- a/src/notification-preferences/NotificationPreferenceApp.jsx +++ b/src/notification-preferences/NotificationPreferenceApp.jsx @@ -11,13 +11,13 @@ import { useIsOnMobile } from '../hooks'; import NotificationTypes from './NotificationTypes'; import { notificationChannels, shouldHideAppPreferences } from './data/utils'; import NotificationPreferenceColumn from './NotificationPreferenceColumn'; -import { selectPreferenceAppToggleValue, selectSelectedCourseId, selectPreferencesOfApp } from './data/selectors'; +import { selectPreferenceAppToggleValue, selectSelectedCourseId, selectAppPreferences } from './data/selectors'; const NotificationPreferenceApp = ({ appId }) => { const intl = useIntl(); const courseId = useSelector(selectSelectedCourseId()); const appToggle = useSelector(selectPreferenceAppToggleValue(appId)); - const appPreferences = useSelector(selectPreferencesOfApp(appId)); + const appPreferences = useSelector(selectAppPreferences(appId)); const mobileView = useIsOnMobile(); const NOTIFICATION_CHANNELS = notificationChannels(); const hideAppPreferences = shouldHideAppPreferences(appPreferences, appId) || false; diff --git a/src/notification-preferences/NotificationPreferenceColumn.jsx b/src/notification-preferences/NotificationPreferenceColumn.jsx index 2ed2630..8d27059 100644 --- a/src/notification-preferences/NotificationPreferenceColumn.jsx +++ b/src/notification-preferences/NotificationPreferenceColumn.jsx @@ -14,7 +14,7 @@ import EmailCadences from './EmailCadences'; import { LOADING_STATUS } from '../constants'; import { updateChannelPreferenceToggle, updatePreferenceToggle } from './data/thunks'; import { - selectNonEditablePreferences, selectPreferencesOfApp, selectSelectedCourseId, selectUpdatePreferencesStatus, + selectNonEditablePreferences, selectAppPreferences, selectSelectedCourseId, selectUpdatePreferencesStatus, } from './data/selectors'; import { notificationChannels, shouldHideAppPreferences } from './data/utils'; @@ -22,7 +22,7 @@ const NotificationPreferenceColumn = ({ appId, channel, appPreference }) => { const dispatch = useDispatch(); const intl = useIntl(); const courseId = useSelector(selectSelectedCourseId()); - const appPreferences = useSelector(selectPreferencesOfApp(appId)); + const appPreferences = useSelector(selectAppPreferences(appId)); const nonEditable = useSelector(selectNonEditablePreferences(appId)); const updatePreferencesStatus = useSelector(selectUpdatePreferencesStatus()); const mobileView = useIsOnMobile(); diff --git a/src/notification-preferences/NotificationTypes.jsx b/src/notification-preferences/NotificationTypes.jsx index 7ddd626..0d5fc98 100644 --- a/src/notification-preferences/NotificationTypes.jsx +++ b/src/notification-preferences/NotificationTypes.jsx @@ -11,12 +11,12 @@ import messages from './messages'; import { useIsOnMobile } from '../hooks'; import { notificationChannels } from './data/utils'; -import { selectPreferencesOfApp } from './data/selectors'; +import { selectAppPreferences } from './data/selectors'; import NotificationPreferenceColumn from './NotificationPreferenceColumn'; const NotificationTypes = ({ appId }) => { const intl = useIntl(); - const preferences = useSelector(selectPreferencesOfApp(appId)); + const preferences = useSelector(selectAppPreferences(appId)); const mobileView = useIsOnMobile(); const NOTIFICATION_CHANNELS = notificationChannels(); diff --git a/src/notification-preferences/data/selectors.js b/src/notification-preferences/data/selectors.js index ffbc5d9..f5c5cb8 100644 --- a/src/notification-preferences/data/selectors.js +++ b/src/notification-preferences/data/selectors.js @@ -28,7 +28,7 @@ export const selectPreferenceAppsId = () => state => ( state.notificationPreferences.preferences.apps.map(app => app.id) ); -export const selectPreferencesOfApp = appId => state => ( +export const selectAppPreferences = appId => state => ( selectPreferences()(state).filter(preference => ( preference.appId === appId ))