MetaPhase-Consulting/State-TalentMAP

View on GitHub
src/Containers/Post/Post.jsx

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { Component } from 'react';
import { connect } from 'react-redux';
import { includes } from 'lodash';
import { USER_PROFILE } from 'Constants/PropTypes';
import { DEFAULT_USER_PROFILE } from 'Constants/DefaultProps';
import PostPage from '../../Components/PostPage';

class PostContainer extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  getIsPost() {
    return includes(this.props.userProfile.permission_groups, 'post_user');
  }

  render() {
    return (
      <PostPage isPost={this.getIsPost()} />
    );
  }
}

PostContainer.propTypes = {
  userProfile: USER_PROFILE,
};

PostContainer.defaultProps = {
  userProfile: DEFAULT_USER_PROFILE,
};

const mapStateToProps = (state) => ({
  userProfile: state.userProfile,
});

export default connect(mapStateToProps, null)(PostContainer);