<commit_before>import React from 'react'
import { connect } from 'react-redux'
import { Button } from 'react-bootstrap'
import { Form, ValidatedInput } from 'react-bootstrap-validation'
import { add } from '../../redux/modules/ProjectsActions'
// import styles from './CreateProjectView.scss'

// We define mapStateToProps where we'd normally use
// the @connect decorator so the data requirements are clear upfront, but then
// export the decorated component after the main class definition so
// the component can be tested w/ and w/o being connected.
// See: http://rackt.github.io/redux/docs/recipes/WritingTests.html
const mapStateToProps = (state) => ({
  counter: state.counter
})
export class CreateProjectView extends React.Component {
  static propTypes = {
    dispatch: React.PropTypes.func.isRequired
  };

  _handleValidSubmit (values) {
    this.props.dispatch(add(values))
  }

  _handleInvalidSubmit (errors, values) {
    // Errors is an array containing input names
    // that failed to validate
  }

  render () {
    return (
      <div className='container'>
        <div className='page-header'>
          <h1>
          <span className='fa-stack'>
            <i className='fa fa-circle fa-stack-2x'></i>
            <i className='fa fa-rocket fa-stack-1x fa-inverse'></i>
          </span>
          Create project
          </h1>
        </div>

        <Form className='form-horizontal' onValidSubmit={this._handleValidSubmit.bind(this)} onInvalidSubmit={this._handleInvalidSubmit.bind(this)}>
          <ValidatedInput
            type='text'
            label='Name'
            labelClassName='col-sm-2'
            wrapperClassName='col-sm-4'
            name='name'
            validate='required'<commit_msg>redirecting after project was created works<commit_after>import React from 'react'
import { connect } from 'react-redux'
import { Button } from 'react-bootstrap'
import { Form, ValidatedInput } from 'react-bootstrap-validation'
import { add } from '../../redux/modules/ProjectsActions'
import { pushPath } from 'redux-simple-router'
// import styles from './CreateProjectView.scss'

// We define mapStateToProps where we'd normally use
// the @connect decorator so the data requirements are clear upfront, but then
// export the decorated component after the main class definition so
// the component can be tested w/ and w/o being connected.
// See: http://rackt.github.io/redux/docs/recipes/WritingTests.html
const mapStateToProps = (state) => ({
  counter: state.counter
})
export class CreateProjectView extends React.Component {
  static propTypes = {
    dispatch: React.PropTypes.func.isRequired
  };

  _handleValidSubmit (values) {
    const dispatch = this.props.dispatch

    this.props.dispatch(add(values))
      .then(() => dispatch(pushPath('/projects/' + values.key)))
  }

  _handleInvalidSubmit (errors, values) {
    // Errors is an array containing input names
    // that failed to validate
  }

  render () {
    return (
      <div className='container'>
        <div className='page-header'>
          <h1>
          <span className='fa-stack'>
            <i className='fa fa-circle fa-stack-2x'></i>
            <i className='fa fa-rocket fa-stack-1x fa-inverse'></i>
          </span>
          Create project
          </h1>
        </div>

        <Form className='form-horizontal' onValidSubmit={this._handleValidSubmit.bind(this)} onInvalidSubmit={this._handleInvalidSubmit.bind(this)}>
          <ValidatedInput
            type='text'
            label='Name'
            labelClassName='col-sm-2'
            wrapperClassName='col-sm-4'
            name='name'
            validate='required'
{'fraction_non_alphanumeric': 0.11941112322791712, 'fraction_numerical': 0.003271537622682661, 'mean_word_length': 2.813929313929314, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 30, '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': '7384570', 'n_tokens_mistral': 1025, 'n_tokens_neox': 1009, 'n_words': 276}