<commit_before>import PropTypes from 'prop-types';
import React, { Component } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import Item from './Item';
import styles from './styles.scss';
import AddUsers from '../Header/addUsersComponent';

class NavBar extends Component {
  static contextTypes = {
    isAuthenticated: PropTypes.bool.isRequired,
  };
  render() {
    const { isAuthenticated } = this.context;
    if (!isAuthenticated) return null;

    return (
      <div className={styles.navbar}>
        <div className={styles.navbar__title}>
          <i className={`${styles.navbar__title_btn} fa fa-bars`} />
          <span className={styles.navbar__title_text}>Project</span>
        </div>
        <ul className={styles.navbar__list}>
          <Item text="Users" icon="users">
            <AddUsers />
          </Item>
          <Item text="Settings" icon="cog" link="/settings" />
        </ul>
      </div>
    );
  }
}

export default withStyles(styles)(NavBar);<commit_msg>hide sidebar if user cannot edit estiamte<commit_after>import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import React, { Component } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import Item from './Item';
import styles from './styles.scss';
import AddUsers from '../Header/addUsersComponent';
import {
  ESTIMATE_FORM,
} from '../../constants';

class NavBar extends Component {
  render() {
    const { userCanEditThisEstimate } = this.props;
    if (!userCanEditThisEstimate) return null;

    return (
      <div className={styles.navbar}>
        <div className={styles.navbar__title}>
          <i className={`${styles.navbar__title_btn} fa fa-bars`} />
          <span className={styles.navbar__title_text}>Project</span>
        </div>
        <ul className={styles.navbar__list}>
          <Item text="Users" icon="users">
            <AddUsers />
          </Item>
          <Item text="Settings" icon="cog" link="/settings" />
        </ul>
      </div>
    );
  }
}

NavBar.propTypes = {
  userCanEditThisEstimate: PropTypes.bool.isRequired,
};

function mapStateToProps({ form }) {
  const { userCanEditThisEstimate } = form[ESTIMATE_FORM].values;
  return { userCanEditThisEstimate };
}


export default connect(mapStateToProps)(
  withStyles(styles)(NavBar),
);
{'fraction_non_alphanumeric': 0.13988978380669775, 'fraction_numerical': 0.0, 'mean_word_length': 3.229390681003584, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3720955', 'n_tokens_mistral': 701, 'n_tokens_neox': 694, 'n_words': 160}