<commit_before>import React from "react";
import _ from "lodash";

class Notifications extends React.Component {
  render() {
    var { kills } = this.props;
    var date = new Date();

    _.remove(kills, k => date - k.date > 3000);
    kills = _.sortBy(kills, k => k.date.valueOf);
    return (
      <div className="notifications">
        {_.map(kills, (k, idx) => {
          return <p key={idx}>{k.text}</p>;
        })}
      </div>
    );
  }
}

export default Notifications;<commit_msg>Refactor Notification to use hooks<commit_after>import React from "react";

function Notifications(props) {
  const { notifications } = props;
  const dateTime = new Date().getTime();

  const filteredKeys = notifications
    .filter((el) => el && el.text)
    .filter((el) => el.date > dateTime - 5000)
    .sort((a, b) => b.date - a.date)
    .slice(0, 5);

  return (
    <div className="notifications">
      {filteredKeys.map((k, idx) => {
        return (
          <div className={`notifications-element ${k.id % 2 === 0 ? "-alt" : ""}`} key={idx}>
            {k.text}
          </div>
        );
      })}
    </div>
  );
}

export default Notifications;
{'fraction_non_alphanumeric': 0.17184801381692574, 'fraction_numerical': 0.010362694300518135, 'mean_word_length': 2.470059880239521, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, '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': '1187308', 'n_tokens_mistral': 394, 'n_tokens_neox': 373, 'n_words': 92}