<commit_before>import React, {PureComponent} from 'react'
import {Redirect} from 'react-router'
import CSSModules from 'react-css-modules'

import style from './channel-form.css'

@CSSModules(style)
export default class ChannelForm extends PureComponent {
  state = {
    value: '',
    submit: false
  }

  onInputChange = (event) => {
    const {value} = event.target
    this.setState({value})
  }

  onButtonClick = (event) => {
    if (this.state.value) {
      this.setState({submit: true})
    }
  }

  render() {
    const {value, submit} = this.state
    return (
      <div styleName='container'>
        <input value={value} placeholder='Channel'
          onChange={this.onInputChange}/>
        <button onClick={this.onButtonClick}>
          <i className='fa fa-play'/>
          <span>Wukong</span>
        </button>
        {submit && <Redirect to={{pathname: `/${value}`}}/>}
      </div>
    )
  }
}<commit_msg>channel form enter key<commit_after>import React, {PureComponent} from 'react'
import {Redirect} from 'react-router-dom'
import CSSModules from 'react-css-modules'

import style from './channel-form.css'

@CSSModules(style)
export default class ChannelForm extends PureComponent {
  state = {
    value: '',
    submit: false
  }

  onInputChange = (event) => {
    const {value} = event.target
    this.setState({value})
  }

  onKeyDown = (event) => {
    if (event.key == 'Enter') {
      this.setState({submit: !!this.state.value})
    }
  }

  onButtonClick = (event) => {
    this.setState({submit: !!this.state.value})
  }

  render() {
    const {value, submit} = this.state
    return (
      <div styleName='container'>
        <input value={value} placeholder='Channel'
          onChange={this.onInputChange} onKeyDown={this.onKeyDown}/>
        <button onClick={this.onButtonClick}>
          <i className='fa fa-play'/>
          <span>Wukong</span>
        </button>
        {submit && <Redirect to={{pathname: `/${value}`}}/>}
      </div>
    )
  }
}
{'fraction_non_alphanumeric': 0.15781563126252504, 'fraction_numerical': 0.0, 'mean_word_length': 2.8256704980842913, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 26, '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': '6861862', 'n_tokens_mistral': 632, 'n_tokens_neox': 638, 'n_words': 137}