<commit_before>import React from "react"
import classNames from "classnames"

import IdeaEditForm from "./idea_edit_form"
import IdeaLiveEditContent from "./idea_live_edit_content"
import IdeaReadOnlyContent from "./idea_read_only_content"
import * as AppPropTypes from "../prop_types"
import styles from "./css_modules/idea.css"

const Idea = props => {
  const { idea, currentUser, retroChannel, stage } = props
  const classes = classNames(styles.index, {
    [styles.highlighted]: idea.isHighlighted,
  })

  const userIsEditing = idea.editing && idea.editorToken === currentUser.token

  let content
  if (userIsEditing) {
    content = (<IdeaEditForm
      idea={idea}
      retroChannel={retroChannel}
      currentUser={currentUser}
      stage={stage}
    />)
  } else if (idea.liveEditText) {
    content = <IdeaLiveEditContent idea={idea} />
  } else {
    content = <IdeaReadOnlyContent {...props} />
  }

  return (
    <li className={classes} title={idea.body} key={idea.id}>
      { content }
    </li>
  )
}

Idea.propTypes = {
  idea: AppPropTypes.idea.isRequired,
  retroChannel: AppPropTypes.retroChannel.isRequired,
  currentUser: AppPropTypes.user.isRequired,
  stage: AppPropTypes.stage.isRequired,
}

export default Idea<commit_msg>Refactor <Idea> to classical component<commit_after>import React, { Component } from "react"
import classNames from "classnames"

import IdeaEditForm from "./idea_edit_form"
import IdeaLiveEditContent from "./idea_live_edit_content"
import IdeaReadOnlyContent from "./idea_read_only_content"
import * as AppPropTypes from "../prop_types"
import styles from "./css_modules/idea.css"

export default class Idea extends Component {
  render() {
    const { idea, currentUser, retroChannel, stage } = this.props
    const classes = classNames(styles.index, {
      [styles.highlighted]: idea.isHighlighted,
    })

    const userIsEditing = idea.editing && idea.editorToken === currentUser.token

    let content
    if (userIsEditing) {
      content = (<IdeaEditForm
        idea={idea}
        retroChannel={retroChannel}
        currentUser={currentUser}
        stage={stage}
      />)
    } else if (idea.liveEditText) {
      content = <IdeaLiveEditContent idea={idea} />
    } else {
      content = <IdeaReadOnlyContent {...this.props} />
    }

    return (
      <li className={classes} title={idea.body} key={idea.id}>
        { content }
      </li>
    )
  }
}

Idea.propTypes = {
  idea: AppPropTypes.idea.isRequired,
  retroChannel: AppPropTypes.retroChannel.isRequired,
  currentUser: AppPropTypes.user.isRequired,
  stage: AppPropTypes.stage.isRequired,
}

{'fraction_non_alphanumeric': 0.11657142857142858, 'fraction_numerical': 0.0, 'mean_word_length': 3.647787610619469, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 15, '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': '2535457', 'n_tokens_mistral': 826, 'n_tokens_neox': 812, 'n_words': 179}