<commit_before>import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { IconButton } from '@mui/material';
import RemoveCircle from '@mui/icons-material/RemoveCircle';

const styles = {
  formButton: {
    padding: '0.25em 0.4em',
  },
};

const UnsubmitButton = (props) => {
  const isUnsubmitting =
    useSelector(
      (state) =>
        state.surveysFlags && state.surveysFlags.isUnsubmittingResponse,
    ) || false;
  return (
    <>
      <span className="unsubmit-button" data-for="unsubmit-button" data-tip>
        <IconButton
          id={`unsubmit-button-${props.buttonId}`}
          disabled={isUnsubmitting || props.isUnsubmitting}
          onClick={() =>
            props.setState({
              ...props.state,
              unsubmitConfirmation: true,
            })
          }
          size="large"
          style={styles.formButton}
        >
          <RemoveCircle
            htmlColor={
              isUnsubmitting || props.isUnsubmitting ? undefined : props.color
            }
          />
        </IconButton>
      </span>
    </>
  );
};

UnsubmitButton.propTypes = {
  buttonId: PropTypes.number.isRequired,
  color: PropTypes.string.isRequired,
  isUnsubmitting: PropTypes.bool.isRequired,
  setState: PropTypes.func.isRequired,
  state: PropTypes.object.isRequired,
};

export default UnsubmitButton;<commit_msg>refactor(surveysChipIcons): Fix test by adding dummy store, fix linting<commit_after>import { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { IconButton } from '@mui/material';
import RemoveCircle from '@mui/icons-material/RemoveCircle';

const styles = {
  formButton: {
    padding: '0.25em 0.4em',
  },
};

class UnsubmitButton extends Component {
  render() {
    const { isUnsubmitting } = this.props;
    return (
      <>
        <span className="unsubmit-button" data-for="unsubmit-button" data-tip>
          <IconButton
            id={`unsubmit-button-${this.props.buttonId}`}
            disabled={isUnsubmitting}
            onClick={() =>
              this.props.setState({
                ...this.props.state,
                unsubmitConfirmation: true,
              })
            }
            size="large"
            style={styles.formButton}
          >
            <RemoveCircle
              htmlColor={isUnsubmitting ? undefined : this.props.color}
            />
          </IconButton>
        </span>
      </>
    );
  }
}

UnsubmitButton.propTypes = {
  buttonId: PropTypes.number.isRequired,
  color: PropTypes.string.isRequired,
  isUnsubmitting: PropTypes.bool.isRequired,
  setState: PropTypes.func.isRequired,
  state: PropTypes.object.isRequired,
};

export default connect((state, ownProps) => ({
  isUnsubmitting: state.surveysFlags
    ? state.surveysFlags.isUnsubmittingResponse
    : ownProps.isUnsubmitting,
}))(UnsubmitButton);
{'fraction_non_alphanumeric': 0.12440027416038382, 'fraction_numerical': 0.003427004797806717, 'mean_word_length': 2.4300822561692126, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 22, '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': '6438762', 'n_tokens_mistral': 877, 'n_tokens_neox': 875, 'n_words': 152}