2020-07-23 16:22:57 +02:00
|
|
|
import { connect } from 'react-redux';
|
2022-06-09 16:29:56 +02:00
|
|
|
import { selectNotifications, selectUnseenNotificationCount } from 'redux/selectors/notifications';
|
|
|
|
import {
|
|
|
|
doReadNotifications,
|
|
|
|
doSeeNotifications,
|
|
|
|
doDeleteNotification,
|
|
|
|
doSeeAllNotifications,
|
|
|
|
} from 'redux/actions/notifications';
|
|
|
|
import { selectUser, selectUserVerifiedEmail } from 'redux/selectors/user';
|
2020-07-23 16:22:57 +02:00
|
|
|
import NotificationHeaderButton from './view';
|
|
|
|
|
2021-12-20 13:32:32 +01:00
|
|
|
const select = (state) => ({
|
2022-06-09 16:29:56 +02:00
|
|
|
notifications: selectNotifications(state),
|
2020-12-14 19:52:17 +01:00
|
|
|
unseenCount: selectUnseenNotificationCount(state),
|
2020-07-23 16:22:57 +02:00
|
|
|
user: selectUser(state),
|
2022-06-09 16:29:56 +02:00
|
|
|
authenticated: selectUserVerifiedEmail(state),
|
2020-07-23 16:22:57 +02:00
|
|
|
});
|
|
|
|
|
2022-06-09 16:29:56 +02:00
|
|
|
const perform = (dispatch, ownProps) => ({
|
|
|
|
readNotification: ([id]) => dispatch(doReadNotifications([id])),
|
|
|
|
seeNotification: ([id]) => dispatch(doSeeNotifications([id])),
|
|
|
|
deleteNotification: (id) => dispatch(doDeleteNotification(id)),
|
|
|
|
doSeeAllNotifications: doSeeAllNotifications,
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(select, perform)(NotificationHeaderButton);
|