<commit_before>import React, { PropTypes } from 'react';
import FormModal from '../common/modal/FormModal';
import {OverlayTrigger, Tooltip} from 'react-bootstrap';

const ModalButton = (props) => {
  let buttonWithMaybeTooltip;
  let modal;
  if (props.tooltipText) {
    buttonWithMaybeTooltip = (
      <OverlayTrigger
        placement="top"
        overlay={<Tooltip id="overlay">{props.tooltipText}</Tooltip>}>
        <a onClick={() => modal.show()} >{props.buttonChildren}</a>
      </OverlayTrigger>
    );
  } else {
    buttonWithMaybeTooltip = <a onClick={() => modal.show()} >{props.buttonChildren}</a>;
  }
  return (
    <span>
      {buttonWithMaybeTooltip}
      <FormModal
        ref={modalRef => { modal = modalRef; }}
        action={props.action}
        onConfirm={(data) => props.onConfirm(data)}
        buttonStyle="danger"
        formElements={props.formElements}>
        {props.children}
      </FormModal>
    </span>
  );
};

ModalButton.propTypes = {<commit_msg>Slight ModalButton simplification<commit_after>import React, { PropTypes } from 'react';
import FormModal from '../common/modal/FormModal';
import {OverlayTrigger, Tooltip} from 'react-bootstrap';

const ModalButton = (props) => {
  let modal;
  const button = <a onClick={() => modal.show()} >{props.buttonChildren}</a>;
  let buttonWithMaybeTooltip = button;
  if (props.tooltipText) {
    buttonWithMaybeTooltip = (
      <OverlayTrigger
        placement="top"
        overlay={<Tooltip id="overlay">{props.tooltipText}</Tooltip>}>
        {button}
      </OverlayTrigger>
    );
  }
  return (
    <span>
      {buttonWithMaybeTooltip}
      <FormModal
        ref={modalRef => { modal = modalRef; }}
        action={props.action}
        onConfirm={(data) => props.onConfirm(data)}
        buttonStyle="danger"
        formElements={props.formElements}>
        {props.children}
      </FormModal>
    </span>
  );
};

ModalButton.propTypes = {
{'fraction_non_alphanumeric': 0.15167095115681234, 'fraction_numerical': 0.0, 'mean_word_length': 3.1228813559322033, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 34, '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': '5522084', 'n_tokens_mistral': 571, 'n_tokens_neox': 591, 'n_words': 110}