<commit_before>import React from 'react';
import { connect } from 'react-redux';
import _ from 'lodash';
import {
  diaryGetMonth,
  entryOnChange,
  entryOnEditModeClicked,
  entryOnSave
} from '../actions/DiaryActions';

import DateComponent from '../components/Date';

class DateContainer extends React.Component {
  constructor(props) {
    super(props);
  }

  componentWillMount() {
    if (this.props.shouldFetch) {
      this.props.getDate(this.props.year, this.props.month, this.props.day);
    }
  }

  render() {
    if (this.props.isFetching) {
      return <div>loading...</div>;
    }
    return (
      <DateComponent
        thisUser={this.props.thisUser}
        otherUser={this.props.otherUser}
        saveError={this.props.saveError}
        onUserEntryChange={this.props.onUserEntryChange}
        onEditModeClicked={this.props.onEditModeClicked}
        onEntrySave={text =>
          this.props.onEntrySave(
            this.props.year,
            this.props.month,
            this.props.day,
            text
          )}
      />
    );
  }
}

function mapStateToProps(state, ownProps) {
  const { diary, couple, users } = state;
  const { year, month, day } = diary.date;
  const thisUser = users[couple.thisUser];
  const otherUser = users[couple.otherUser];

  if (_.some(diary.fetched, { year, month }) && !_.isEmpty(couple) && !_.isEmpty(users)) {
    let entries = _.filter(diary.dates, date =>
      _.isMatch(date, { year, month, day })).map(date =>
        _.map(date.entries, entryId => diary.entries[entryId]));
    entries = _.flatten(entries);

    const thisUserEntry = _.find(
      entries,
      {user: thisUser.id}
    ) || { text: '' };
    const otherUserEntry = _.find(
      entries,
      {user: otherUser.id}
    ) || { text: 'No entry for this day :(' };

    const thisUserText = diary.date.ui.isInEditMode<commit_msg>Updated empty day text<commit_after>import React from 'react';
import { connect } from 'react-redux';
import _ from 'lodash';
import {
  diaryGetMonth,
  entryOnChange,
  entryOnEditModeClicked,
  entryOnSave
} from '../actions/DiaryActions';

import DateComponent from '../components/Date';

class DateContainer extends React.Component {
  constructor(props) {
    super(props);
  }

  componentWillMount() {
    if (this.props.shouldFetch) {
      this.props.getDate(this.props.year, this.props.month, this.props.day);
    }
  }

  render() {
    if (this.props.isFetching) {
      return <div>loading...</div>;
    }
    return (
      <DateComponent
        thisUser={this.props.thisUser}
        otherUser={this.props.otherUser}
        saveError={this.props.saveError}
        onUserEntryChange={this.props.onUserEntryChange}
        onEditModeClicked={this.props.onEditModeClicked}
        onEntrySave={text =>
          this.props.onEntrySave(
            this.props.year,
            this.props.month,
            this.props.day,
            text
          )}
      />
    );
  }
}

function mapStateToProps(state, ownProps) {
  const { diary, couple, users } = state;
  const { year, month, day } = diary.date;
  const thisUser = users[couple.thisUser];
  const otherUser = users[couple.otherUser];

  if (_.some(diary.fetched, { year, month }) && !_.isEmpty(couple) && !_.isEmpty(users)) {
    let entries = _.filter(diary.dates, date =>
      _.isMatch(date, { year, month, day })).map(date =>
        _.map(date.entries, entryId => diary.entries[entryId]));
    entries = _.flatten(entries);

    const thisUserEntry = _.find(
      entries,
      {user: thisUser.id}
    ) || { text: '' };
    const otherUserEntry = _.find(
      entries,
      {user: otherUser.id}
    ) || { text: 'How heavily to bed do I proceed\nWhen what I seek, my missing evening read,\nDoth teach that emptiness inside to say\nThus far the miles are measured from my bae!' };

    const thisUserText = diary.date.ui.isInEditMode
{'fraction_non_alphanumeric': 0.13576754949858574, 'fraction_numerical': 0.0, 'mean_word_length': 2.7367915465898176, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '3002165', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1222, 'n_words': 251}