const isEmpty = require('lodash.isempty'); const React = require('react'); const ReactRedux = require('react-redux'); const ReactRouter = require('react-router-dom'); const NotFound = require('@containers/not-found'); const PropTypes = require('@root/prop-types'); const Redirect = require('@components/redirect'); const selectors = require('@state/selectors'); const NewProject = require('@containers/new-project'); const SectionComponents = { people: require('./people'), projects: require('./projects'), settings: require('./settings'), }; const { connect } = ReactRedux; const { Match, Miss } = ReactRouter; const { orgByIdSelector, orgSectionsSelector } = selectors; const Org = ({ org = {}, sections = [] }) => { if (isEmpty(org)) { return ( ); } const missMatch = !sections.length ? null : ( ); const navMatches = sections.map((name) => ( )); navMatches.push( ); return (
{navMatches} {missMatch}
); }; Org.propTypes = { org: PropTypes.org, sections: PropTypes.sections }; const mapStateToProps = (state, ownProps) => ({ org: orgByIdSelector(ownProps.params.org)(state), sections: orgSectionsSelector(ownProps.params.org)(state) }); module.exports = connect(mapStateToProps)(Org);