<commit_before>// this file is a subview of a user's companies that they follow
// its parent is UserProfile.js

// import dependencies
import React, { PropTypes, Component } from 'react';
import _                               from 'lodash';
import { Table, TableHeader, TableRow, TableRowColumn, TableHeaderColumn, TableBody, TableFooter, FlatButton } from 'material-ui';

import CompanyVis from './CompanyVis';

export default class MyCompanies extends Component {

  constructor () {
    super();

    // sets the state for our table settings (material-ui)
    this.state = {
      fixedHeader: true,
      stripedRows: true,
      showRowHover: true,
      multiSelectable: true,
      showComparison: false,
      deselectOnClickaway: false,
      selectedCompanies: []
    };
  }

  clickRemoveCompany(e) {
    e.preventDefault();
    this.props.removeApiData('/api/company/', id)
  }
  selectedRows: []

  doSelection(selection) {
    this.selectedRows = selection;
  }

  compareCompanies() {

    var selectedCompanies = [];
    if (this.selectedRows === 'all') {
      console.log('all');
      selectedCompanies = this.props.apiData.companies.slice();
    } else {
      for (var i = 0; i < this.selectedRows.length; i++) {
        selectedCompanies.push(this.props.apiData.companies[this.selectedRows[i].toString(10)]);
      }
    }
    this.setState({selectedCompanies: selectedCompanies});
    this.setState({showComparison: true});
    setTimeout(function() {
      console.log(this.state)
    }.bind(this), 1);
  }
  
  render () {

    return (<div>
              <Table 
                  fixedHeader={this.state.fixedHeader}
                  multiSelectable={this.state.multiSelectable}
                  onRowSelection={this.doSelection.bind(this)} 
              >
                <TableHeader>
                  <TableRow>
                    <TableHeaderColumn 
                        colSpan="8" 
                        style={{textAlign: 'center'}}
                    >
                      <h1>{'My Companies'}</h1>
                    </TableHeaderColumn>
                  </TableRow>

                  <TableRow>
                    <TableHeaderColumn>{'Name'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Website'}</TableHeaderColumn>
                    <TableHeaderColumn>{'City'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Employees'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Founding'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Stage'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Funding'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Remove?'}</TableHeaderColumn>
                  </TableRow>
                </TableHeader>

                <TableBody 
                  deselectOnClickaway={this.state.deselectOnClickaway}
                  stripedRows={this.state.stripedRows}
                  showRowHover={this.state.showRowHover}  
                >
                  {_.map(this.props.apiData.companies, function(company) {
                    return (
                      <TableRow >
                        <TableRowColumn>{company.name}</TableRowColumn>
                        <TableRowColumn>
                          <a 
                              href={'http://www.' + company.website} 
                              target="_blank"
                          >
                            {company.website}
                          </a>
                        </TableRowColumn>
                        <TableRowColumn>{company.city}</TableRowColumn>
                        <TableRowColumn>{company.employees}</TableRowColumn>
                        <TableRowColumn>{company.founding_date}</TableRowColumn>
                        <TableRowColumn>{company.stage}</TableRowColumn>
                        <TableRowColumn>{company.total_funding}</TableRowColumn>

                        { /* this is not working; trying to remove list item upon clicking X */ }<commit_msg>Fix linting warnings in MyCompanies<commit_after>// this file is a subview of a user's companies that they follow
// its parent is UserProfile.js

// import dependencies
import React, { PropTypes, Component } from 'react';
import _                               from 'lodash';
import { Table, TableHeader, TableRow, TableRowColumn, TableHeaderColumn, TableBody, TableFooter, FlatButton } from 'material-ui';

import CompanyVis from './CompanyVis';

export default class MyCompanies extends Component {

  constructor () {
    super();

    // sets the state for our table settings (material-ui)
    this.state = {
      fixedHeader: true,
      stripedRows: true,
      showRowHover: true,
      multiSelectable: true,
      showComparison: false,
      deselectOnClickaway: false,
      selectedCompanies: []
    };

    this.selectedRows = [];
  }

  clickRemoveCompany(e) {
    e.preventDefault();
    this.props.removeApiData('/api/company/', id)
  }

  doSelection(selection) {
    this.selectedRows = selection;
  }

  compareCompanies() {

    var selectedCompanies = [];
    if (this.selectedRows === 'all') {
      console.log('all');
      selectedCompanies = this.props.apiData.companies.slice();
    } else {
      for (var i = 0; i < this.selectedRows.length; i++) {
        selectedCompanies.push(this.props.apiData.companies[this.selectedRows[i].toString(10)]);
      }
    }
    this.setState({selectedCompanies: selectedCompanies});
    this.setState({showComparison: true});
    setTimeout(function() {
      console.log(this.state)
    }.bind(this), 1);
  }
  
  render () {

    return (<div>
              <Table 
                  fixedHeader={this.state.fixedHeader}
                  multiSelectable={this.state.multiSelectable}
                  onRowSelection={this.doSelection.bind(this)} 
              >
                <TableHeader>
                  <TableRow>
                    <TableHeaderColumn 
                        colSpan="8" 
                        style={{textAlign: 'center'}}
                    >
                      <h1>{'My Companies'}</h1>
                    </TableHeaderColumn>
                  </TableRow>

                  <TableRow>
                    <TableHeaderColumn>{'Name'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Website'}</TableHeaderColumn>
                    <TableHeaderColumn>{'City'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Employees'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Founding'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Stage'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Funding'}</TableHeaderColumn>
                    <TableHeaderColumn>{'Remove?'}</TableHeaderColumn>
                  </TableRow>
                </TableHeader>

                <TableBody 
                  deselectOnClickaway={this.state.deselectOnClickaway}
                  showRowHover={this.state.showRowHover}  
                  stripedRows={this.state.stripedRows}
                >
                  {_.map(this.props.apiData.companies, function(company) {
                    return (
                      <TableRow >
                        <TableRowColumn>{company.name}</TableRowColumn>
                        <TableRowColumn>
                          <a 
                              href={'http://www.' + company.website} 
                              target="_blank"
                          >
                            {company.website}
                          </a>
                        </TableRowColumn>
                        <TableRowColumn>{company.city}</TableRowColumn>
                        <TableRowColumn>{company.employees}</TableRowColumn>
                        <TableRowColumn>{company.founding_date}</TableRowColumn>
                        <TableRowColumn>{company.stage}</TableRowColumn>
                        <TableRowColumn>{company.total_funding}</TableRowColumn>

                        { /* this is not working; trying to remove list item upon clicking X */ }
{'fraction_non_alphanumeric': 0.10862068965517241, 'fraction_numerical': 0.0017241379310344827, 'mean_word_length': 1.6418347430058555, 'pattern_counts': {'":': 0, '<': 97, '<?xml version=': 0, '>': 95, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1202359', 'n_tokens_mistral': 2117, 'n_tokens_neox': 1974, 'n_words': 342}