<commit_before>import styles from './index.scss'
import i18next from 'i18next'
// import firebaseUtils from 'utils/firebase/index'

export default class UserSettings extends React.Component {
  static propTypes = {
    userFirebase: React.PropTypes.object
  }

  constructor () {
    super()
    this.langOptions = [
      {name: 'English', value: 'en'},
      {name: '日本語', value: 'ja'}
    ]
  }

  changeLang (e) {
    i18next.changeLanguage(e.target.value, (err, t) => {
      if (err) {
        alert('言語の切り替えができませんでした。時間が経ってから再度お試しください。')
      }
      location.reload()
    })
  }

  render () {
    const {userFirebase} = this.props
    return (
      <div className={styles['UserSettings']}>
        {userFirebase
          ? <div>
            <div>
              <p>{userFirebase[userFirebase.auth.provider].displayName}</p>
              <p>{userFirebase[userFirebase.auth.provider].email}</p>
            </div>
            <select onChange={::this.changeLang}>
              {this.langOptions.map((option, index) => {
                return (
                  <option
                    key={index}
                    value={option.value}
                    selected={i18next.language === option.value}>
                      {option.name}
                  </option>
                )
              })}
            </select>
          </div> : null}
      </div>
    )
  }
}
<commit_msg>[add]renderInfo<commit_after>import styles from './index.scss'
import i18next from 'i18next'

export default class UserSettings extends React.Component {
  static propTypes = {
    userFirebase: React.PropTypes.object
  }

  constructor () {
    super()
    this.langOptions = [
      {name: 'English', value: 'en'},
      {name: '日本語', value: 'ja'}
    ]
  }

  changeLang (e) {
    i18next.changeLanguage(e.target.value, (err, t) => {
      if (err) {
        alert('言語の切り替えができませんでした。時間が経ってから再度お試しください。')
      }
      location.reload()
    })
  }

  /**
   * ユーザーの名前、メールアドレス、言語情報を表示
   */
  renderInfo () {
    const {userFirebase} = this.props
    if (!userFirebase) {
      return null
    }
    return (
      <div>
        <div>
          <p>{userFirebase[userFirebase.auth.provider].displayName}</p>
          <p>{userFirebase[userFirebase.auth.provider].email}</p>
        </div>
        <select onChange={::this.changeLang}>
          {this.langOptions.map((option, index) => {
            return (
              <option
                key={index}
                value={option.value}
                selected={i18next.language === option.value}>
                  {option.name}
              </option>
            )
          })}
        </select>
      </div>
    )
  }

  render () {
    return (
      <div className={styles['UserSettings']}>
        {this.renderInfo()}
      </div>
    )
  }
}

{'fraction_non_alphanumeric': 0.14275568181818182, 'fraction_numerical': 0.005681818181818182, 'mean_word_length': 1.740272373540856, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 35, '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': '4876316', 'n_tokens_mistral': 940, 'n_tokens_neox': 908, 'n_words': 144}