<commit_before>import React from 'react';
import {
  FormGroup,
  ControlLabel,
  FormControl,
  Button,
  ButtonGroup,
  Row,
  Col,
  Checkbox
} from 'react-bootstrap';

export default class BecomeParticipant extends React.Component {

  constructor(props) {
    super(props);
    this.state = {};
  }

  handleChange(event) {

    const target = event.target;
    var value = '';

    if(target.type === "select-one"){
      value = target.options[target.selectedIndex].text;
    }
    else if( target.type === 'checkbox'){
      value =  target.checked;
    }
    else {
      value =  target.value;
    }

    const id = target.id;

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

  selectGender(event) {
    const target = event.target;
    const id = target.id;
    this.setState({
      gender: id
    });
  }

  getStyleForGender(gender) {
    if (this.state.gender === gender) {
      return 'btn-primary';
    } else {
      return '';
    }
  }

  render() {
    return (
      <div>
        <form>

          <Row style={{textAlign: 'center'}}>
            <Col sm={12}>
              <ButtonGroup>
                <Button id="male"
                        onClick={this.selectGender.bind(this)}
                        className={this.getStyleForGender('male')}>
                  Männlich
                </Button>
                <Button id="female"
                        onClick={this.selectGender.bind(this)}
                        className={this.getStyleForGender('female')}>
                  Weiblich
                </Button>
              </ButtonGroup>
            </Col>
          </Row>

          <FormGroup controlId="firstname" validationState={'error'}>
            <ControlLabel>
              Vorname
            </ControlLabel>
            <FormControl type="text"
                         value={this.state.firstname || ''}
                         placeholder="Gib deinen Vornamen ein"
                         onChange={this.handleChange.bind(this)}/>
          </FormGroup>

          <FormGroup controlId="lastname" validationState={'error'}>
            <ControlLabel>
              Nachname
            </ControlLabel>
            <FormControl type="text"
                         value={this.state.lastname || ''}
                         placeholder="Gib deinen Nachnamen ein"
                         onChange={this.handleChange.bind(this)}/>
          </FormGroup>

          <FormGroup controlId="tshirtSize" validationState={'error'}>
            <ControlLabel>
              T-Shirt Größe
            </ControlLabel>
            <FormControl componentClass="select"
                         placeholder="Wähle eine Tshirtgröße aus"
                        onChange={this.handleChange.bind(this)}>
              <option value="s">S</option>
              <option value="m">M</option>
              <option value="l">L</option>
              <option value="xl">XL</option>
            </FormControl>
          </FormGroup>

          <FormGroup controlId="contactNumber" validationState={'error'}>
            <ControlLabel>
              Handynummer
            </ControlLabel>
            <FormControl type="text"
                         value={this.state.contactNumber || ''}
                         placeholder="Eine Handynummer, unter der wir dich während des Events erreichen können"
                         onChange={this.handleChange.bind(this)}/>
          </FormGroup>

          <FormGroup controlId="emergencyNumber" validationState={'error'}>
            <ControlLabel>
              Notfallnummer
            </ControlLabel>
            <FormControl type="text"
                         value={this.state.emergencyNumber || ''}
                         placeholder="Telefonnummer eines Notfallkontakts"
                         onChange={this.handleChange.bind(this)}/>
          </FormGroup>

          <FormGroup>

            <Checkbox id="acceptsTos"
                      onChange={this.handleChange.bind(this)}>
              Hiermit akzeptiere ich die Teilnahmebedingungen
            </Checkbox>

            <Checkbox id="acceptsCodeOfHonour"
                      onChange={this.handleChange.bind(this)}>
              Hiermit akzeptiere ich den Code of Honour
            </Checkbox>

            <Checkbox id="is18"
                      checked={this.state.is18 || false}
                      onChange={this.handleChange.bind(this)}>
              Ich bin mindestens 18 Jahre alt
            </Checkbox>

          </FormGroup>

          <Row>
            <Col xs={12} style={{textAlign: 'center'}}>
              <Button bsStyle="primary">
                Nächster Schritt
              </Button>
            </Col>
          </Row>
        </form>
      </div>
    );
  }
}
<commit_msg>preparing user data for take off<commit_after>import React from 'react';
import {
  FormGroup,
  ControlLabel,
  FormControl,
  Button,
  ButtonGroup,
  Row,
  Col,
  Checkbox
} from 'react-bootstrap';

export default class BecomeParticipant extends React.Component {

  constructor(props) {
    super(props);
    this.state = {};
  }

