<commit_before>import React from 'react';
import Button from './Button.jsx';
import classNames from 'classnames';

const nameMaker = (users) => {
  const last = users.length - 1;
  return users
  .map(user => `${user.firstName} ${user.lastName}`)
  .reduce((names, currName, i) =>
    names + (i === last ? ' & ' : ', ') + currName
  );
};

const Room = ({ room, handleRoomChange, index }) => (
  <a href="#" onClick={() => handleRoomChange(index)}>
    <div className="room">
      <div className="thread-name">{nameMaker(room.users)}</div>
      <Button label='Delete' type='action' onClick={() => console.log(room.id)} />
    </div>
  </a>
);

// TODO
/* add time last updated?? */
/* display last message text? */

const Rooms = ({ rooms, handleRoomChange }) => (
  <div className="thread-section">
    <div className="thread-list">
      {rooms.map((room, i, roomsState) => (
        <Room index={i} room={room} handleRoomChange={handleRoomChange} />
      ))}
    </div>
  </div>
);

export default Rooms;
<commit_msg>Working click handler for dummy delete<commit_after>import React from 'react';
import Button from './Button.jsx';
import classNames from 'classnames';

const nameMaker = (users) => {
  const last = users.length - 1;
  return users
  .map(user => `${user.firstName} ${user.lastName}`)
  .reduce((names, currName, i) =>
    names + (i === last ? ' & ' : ', ') + currName
  );
};

const Room = ({ room, handleRoomChange, index }) => (
  <a href="#" onClick={() => handleRoomChange(index)}>
    <div className="room">
      <div className="thread-name">{nameMaker(room.users)}</div>
      <Button label='Delete' type='action' clickHandler={() => console.log(room.id)} />
    </div>
  </a>
);

// TODO
/* add time last updated?? */
/* display last message text? */

const Rooms = ({ rooms, handleRoomChange }) => (
  <div className="thread-section">
    <div className="thread-list">
      {rooms.map((room, i, roomsState) => (
        <Room index={i} room={room} handleRoomChange={handleRoomChange} />
      ))}
    </div>
  </div>
);

export default Rooms;

{'fraction_non_alphanumeric': 0.19923002887391722, 'fraction_numerical': 0.0009624639076034649, 'mean_word_length': 3.5195652173913046, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 43, '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': '129268', 'n_tokens_mistral': 672, 'n_tokens_neox': 678, 'n_words': 165}