You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
planka_custom/client/src/containers/HeaderContainer.js

38 lines
1.2 KiB
JavaScript

import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import Header from '../components/Header';
const mapStateToProps = (state) => {
const isLogouting = selectors.selectIsLogouting(state);
const currentUser = selectors.selectCurrentUser(state);
const currentProject = selectors.selectCurrentProject(state);
const notifications = selectors.selectNotificationsForCurrentUser(state);
const isCurrentUserManager = selectors.selectIsCurrentUserManagerForCurrentProject(state);
return {
notifications,
isLogouting,
project: currentProject,
user: currentUser,
canEditProject: isCurrentUserManager,
canEditUsers: currentUser.isAdmin,
};
};
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onProjectSettingsClick: entryActions.openProjectSettingsModal,
onUsersClick: entryActions.openUsersModal,
onNotificationDelete: entryActions.deleteNotification,
onUserSettingsClick: entryActions.openUserSettingsModal,
onLogout: entryActions.logout,
},
dispatch,
);
export default connect(mapStateToProps, mapDispatchToProps)(Header);