  handleChange(event) {

    const target = event.target;
    var value = '';

    if(target.type === "select-one"){
      value = target.options[target.selectedIndex].text;
    }
    else if( target.type === 'checkbox'){
      value =  target.checked;
    }
    else {
      value =  target.value;
    }

    const id = target.id;

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

  selectGender(event) {
    const target = event.target;
    const id = target.id;
    this.setState({
      gender: id
    });
  }

  getStyleForGender(gender) {
    if (this.state.gender === gender) {
      return 'btn-primary';
    } else {
      return '';
    }
  }

  register() {
    const userData = {
      firstname: this.state.firstname,
      lastname: this.state.lastname,
      tshirtSize: this.state.tshirtSize,
      contactNumber: this.state.contactNumber,
      emergencyNumber: this.state.emergencyNumber
    };

    var fakePromise = new Promise((resolve, reject) => {
    setTimeout(() => {
        resolve();
    }, 200);
    });;

    fakePromise
      .then(() => {
        // this.props.nextStep();
        this.setState({
          registrationError: false,
          registrationSuccess: true
        });
      })
      .catch((err) => this.setState({registrationError: err}));
  }

  render() {
    return (
      <div>
        <form>

          <Row style={{textAlign: 'center'}}>
            <Col sm={12}>
              <ButtonGroup>
                <Button id="male"
                        onClick={this.selectGender.bind(this)}
                        className={this.getStyleForGender('male')}>
                  Männlich
                </Button>
                <Button id="female"
                        onClick={this.selectGender.bind(this)}
                        className={this.getStyleForGender('female')}>
                  Weiblich
                </Button>
              </ButtonGroup>
            </Col>
          </Row>

          <FormGroup controlId="firstname" validationState={'error'}>
            <ControlLabel>
              Vorname
            </ControlLabel>
            <FormControl type="text"
                         value={this.state.firstname || ''}
                         placeholder="Gib deinen Vornamen ein"
                         onChange={this.handleChange.bind(this)}/>
          </FormGroup>

          <FormGroup controlId="lastname" validationState={'error'}>
            <ControlLabel>
              Nachname
            </ControlLabel>
            <FormControl type="text"
                         value={this.state.lastname || ''}
                         placeholder="Gib deinen Nachnamen ein"
                         onChange={this.handleChange.bind(this)}/>
          </FormGroup>

          <FormGroup controlId="tshirtSize" validationState={'error'}>
            <ControlLabel>
              T-Shirt Größe
            </ControlLabel>
            <FormControl componentClass="select"
                         placeholder="Wähle eine Tshirtgröße aus"
                        onChange={this.handleChange.bind(this)}>
              <option value="s">S</option>
              <option value="m">M</option>
              <option value="l">L</option>
              <option value="xl">XL</option>
            </FormControl>
          </FormGroup>

          <FormGroup controlId="contactNumber" validationState={'error'}>
            <ControlLabel>
              Handynummer
            </ControlLabel>
            <FormControl type="text"
                         value={this.state.contactNumber || ''}
                         placeholder="Eine Handynummer, unter der wir dich während des Events erreichen können"
                         onChange={this.handleChange.bind(this)}/>
          </FormGroup>

          <FormGroup controlId="emergencyNumber" validationState={'error'}>
            <ControlLabel>
              Notfallnummer
            </ControlLabel>
            <FormControl type="text"
                         value={this.state.emergencyNumber || ''}
                         placeholder="Telefonnummer eines Notfallkontakts"
                         onChange={this.handleChange.bind(this)}/>
          </FormGroup>

          <FormGroup>

            <Checkbox id="acceptsTos"
                      onChange={this.handleChange.bind(this)}>
              Hiermit akzeptiere ich die Teilnahmebedingungen
            </Checkbox>

            <Checkbox id="acceptsCodeOfHonour"
                      onChange={this.handleChange.bind(this)}>
              Hiermit akzeptiere ich den Code of Honour
            </Checkbox>

            <Checkbox id="is18"
                      checked={this.state.is18 || false}
                      onChange={this.handleChange.bind(this)}>
              Ich bin mindestens 18 Jahre alt
            </Checkbox>

          </FormGroup>

          <Row>
            <Col xs={12} style={{textAlign: 'center'}}>
              <Button bsStyle="primary" onClick={this.register.bind(this)}>
                Nächster Schritt
              </Button>
            </Col>
          </Row>
        </form>
      </div>
    );
  }
}

{'fraction_non_alphanumeric': 0.11684251660805002, 'fraction_numerical': 0.002246971473231731, 'mean_word_length': 1.5152334152334153, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 131, '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': '1546079', 'n_tokens_mistral': 2767, 'n_tokens_neox': 2667, 'n_words': 498}