2016-12-15 16:10:36 +02:00
|
|
|
const React = require('react');
|
|
|
|
const ReactRedux = require('react-redux');
|
2017-01-23 16:00:10 +02:00
|
|
|
const PeopleSection = require('@components/people-list');
|
2017-01-18 19:00:59 +02:00
|
|
|
const selectors = require('@state/selectors');
|
2016-12-20 21:06:02 +02:00
|
|
|
const Section = require('./section');
|
2017-01-23 16:00:10 +02:00
|
|
|
const actions = require('@state/actions');
|
2016-12-15 16:10:36 +02:00
|
|
|
|
|
|
|
const {
|
|
|
|
connect
|
|
|
|
} = ReactRedux;
|
|
|
|
|
2017-01-18 19:00:59 +02:00
|
|
|
const {
|
2017-01-23 16:00:10 +02:00
|
|
|
peopleByOrgIdSelector,
|
2017-01-23 17:47:45 +02:00
|
|
|
orgUISelector,
|
2017-01-25 15:50:27 +02:00
|
|
|
orgIndexSelector,
|
|
|
|
membersSelector,
|
2017-01-18 19:00:59 +02:00
|
|
|
} = selectors;
|
|
|
|
|
2017-01-23 16:00:10 +02:00
|
|
|
const {
|
2017-01-24 12:10:13 +02:00
|
|
|
handleInviteToggle,
|
2017-01-24 15:57:24 +02:00
|
|
|
handlePeopleRoleTooltip,
|
|
|
|
handlePeopleStatusTooltip,
|
2017-01-25 18:37:26 +02:00
|
|
|
handleMemberUpdate,
|
|
|
|
removeMember,
|
2017-01-23 16:00:10 +02:00
|
|
|
} = actions;
|
2016-12-15 16:10:36 +02:00
|
|
|
|
2016-12-20 21:06:02 +02:00
|
|
|
const People = (props) => {
|
2017-01-18 19:00:59 +02:00
|
|
|
|
2016-12-20 21:06:02 +02:00
|
|
|
return (
|
|
|
|
<Section {...props}>
|
2017-01-23 16:00:10 +02:00
|
|
|
<PeopleSection {...props} />
|
2016-12-20 21:06:02 +02:00
|
|
|
</Section>
|
|
|
|
);
|
2016-12-15 16:10:36 +02:00
|
|
|
};
|
|
|
|
|
2017-01-18 19:00:59 +02:00
|
|
|
const mapStateToProps = (state, {
|
|
|
|
params = {}
|
|
|
|
}) => ({
|
2017-01-23 16:00:10 +02:00
|
|
|
people: peopleByOrgIdSelector(params.org)(state),
|
2017-01-23 17:47:45 +02:00
|
|
|
orgUI: orgUISelector(state),
|
2017-01-25 15:50:27 +02:00
|
|
|
orgIndex: orgIndexSelector(params.org)(state),
|
2017-01-23 17:47:45 +02:00
|
|
|
platformMembers: membersSelector(state)
|
2017-01-18 19:00:59 +02:00
|
|
|
});
|
2016-12-15 16:10:36 +02:00
|
|
|
|
2017-01-23 16:00:10 +02:00
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
2017-01-24 12:10:13 +02:00
|
|
|
handleToggle: () => dispatch(handleInviteToggle()),
|
2017-01-24 15:57:24 +02:00
|
|
|
handleStatusTooltip: (id) => dispatch(handlePeopleStatusTooltip(id)),
|
|
|
|
handleRoleTooltip: (id) => dispatch(handlePeopleRoleTooltip(id)),
|
2017-01-25 18:15:06 +02:00
|
|
|
handleMemberUpdate: (updatedMember) =>
|
|
|
|
dispatch(handleMemberUpdate(updatedMember)),
|
2017-01-25 18:37:26 +02:00
|
|
|
removeMember: (removeData) =>
|
|
|
|
dispatch(removeMember(removeData)),
|
2017-01-25 18:15:06 +02:00
|
|
|
|
2017-01-23 16:00:10 +02:00
|
|
|
});
|
2016-12-15 16:10:36 +02:00
|
|
|
|
2017-01-18 19:00:59 +02:00
|
|
|
module.exports = connect(
|
|
|
|
mapStateToProps,
|
|
|
|
mapDispatchToProps
|
|
|
|
)(People);
|