<commit_before>import React, { Component } from 'react'
import { connect } from 'react-redux'
import { getCategories } from '../actions/category_actions'
import { getPostsByCategory, getPosts, addPost } from '../actions/post_actions'
import { sortPosts } from '../actions/sort_actions'
import PostContainer from './PostContainer'
import { capitalize } from '../utils/helpers'
import sortBy from 'sort-by'
import _ from 'lodash'
import { Nav, NavItem } from 'react-bootstrap'
import { Modal } from 'react-bootstrap'
import { guid } from '../utils/helpers'

class DefaultView extends Component {
  state = {
    addPostModalOpen: false,
    addPost: {
      title: '',
      body: '',
      author: '',
      category: ''
    }
  }

  componentDidMount() {
    this.props.getCategories()
    this.props.getPosts()
  }

  openAddPostModal = () => {
    this.setState(() => ({
      addPostModalOpen: true,
      addPost: {
        title: '',
        body: '',
        author: '',
        category: ''
      }
    }))
  }

  updateAddPostTitle = (newTitle) => {
    this.setState({
      addPost: {
        ...this.state.addPost,
        title: newTitle
      }<commit_msg>Fix: Defalut category on adding post<commit_after>import React, { Component } from 'react'
import { connect } from 'react-redux'
import { getCategories } from '../actions/category_actions'
import { getPostsByCategory, getPosts, addPost } from '../actions/post_actions'
import { sortPosts } from '../actions/sort_actions'
import PostContainer from './PostContainer'
import { capitalize } from '../utils/helpers'
import sortBy from 'sort-by'
import _ from 'lodash'
import { Nav, NavItem } from 'react-bootstrap'
import { Modal } from 'react-bootstrap'
import { guid } from '../utils/helpers'

class DefaultView extends Component {
  state = {
    addPostModalOpen: false,
    addPost: {
      title: '',
      body: '',
      author: '',
      category: ''
    }
  }

  componentDidMount() {
    this.props.getCategories()
    this.props.getPosts()
  }

  openAddPostModal = () => {
    this.setState(() => ({
      addPostModalOpen: true,
      addPost: {
        title: '',
        body: '',
        author: '',
        category: 'react'
      }
    }))
  }

  updateAddPostTitle = (newTitle) => {
    this.setState({
      addPost: {
        ...this.state.addPost,
        title: newTitle
      }
{'fraction_non_alphanumeric': 0.14243448858833474, 'fraction_numerical': 0.0, 'mean_word_length': 2.6640866873065017, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7124048', 'n_tokens_mistral': 719, 'n_tokens_neox': 705, 'n_words': 170}