<commit_before>import { IRepo } from '../../interfaces/IRepo';

import { connect } from 'react-redux';
const notifier = require('node-notifier');

import getIcon from '../../helpers/icon';
import isAppFocused from '../../helpers/isAppFocused';

interface IRepoHistoryComponent {
  repos: IRepo[];
}

let lastRepos = undefined;

function RepoHistoryComponent ({ repos }: IRepoHistoryComponent) {
  if (!lastRepos) {
    lastRepos = repos;
    return null;
  }

  const changes = repos
    .map((repo, i) =>
      repo.behind > lastRepos[i].behind ? repo : undefined)
    .filter(repo => repo);

  if (changes.length && !isAppFocused()) {
    const msg = changes
      .map(change => `${change.name} is ${change.behind} commits behind`)
      .join(', ');

    notifier.notify({
      title: 'PiGit',
      icon: getIcon(),
      contentImage: false,
      message: msg
    });
  }

  lastRepos = repos;

  return null;
}

const mapStateToProps = (state) => {
  const repos = state.repos;
  return { repos };
};

const Repo = connect(
  mapStateToProps
)(RepoHistoryComponent);

export default Repo;
<commit_msg>history to new irepo<commit_after>import { IRepo } from '../../interfaces/IRepo';

import { connect } from 'react-redux';
const notifier = require('node-notifier');

import getIcon from '../../helpers/icon';
import isAppFocused from '../../helpers/isAppFocused';

interface IRepoHistoryComponent {
  repos: IRepo[];
}

let lastRepos: IRepo[] = undefined;

function RepoHistoryComponent ({ repos }: IRepoHistoryComponent) {
  if (!lastRepos) {
    lastRepos = repos;
    return null;
  }

  const changes = repos
    .map((repo, i) =>
      repo.stats.behind > lastRepos[i].stats.behind ? repo : undefined)
    .filter(repo => repo);

  if (changes.length && !isAppFocused()) {
    const msg = changes
      .map(change => `${change.name} is ${change.stats.behind} commits behind`)
      .join(', ');

    notifier.notify({
      title: 'PiGit',
      icon: getIcon(),
      contentImage: false,
      message: msg
    });
  }

  lastRepos = repos;

  return null;
}

const mapStateToProps = (state) => {
  const repos = state.repos;
  return { repos };
};

const Repo = connect(
  mapStateToProps
)(RepoHistoryComponent);

export default Repo;

{'fraction_non_alphanumeric': 0.15084294587400177, 'fraction_numerical': 0.0, 'mean_word_length': 3.191449814126394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '6606256', 'n_tokens_mistral': 746, 'n_tokens_neox': 734, 'n_words': 182}