<commit_before>import React, { Component } from 'react';

class CommentApp extends Component {

  constructor(props) {
    super(props);
    this.state = {
      comments: [
      ]
    }
    this.handleCommentSubmit = this.handleCommentSubmit.bind(this);
    this.fetchComments = this.fetchComments.bind(this);
  }

  componentDidMount() {
    // Fetch data
    this.fetchComments()
  }

  fetchComments() {
    fetch('http://localhost:3001/comments')
      .then((res) => res.json())
      .then((comments) => {
        this.setState({
          comments
        })
      })
  }

  handleCommentSubmit(comment) {
    fetch('http://localhost:3001/comments', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(comment)
    }).then((res) => res.json())
    .then((comments) => {
      this.setState({
        comments
      })
    })
  }

  render() {
    return (
      <div>
        <h1>Comments</h1>
        <CommentForm onCommentSubmit={this.handleCommentSubmit}/>
        <CommentList comments={this.state.comments}/>
      </div>
    );
  }
}

class CommentForm extends Component {

  constructor(props) {
    super(props);
    this.state = {
      name: '',
      message: '',<commit_msg>Update post to new data response format<commit_after>import React, { Component } from 'react';

class CommentApp extends Component {

  constructor(props) {
    super(props);
    this.state = {
      comments: [
      ]
    }
    this.handleCommentSubmit = this.handleCommentSubmit.bind(this);
    this.fetchComments = this.fetchComments.bind(this);
  }

  componentDidMount() {
    // Fetch data
    this.fetchComments()
  }

  fetchComments() {
    fetch('http://localhost:3001/comments')
      .then((res) => res.json())
      .then((comments) => {
        this.setState({
          comments
        })
      })
  }

  handleCommentSubmit(comment) {
    fetch('http://localhost:3001/comments', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(comment)
    }).then((res) => res.json())
    .then((comment) => {
      this.setState({
        comments: [
          ...this.state.comments,
          comment
        ]
      })
    })
  }

  render() {
    return (
      <div>
        <h1>Comments</h1>
        <CommentForm onCommentSubmit={this.handleCommentSubmit}/>
        <CommentList comments={this.state.comments}/>
      </div>
    );
  }
}

class CommentForm extends Component {

  constructor(props) {
    super(props);
    this.state = {
      name: '',
      message: '',
{'fraction_non_alphanumeric': 0.15267459138187223, 'fraction_numerical': 0.007429420505200594, 'mean_word_length': 2.205952380952381, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, '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': '2996179', 'n_tokens_mistral': 834, 'n_tokens_neox': 807, 'n_words': 132}