lbry-desktop/ui/component/headerNotificationButton/index.js

27 lines
973 B
JavaScript
Raw Normal View History

2020-07-23 16:22:57 +02:00
import { connect } from 'react-redux';
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) => ({
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),
authenticated: selectUserVerifiedEmail(state),
2020-07-23 16:22:57 +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);