<commit_before>import React, { Component } from 'react'
import cx from 'classnames'
import IconCreate from 'react-icons/md/create-new-folder'
import IconOpen from 'react-icons/md/file-download'
import IconCheck from 'react-icons/md/check-circle'
import FaCog from 'react-icons/fa/cog'
import { connect } from 'react-redux'

import { addProject } from 'actions/projects'
import { openModal } from 'reducers/modals'

import Button from 'components/Button'
import ProjectsList from 'components/ProjectsList'

import './style.scss'

@connect(state => ({
  projects: state.settings.get('projects'),
}), {
  addProject,
  openModal,
})
class HomePage extends Component {

  state = {
    isEditing: false,
  }

  componentDidMount () {
    if (this.props.projects.size === 0) {
      this._newProjectBTN.focus()
    }
  }

  focusNew = () => this._newProjectBTN.focus()

  preventAndEdit = isEditing => e => {
    e.stopPropagation()
    e.preventDefault()
    this.setState({ isEditing })
  }

  render () {

    const {
      isEditing,
    } = this.state

    const {
      addProject,
      openModal,
      projects,
    } = this.props

    const hasProjects = !!projects.size

    return (
      <div
        className={cx({
          'fg-1 d-f fd-c p-10': hasProjects,
          'fg-1 z': !hasProjects,
        })}
      >

        <div className='flow-h-5 d-f ai-c'>
          <Button
            ref={n => this._newProjectBTN = n}
            primary
            onClick={() => openModal('newProject')}
          >
            <IconCreate size={20} className='mr-5' />
            {'New project'}
          </Button>
          <Button
            ghost
            onClick={() => addProject()}
          >
            <IconOpen size={20} className='mr-5' />
            {'Open project'}
          </Button>
          <div className={cx({ 'ml-auto': hasProjects })}>
            <Button ghost onClick={() => openModal('settings')}>
              <FaCog />
            </Button>
          </div>
        </div>

        {hasProjects && (
          <div className='fg-1 d-f fd-c anim-enter-fade'>
            <h2 className='mt-20 mb-20 d-f ai-c' style={{ height: 40 }}>
              {'Recent projects'}<commit_msg>update home padding between buttons<commit_after>import React, { Component } from 'react'
import cx from 'classnames'
import IconCreate from 'react-icons/md/create-new-folder'
import IconOpen from 'react-icons/md/file-download'
import IconCheck from 'react-icons/md/check-circle'
import FaCog from 'react-icons/fa/cog'
import { connect } from 'react-redux'

import { addProject } from 'actions/projects'
import { openModal } from 'reducers/modals'

import Button from 'components/Button'
import ProjectsList from 'components/ProjectsList'

import './style.scss'

@connect(state => ({
  projects: state.settings.get('projects'),
}), {
  addProject,
  openModal,
})
class HomePage extends Component {

  state = {
    isEditing: false,
  }

  componentDidMount () {
    if (this.props.projects.size === 0) {
      this._newProjectBTN.focus()
    }
  }

  focusNew = () => this._newProjectBTN.focus()

  preventAndEdit = isEditing => e => {
    e.stopPropagation()
    e.preventDefault()
    this.setState({ isEditing })
  }

  render () {

    const {
      isEditing,
    } = this.state

    const {
      addProject,
      openModal,
      projects,
    } = this.props

    const hasProjects = !!projects.size

    return (
      <div
        className={cx({
          'fg-1 d-f fd-c p-10': hasProjects,
          'fg-1 z': !hasProjects,
        })}
      >

        <div className='flow-h-10 d-f ai-c'>
          <Button
            ref={n => this._newProjectBTN = n}
            primary
            onClick={() => openModal('newProject')}
          >
            <IconCreate size={20} className='mr-5' />
            {'New project'}
          </Button>
          <Button
            ghost
            onClick={() => addProject()}
          >
            <IconOpen size={20} className='mr-5' />
            {'Open project'}
          </Button>
          <div className={cx({ 'ml-auto': hasProjects })}>
            <Button ghost onClick={() => openModal('settings')}>
              <FaCog />
            </Button>
          </div>
        </div>

        {hasProjects && (
          <div className='fg-1 d-f fd-c anim-enter-fade'>
            <h2 className='mt-20 mb-20 d-f ai-c' style={{ height: 40 }}>
              {'Recent projects'}
{'fraction_non_alphanumeric': 0.14417246799910172, 'fraction_numerical': 0.009207275993712105, 'mean_word_length': 2.0569663692518874, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6923617', 'n_tokens_mistral': 1396, 'n_tokens_neox': 1368, 'n_words': 305}