2018-04-05 03:57:29 +01:00
|
|
|
import { createSelector } from 'reselect';
|
|
|
|
|
|
|
|
export const selectState = state => state.notifications || {};
|
|
|
|
|
2018-04-19 14:55:37 -04:00
|
|
|
export const selectNotificationData = createSelector(
|
2018-04-05 03:57:29 +01:00
|
|
|
selectState,
|
|
|
|
state => (state.queue.length > 0 ? state.queue[0] : {})
|
|
|
|
);
|
2018-04-19 14:55:37 -04:00
|
|
|
|
|
|
|
export const selectNotification = createSelector(
|
|
|
|
selectNotificationData,
|
|
|
|
notificationData => notificationData.notification
|
|
|
|
);
|
|
|
|
|
|
|
|
export const selectNotificationProps = createSelector(
|
|
|
|
selectNotificationData,
|
|
|
|
notificationData => notificationData.notificationProps
|
|
|
|
);
|
|
|
|
|
|
|
|
export const selectSnack = createSelector(
|
|
|
|
// No props for snackbar
|
|
|
|
selectNotification,
|
|
|
|
notification => {
|
|
|
|
if (notification && notification.displayType) {
|
|
|
|
return notification.displayType.indexOf('snackbar') > -1 ? notification : undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
);
|