<commit_before>// @flow

const React = require('react');
const { connect } = require('react-redux');

const { touchSquare } = require('../actions');
const { BOARD_TYPES, PARAMETERS } = require('../immutable/constants');
const { createNewPlacementState } = require('../state-models/placement');
const Board = require('../components/Board');
const SquareMatrix = require('../components/SquareMatrix');


class SortieBoard extends React.Component {
  render() {
    const squareMatrix = React.createElement(SquareMatrix, {
      squareMatrix: this.props.squareMatrix,
      cursorCoordinate: this.props.cursorCoordinate,
      unitsOnSquares: this.props.unitsOnSquares,
      handleTouchStartPad: this.props.handleTouchStartPad,
    });

    return React.createElement(Board, {
      rowLength: PARAMETERS.SORTIE_BOARD_ROW_LENGTH,
      columnLength: PARAMETERS.SORTIE_BOARD_COLUMN_LENGTH,
      additionalClassNames: ['root__recruitment-board'],
      children: squareMatrix,
    });
  }
}

const mapStateToProps = (state) => {
  const cursorCoordinate =
    state.cursor.placement && state.cursor.placement.boardType === BOARD_TYPES.SORTIE_BOARD ?
      state.cursor.placement.coordinate : null;

  const unitsOnSquares =
    state.allies.filter(ally => ally.placement.boardType === state.sortieBoard.boardType);

  return {
    cursorCoordinate,
    squareMatrix: state.sortieBoard.squareMatrix,
    unitsOnSquares,
  };
};

const mapDispatchToProps = (dispatch, ownProps) => {
  return {
    handleTouchStartPad: (event, { coordinate }) => {
      const placement = createNewPlacementState(BOARD_TYPES.SORTIE_BOARD, coordinate);
      dispatch(touchSquare(placement));
    },
  };<commit_msg>I gave up applying Flow to `connect` of react-redux<commit_after>const React = require('react');
const { connect } = require('react-redux');

const { touchSquare } = require('../actions');
const { BOARD_TYPES, PARAMETERS } = require('../immutable/constants');
const { createNewPlacementState } = require('../state-models/placement');
const Board = require('../components/Board');
const SquareMatrix = require('../components/SquareMatrix');


class SortieBoard extends React.Component {
  render() {
    const squareMatrix = React.createElement(SquareMatrix, {
      squareMatrix: this.props.squareMatrix,
      cursorCoordinate: this.props.cursorCoordinate,
      unitsOnSquares: this.props.unitsOnSquares,
      handleTouchStartPad: this.props.handleTouchStartPad,
    });

    return React.createElement(Board, {
      rowLength: PARAMETERS.SORTIE_BOARD_ROW_LENGTH,
      columnLength: PARAMETERS.SORTIE_BOARD_COLUMN_LENGTH,
      additionalClassNames: ['root__recruitment-board'],
      children: squareMatrix,
    });
  }
}

const mapStateToProps = (state) => {
  const cursorCoordinate =
    state.cursor.placement && state.cursor.placement.boardType === BOARD_TYPES.SORTIE_BOARD ?
      state.cursor.placement.coordinate : null;

  const unitsOnSquares =
    state.allies.filter(ally => ally.placement && ally.placement.boardType === state.sortieBoard.boardType);

  return {
    cursorCoordinate,
    squareMatrix: state.sortieBoard.squareMatrix,
    unitsOnSquares,
  };
};

const mapDispatchToProps = (dispatch, ownProps) => {
  return {
    handleTouchStartPad: (event, eventData) => {
      const placement = createNewPlacementState(BOARD_TYPES.SORTIE_BOARD, eventData.coordinate);
      dispatch(touchSquare(placement));
    },
  };
{'fraction_non_alphanumeric': 0.1245272039569392, 'fraction_numerical': 0.0, 'mean_word_length': 4.297380585516179, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3841414', 'n_tokens_mistral': 1030, 'n_tokens_neox': 1023, 'n_words': 173}