<commit_before>import React from "react";
import { connect } from "react-redux";
import { Form, FormGroup, ControlLabel, FormControl, Button } from "react-bootstrap";

let teamId = 200;

class AddTeam extends React.Component {
  constructor (props) {
    super(props);
    this.state = {
      team: "",
      title: "Add a New Team"
    };
    this.onInputChange = this.onInputChange.bind(this);
  }

  render () {
    return (
      <div className="row">
        <div className="col-md-8">
          <h3>{this.state.title}</h3>
          <Form>
            <FormGroup controlId="team">
              <FormControl
                type="text"
                name="team"
                placeholder="Enter team name"
                onChange={this.onInputChange}
              />
            </FormGroup>
            <Button onClick={() => {
              // this.props.dispatch({
              //   type: "ADD_TEAM",
              //   team: {
              //     "_id": `${teamId++}team`,
              //     "team": this.state.team
              //   }
              // });

              this.props.dispatch({
                type: "CHANGE_ROUTE",
                route: ""
              });
            }}>Add Team
            </Button>
          </Form>
        </div>
      </div>
    );
  };

  onInputChange (e) {
    const target = e.target;
    const value = target.value;
    const name = target.name;

    this.setState({
      [name]: value
    });
  }
};

AddTeam = connect((state, ownProps) => {
  return {
    name: state.name
  };
})(AddTeam);


export default AddTeam;<commit_msg>feat: Fixing the Add Team form so the user can add teams<commit_after>import React from "react";
import { connect } from "react-redux";
import { Form, FormGroup, ControlLabel, FormControl, Button } from "react-bootstrap";

let teamId = 200;

class AddTeam extends React.Component {
  constructor (props) {
    super(props);
    this.state = {
      team: "",
      title: "Add a New Team"
    };
    this.onInputChange = this.onInputChange.bind(this);
  }

  render () {
    return (
      <div className="row">
        <div className="col-md-8">
          <h3>{this.state.title}</h3>
          <Form>
            <FormGroup controlId="team">
              <FormControl
                type="text"
                name="team"
                placeholder="Enter team name"
                onChange={this.onInputChange}
              />
            </FormGroup>
            <Button onClick={() => {
              this.props.dispatch({
                type: "ADD_TEAM",
                team: {
                  "_id": `${teamId++}team`,
                  "name": this.state.team
                }
              });

              this.props.dispatch({
                type: "CHANGE_ROUTE",
                route: ""
              });
            }}>Add Team
            </Button>
          </Form>
        </div>
      </div>
    );
  };

  onInputChange (e) {
    const target = e.target;
    const value = target.value;
    const name = target.name;

    this.setState({
      [name]: value
    });
  }
};

AddTeam = connect()(AddTeam);


export default AddTeam;
{'fraction_non_alphanumeric': 0.13815997470755612, 'fraction_numerical': 0.0037938665823585203, 'mean_word_length': 1.4546159813809154, 'pattern_counts': {'":': 4, '<': 29, '<?xml version=': 0, '>': 32, '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': '2481149', 'n_tokens_mistral': 920, 'n_tokens_neox': 896, 'n_words': 199}