2017-02-20 18:15:36 +02:00
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import PeopleSection from '@components/people-list';
|
|
|
|
import Section from './section';
|
2016-12-15 16:10:36 +02:00
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
import {
|
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,
|
2017-02-20 16:51:54 +02:00
|
|
|
membersSelector
|
2017-02-20 18:15:36 +02:00
|
|
|
} from '@state/selectors';
|
2017-01-18 19:00:59 +02:00
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
import {
|
2017-01-31 13:34:15 +02:00
|
|
|
addMemberToOrg,
|
2017-01-30 16:15:13 +02:00
|
|
|
orgHandleInviteToggle,
|
|
|
|
orgHandlePeopleRoleTooltip,
|
|
|
|
orgHandlePeopleStatusTooltip,
|
|
|
|
orgHandleMemberUpdate,
|
2017-02-20 16:51:54 +02:00
|
|
|
orgRemoveMember
|
2017-02-20 18:15:36 +02:00
|
|
|
} from '@state/actions';
|
2017-01-18 19:00:59 +02:00
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
const People = (props) => (
|
|
|
|
<Section {...props}>
|
|
|
|
<PeopleSection {...props} />
|
|
|
|
</Section>
|
|
|
|
);
|
2016-12-15 16:10:36 +02:00
|
|
|
|
2017-01-18 19:00:59 +02:00
|
|
|
const mapStateToProps = (state, {
|
2017-02-07 11:55:18 +02:00
|
|
|
match = {
|
|
|
|
params: {}
|
|
|
|
}
|
2017-01-18 19:00:59 +02:00
|
|
|
}) => ({
|
2017-02-06 20:27:10 +02:00
|
|
|
people: peopleByOrgIdSelector(match.params.org)(state),
|
2017-01-26 16:34:06 +02:00
|
|
|
UI: orgUISelector(state),
|
2017-02-06 20:27:10 +02:00
|
|
|
parentIndex: orgIndexSelector(match.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-31 13:50:37 +02:00
|
|
|
addMemember: (member, callback) =>
|
|
|
|
dispatch(addMemberToOrg(member, callback)),
|
2017-02-20 18:15:36 +02:00
|
|
|
handleToggle: () =>
|
|
|
|
dispatch(orgHandleInviteToggle()),
|
|
|
|
handleStatusTooltip: (id) =>
|
|
|
|
dispatch(orgHandlePeopleStatusTooltip(id)),
|
|
|
|
handleRoleTooltip: (id) =>
|
|
|
|
dispatch(orgHandlePeopleRoleTooltip(id)),
|
2017-01-25 18:15:06 +02:00
|
|
|
handleMemberUpdate: (updatedMember) =>
|
2017-02-20 18:15:36 +02:00
|
|
|
dispatch(orgHandleMemberUpdate(updatedMember)),
|
2017-01-25 18:37:26 +02:00
|
|
|
removeMember: (removeData) =>
|
2017-02-20 18:15:36 +02:00
|
|
|
dispatch(orgRemoveMember(removeData))
|
2017-01-23 16:00:10 +02:00
|
|
|
});
|
2016-12-15 16:10:36 +02:00
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
export default connect(
|
2017-01-18 19:00:59 +02:00
|
|
|
mapStateToProps,
|
|
|
|
mapDispatchToProps
|
|
|
|
)(People);
|