<commit_before>/**
 *
 * UserPage
 *
 */

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Helmet } from 'react-helmet';
import { FormattedMessage } from 'react-intl';
import { createStructuredSelector } from 'reselect';
import { compose } from 'redux';

import RaisedButton from 'material-ui/RaisedButton';
import AddIcon from 'material-ui/svg-icons/content/add';

import Header from 'containers/Header';
import Subheader from 'components/Subheader';
import Notification from 'components/Notification';
import CreateReportDialog from 'components/CreateReportDialog';
import injectSaga from 'utils/injectSaga';
import injectReducer from 'utils/injectReducer';

import { makeSelectUser } from 'containers/Auth/selectors';

import reducer from './reducer';
import saga from './saga';
import messages from './messages';
import {
  makeSelectLoading,
  makeSelectError,
  makeSelectReports,
  makeSelectCreateReportDialog,
} from './selectors';
import {
  fetchRequest,
  createReportRequest,
  openDialog,
  closeDialog,
} from './actions';

export class UserPage extends React.Component { // eslint-disable-line react/prefer-stateless-function
  componentDidMount() {
    if (!this.props.loading) {
      this.props.fetch();
    }
  }

  errorMessage = () => {
    if (!messages[this.props.error]) {
      return this.props.error;
    }

    return <FormattedMessage {...messages[this.props.error]} />;
  }

  render() {
    return (
      <div>
        <Helmet>
          <title>{this.props.user.group}</title>
        </Helmet>

        <Header />

        <Subheader title={this.props.user.group}>
          <RaisedButton
            primary
            icon={<AddIcon />}
            label={<FormattedMessage {...messages.createReport} />}
            onClick={() => this.props.openDialog('createReportDialog')}
          />
        </Subheader>

        {JSON.stringify(this.props.user)}

        {JSON.stringify(this.props.reports)}

        <CreateReportDialog
          open={this.props.createReportDialog}
          cancel={() => this.props.closeDialog('createReportDialog')}
          submit={this.props.createReport}
        />

        <Notification
          watcher={this.props.error}
          message={this.errorMessage()}
        />
      </div>
    );
  }
}<commit_msg>remove user object log from UserPage<commit_after>/**
 *
 * UserPage
 *
 */

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Helmet } from 'react-helmet';
import { FormattedMessage } from 'react-intl';
import { createStructuredSelector } from 'reselect';
import { compose } from 'redux';

import RaisedButton from 'material-ui/RaisedButton';
import AddIcon from 'material-ui/svg-icons/content/add';

import Header from 'containers/Header';
import Subheader from 'components/Subheader';
import Notification from 'components/Notification';
import CreateReportDialog from 'components/CreateReportDialog';
import injectSaga from 'utils/injectSaga';
import injectReducer from 'utils/injectReducer';

import { makeSelectUser } from 'containers/Auth/selectors';

import reducer from './reducer';
import saga from './saga';
import messages from './messages';
import {
  makeSelectLoading,
  makeSelectError,
  makeSelectReports,
  makeSelectCreateReportDialog,
} from './selectors';
import {
  fetchRequest,
  createReportRequest,
  openDialog,
  closeDialog,
} from './actions';

export class UserPage extends React.Component { // eslint-disable-line react/prefer-stateless-function
  componentDidMount() {
    if (!this.props.loading) {
      this.props.fetch();
    }
  }

  errorMessage = () => {
    if (!messages[this.props.error]) {
      return this.props.error;
    }

    return <FormattedMessage {...messages[this.props.error]} />;
  }

  render() {
    return (
      <div>
        <Helmet>
          <title>{this.props.user.group}</title>
        </Helmet>

        <Header />

        <Subheader title={this.props.user.group}>
          <RaisedButton
            primary
            icon={<AddIcon />}
            label={<FormattedMessage {...messages.createReport} />}
            onClick={() => this.props.openDialog('createReportDialog')}
          />
        </Subheader>

        {JSON.stringify(this.props.reports)}

        <CreateReportDialog
          open={this.props.createReportDialog}
          cancel={() => this.props.closeDialog('createReportDialog')}
          submit={this.props.createReport}
        />

        <Notification
          watcher={this.props.error}
          message={this.errorMessage()}
        />
      </div>
    );
  }
}
{'fraction_non_alphanumeric': 0.13286264441591783, 'fraction_numerical': 0.0, 'mean_word_length': 2.9855072463768115, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 39, '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': '6416031', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1328, 'n_words': 282}