Project managers, board members, auto-update after reconnection, refactoring

This commit is contained in:
Maksim Eltyshev
2021-06-24 01:05:22 +05:00
parent 7956503a46
commit fe91b5241e
478 changed files with 21215 additions and 19484 deletions
+15 -4
View File
@@ -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,