<commit_before>import React from 'react';
import { connect } from 'react-redux';
import { fetchPrompts, submitAttempt } from '../actions/actions';
import Race from './race';
import Prompt from './prompt';
import UserInput from './userInput';
import TestResults from './testResults';
const {Tabs, Tab} = require('react-bootstrap');

class Game extends React.Component {
  componentWillMount() {
    this.props.fetchPrompts();
  }

  render (){
    return (
      <div className='game'>
        <div className='race clearfix'>
          <Race />
        </div>
        <div className='prompt-panel col-sm-4'>
          <Tabs defaultActiveKey={1} id='detailsSelection'>
            <Tab eventKey={1} title="Prompt">
              { this.props.prompts[0] && <Prompt name={this.props.prompts[0].name} description={this.props.prompts[0].description} />}
            </Tab>
            <Tab eventKey={2} title="Test Results">
              <TestResults output={this.props.attempt.output} reason={this.props.attempt.reason} />
            </Tab>
          </Tabs>
        </div>
        <div className='input-panel col-sm-8'>
          {this.props.prompts[0] &&
            <UserInput
            fetchPrompts={this.props.fetchPrompts}
            submitAttempt={this.props.submitAttempt}
            session={this.props.prompts[0].session}
            passed={this.props.passed}/>}
        </div>
      </div>
    )
  }
}

function mapStateToProps(state) {
  return { prompts: state.game.prompts,
           attempt: state.game.attempt,
           passed: state.game.passed
          };
}

export default connect(mapStateToProps, { fetchPrompts, submitAttempt })(Game);<commit_msg>(refactor) Update game component to handle new prompt<commit_after>import React from 'react';
import { connect } from 'react-redux';
import { fetchPrompts, submitAttempt, nextPrompt } from '../actions/actions';
import Race from './race';
import Prompt from './prompt';
import UserInput from './userInput';
import TestResults from './testResults';
const {Tabs, Tab} = require('react-bootstrap');

class Game extends React.Component {
  componentWillMount() {
    this.props.fetchPrompts();
  }

  render (){
    if(this.props.prompts.statusCode === 500){
      console.log('calling again');
      this.props.fetchPrompts();
    }
    return (
      <div className='game'>
        <div className='race clearfix'>
          <Race />
        </div>
        <div className='prompt-panel col-sm-4'>
          <Tabs defaultActiveKey={1} id='detailsSelection'>
            <Tab eventKey={1} title="Prompt">
              { this.props.prompts[this.props.index] &&
                <Prompt name={this.props.prompts[this.props.index].name} description={this.props.prompts[this.props.index].description} />}
            </Tab>
            <Tab eventKey={2} title="Test Results">
              <TestResults output={this.props.attempt.output} reason={this.props.attempt.reason} />
            </Tab>
          </Tabs>
        </div>
        <div className='input-panel col-sm-8'>
          { this.props.prompts[this.props.index] &&
            <UserInput
            fetchPrompts={this.props.fetchPrompts}
            submitAttempt={this.props.submitAttempt}
            nextPrompt={this.props.nextPrompt}
            session={this.props.prompts[this.props.index].session}
            passed={this.props.passed}
            index={this.props.index}
            amount={this.props.amount}/>}
        </div>
      </div>
    )
  }
}

function mapStateToProps(state) {
  console.log(state);
  return { prompts: state.game.prompts,
           attempt: state.game.attempt,
           passed: state.game.passed,
           index: state.game.index,
           amount: state.soloSelection.amount
          };
}

export default connect(mapStateToProps, { fetchPrompts, submitAttempt, nextPrompt })(Game);

{'fraction_non_alphanumeric': 0.14422827496757457, 'fraction_numerical': 0.004669260700389105, 'mean_word_length': 2.473873873873874, 'pattern_counts': {'":': 0, '<': 39, '<?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': '3074176', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1105, 'n_words': 217}