<commit_before>import React from 'react';
import { connect } from 'react-redux';

import { getMatch, setMatchSort } from '../../actions';
import { REDUCER_KEY } from '../../reducers';
import { sortMatch, transformMatch } from '../../selectors';

import { createTable } from '../Table';
import BuildingMap from '../BuildingMap/BuildingMap';
import MatchHeader from './MatchHeader';
import {
  overviewColumns,
  abUpgradeColumns,
  benchmarksColumns,
} from './matchColumns.jsx';

const match = (state) => state[REDUCER_KEY].gotMatch.match;
const MatchTable = createTable(
  match,
  (state, sortState) => (sortState ? sortMatch(state) : transformMatch(state)),
  setMatchSort
);

const mapStateToProps = (state, { params }) => ({
  matchId: params.match_id,
  match: state[REDUCER_KEY].gotMatch.match,
  loading: state[REDUCER_KEY].gotMatch.loading,
});

const mapDispatchToProps = (dispatch) => ({
  getMatch: (matchId) => dispatch(getMatch(matchId)),
});

class RequestLayer extends React.Component {
  componentDidMount() {
    this.props.getMatch(this.props.routeParams.match_id);
  }

  componentWillUpdate(nextProps) {
    if (this.props.match_id !== nextProps.match_id) {
      this.props.getMatch(nextProps.match_id);
    }
  }

  render() {
    return (
      <div>
        <MatchHeader match={this.props.match} />
        <MatchTable columns={overviewColumns} />
        <MatchTable columns={abUpgradeColumns} />
        <BuildingMap match={this.props.match} loading={this.props.loading} />
        <MatchTable columns={benchmarksColumns(this.props.match)} />
      </div>
    );
  }
  // TODO party indicator
  // Overall (stacks/stuns/dead/biggest hit)
  // Laning (lane, eff/lh/dn, lane map)
  // skills (casts/hits/damage)
  // items (casts/hits/damage)
  // purchase counts
  // purchase times
  // Hero kill times
  // Ward maps
  // Unit kills
  // Last Hits
  // Graphs<commit_msg>add user state for dotacoach button<commit_after>import React from 'react';
import { connect } from 'react-redux';

import { getMatch, setMatchSort } from '../../actions';
import { REDUCER_KEY } from '../../reducers';
import { sortMatch, transformMatch } from '../../selectors';

import { createTable } from '../Table';
import BuildingMap from '../BuildingMap/BuildingMap';
import MatchHeader from './MatchHeader';
import {
  overviewColumns,
  abUpgradeColumns,
  benchmarksColumns,
} from './matchColumns.jsx';

const match = (state) => state[REDUCER_KEY].gotMatch.match;
const MatchTable = createTable(
  match,
  (state, sortState) => (sortState ? sortMatch(state) : transformMatch(state)),
  setMatchSort
);

const mapStateToProps = (state, { params }) => ({
  matchId: params.match_id,
  match: state[REDUCER_KEY].gotMatch.match,
  loading: state[REDUCER_KEY].gotMatch.loading,
  user: state[REDUCER_KEY].gotMetadata.user,
});

const mapDispatchToProps = (dispatch) => ({
  getMatch: (matchId) => dispatch(getMatch(matchId)),
});

class RequestLayer extends React.Component {
  componentDidMount() {
    this.props.getMatch(this.props.routeParams.match_id);
  }

  componentWillUpdate(nextProps) {
    if (this.props.match_id !== nextProps.match_id) {
      this.props.getMatch(nextProps.match_id);
    }
  }

  render() {
    return (
      <div>
        <MatchHeader match={this.props.match} user={this.props.user} />
        <MatchTable columns={overviewColumns} />
        <MatchTable columns={abUpgradeColumns} />
        <BuildingMap match={this.props.match} loading={this.props.loading} />
        <MatchTable columns={benchmarksColumns(this.props.match)} />
      </div>
    );
  }
  // TODO party indicator
  // Overall (stacks/stuns/dead/biggest hit)
  // Laning (lane, eff/lh/dn, lane map)
  // skills (casts/hits/damage)
  // items (casts/hits/damage)
  // purchase counts
  // purchase times
  // Hero kill times
  // Ward maps
  // Unit kills
  // Last Hits
  // Graphs
{'fraction_non_alphanumeric': 0.15046296296296297, 'fraction_numerical': 0.0, 'mean_word_length': 3.5273573923166475, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 27, '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': '2980944', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1222, 'n_words': 257}