<commit_before>'use strict';

import React from 'react';
import SlackHandler from '../browser/slack-handler.js';

export default class MainTable extends React.Component {

  constructor(props) {
    super(props);
    this._slack = new SlackHandler();
    this.state = {
      dataList: this._slack,
    };
    this._slack.onRefresh = () => {
      this.setState({ dataList: this._slack });
    };
  }

  _onClickTableRow(event) {
    let target = event.target;
    let channelLink = undefined;
    while (target && !channelLink) {
      channelLink = target.getAttribute('data-link');
      target = target.parentElement;
    }
    if (channelLink) {
      document.location.href = channelLink;
    }
  }

  _renderTableRow(dataList) {
    return dataList.getChannels().map((channel, index) => {
      let rowClass = index % 2 ? 'even' : 'odd';
      if (channel.is_new) {
        rowClass += ' new';
      }
      return (
        <tr key={index} data-link={channel.link} onClick={this._onClickTableRow.bind(this)} className={rowClass}>
          <td data-title="date">{channel.date}</td>
          <td data-title="team">{channel.team}</td>
          <td data-title="channel">{channel.channel}</td>
          <td data-title="user">{channel.userName}</td>
          <td data-title="last-message">{channel.lastMessage}</td>
        </tr>
      );
    });
  }

  render() {
    return (
      <table className="main-table table-hover">
        <colgroup><commit_msg>ensure key is unique<commit_after>'use strict';

import React from 'react';
import SlackHandler from '../browser/slack-handler.js';

export default class MainTable extends React.Component {

  constructor(props) {
    super(props);
    this._slack = new SlackHandler();
    this.state = {
      dataList: this._slack,
    };
    this._slack.onRefresh = () => {
      this.setState({ dataList: this._slack });
    };
  }

  _onClickTableRow(event) {
    let target = event.target;
    let channelLink = undefined;
    while (target && !channelLink) {
      channelLink = target.getAttribute('data-link');
      target = target.parentElement;
    }
    if (channelLink) {
      document.location.href = channelLink;
    }
  }

  _renderTableRow(dataList) {
    return dataList.getChannels().map((channel, index) => {
      let rowClass = index % 2 ? 'even' : 'odd';
      if (channel.is_new) {
        rowClass += ' new';
      }
      return (
        <tr key={channel.id} data-link={channel.link} onClick={this._onClickTableRow.bind(this)} className={rowClass}>
          <td data-title="date">{channel.date}</td>
          <td data-title="team">{channel.team}</td>
          <td data-title="channel">{channel.channel}</td>
          <td data-title="user">{channel.userName}</td>
          <td data-title="last-message">{channel.lastMessage}</td>
        </tr>
      );
    });
  }

  render() {
    return (
      <table className="main-table table-hover">
        <colgroup>
{'fraction_non_alphanumeric': 0.15680272108843538, 'fraction_numerical': 0.0006802721088435374, 'mean_word_length': 2.671660424469413, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 35, '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': '4790728', 'n_tokens_mistral': 917, 'n_tokens_neox': 910, 'n_words': 168}