<commit_before>// npm packages
import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import {Card, RaisedButton, TextField} from 'material-ui';

// our packages
import {createClassAction} from '../../store/actions';

const mapDispatchToProps = dispatch => ({
  onCreateClick: params => dispatch(createClassAction(params)),
});

const CreateClassroom = ({onCreateClick}) => {
  let nameInput;
  let descriptionInput;

  const handleClick = (e) => {
    e.preventDefault();
    onCreateClick({
      name: nameInput.getValue(),
      description: descriptionInput.getValue(),
    });
  };

  return (
    <div className="animated fadeIn">
      <Card className="containerPaper">
        <p>{'Create new Klayas classroom'}</p>
        <form>
          <div className="row">
            <div className="col-xs-12">
              <TextField
                hintText="Classroom name"
                floatingLabelText="Classroom name"
                ref={(i) => { nameInput = i; }}
              />
            </div>
            <div className="col-xs-12">
              <TextField
                hintText="Describe your classroom"
                floatingLabelText="Description"
                ref={(i) => { descriptionInput = i; }}
              />
            </div>
          </div>
          <div className="row marTop1_5em">
            <div className="col-xs-10 col-xs-offset-1 col-sm-4 col-sm-offset-4">
              <RaisedButton label="Create" primary onTouchTap={handleClick} fullWidth />
            </div>
          </div>
        </form>
      </Card>
    </div>
  );
};

CreateClassroom.propTypes = {
  onCreateClick: PropTypes.func,
};

export default connect(null, mapDispatchToProps)(CreateClassroom);
<commit_msg>Nav to home after create a classroom<commit_after>// npm packages
import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import {Card, RaisedButton, TextField} from 'material-ui';
import {push} from 'react-router-redux';

// our packages
import {createClassAction} from '../../store/actions';

const mapDispatchToProps = dispatch => ({
  onCreateClick: params => dispatch(createClassAction(params)),
  navToHome: () => dispatch(push('/')),
});

const CreateClassroom = ({onCreateClick, navToHome}) => {
  let nameInput;
  let descriptionInput;

  const handleClick = (e) => {
    e.preventDefault();
    onCreateClick({
      name: nameInput.getValue(),
      description: descriptionInput.getValue(),
    });
    setImmediate(() => navToHome());
  };

  return (
    <div className="animated fadeIn">
      <Card className="containerPaper">
        <p>{'Create new Klayas classroom'}</p>
        <form>
          <div className="row">
            <div className="col-xs-12">
              <TextField
                hintText="Classroom name"
                floatingLabelText="Classroom name"
                ref={(i) => { nameInput = i; }}
              />
            </div>
            <div className="col-xs-12">
              <TextField
                hintText="Describe your classroom"
                floatingLabelText="Description"
                ref={(i) => { descriptionInput = i; }}
              />
            </div>
          </div>
          <div className="row marTop1_5em">
            <div className="col-xs-10 col-xs-offset-1 col-sm-4 col-sm-offset-4">
              <RaisedButton label="Create" primary onTouchTap={handleClick} fullWidth />
            </div>
          </div>
        </form>
      </Card>
    </div>
  );
};

CreateClassroom.propTypes = {
  onCreateClick: PropTypes.func,
  navToHome: PropTypes.func,
};

export default connect(null, mapDispatchToProps)(CreateClassroom);

{'fraction_non_alphanumeric': 0.1412306858227162, 'fraction_numerical': 0.005963675792897805, 'mean_word_length': 2.251101321585903, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 59, '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': '4029669', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1036, 'n_words': 231}