Project managers, board members, auto-update after reconnection, refactoring
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { currentUserSelector, notificationsForCurrentUserSelector } from '../selectors';
|
||||
import {
|
||||
currentProjectSelector,
|
||||
currentUserSelector,
|
||||
isCurrentUserManagerForCurrentProjectSelector,
|
||||
notificationsForCurrentUserSelector,
|
||||
} from '../selectors';
|
||||
import {
|
||||
deleteNotification,
|
||||
logout,
|
||||
openProjectSettingsModal,
|
||||
openUserSettingsModal,
|
||||
openUsersModal,
|
||||
} from '../actions/entry';
|
||||
@@ -12,21 +18,26 @@ import Header from '../components/Header';
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
const currentUser = currentUserSelector(state);
|
||||
const currentProject = currentProjectSelector(state);
|
||||
const notifications = notificationsForCurrentUserSelector(state);
|
||||
const isCurrentUserManager = isCurrentUserManagerForCurrentProjectSelector(state);
|
||||
|
||||
return {
|
||||
notifications,
|
||||
project: currentProject,
|
||||
user: currentUser,
|
||||
isEditable: currentUser.isAdmin,
|
||||
canEditProject: isCurrentUserManager,
|
||||
canEditUsers: currentUser.isAdmin,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
bindActionCreators(
|
||||
{
|
||||
onUsers: openUsersModal, // TODO: rename
|
||||
onProjectSettingsClick: openProjectSettingsModal,
|
||||
onUsersClick: openUsersModal,
|
||||
onNotificationDelete: deleteNotification,
|
||||
onUserSettings: openUserSettingsModal,
|
||||
onUserSettingsClick: openUserSettingsModal,
|
||||
onLogout: logout,
|
||||
},
|
||||
dispatch,
|
||||
|
||||
Reference in New Issue
Block a user