<commit_before>import React, { useRef, useState } from 'react';
import { useOutsideClick } from 'helpers/hooks';
import PropTypes from 'prop-types';
import Button from 'components/Button';
import Icon from 'components/Icon';
import DropdownList from 'components/DropdownList';
import DifficultyModal from 'components/Modals/DifficultyModal';
import ErrorBoundary from 'components/Wrappers/ErrorBoundary';
import { setByUser } from 'helpers/requestHelpers';
import { connect } from 'react-redux';

StarButton.propTypes = {
  byUser: PropTypes.bool,
  contentId: PropTypes.number,
  difficulty: PropTypes.number,
  direction: PropTypes.string,
  dispatch: PropTypes.func.isRequired,
  onClick: PropTypes.func,
  onSetDifficulty: PropTypes.func,
  onToggleByUser: PropTypes.func,
  style: PropTypes.object,
  type: PropTypes.string.isRequired,
  uploader: PropTypes.object
};

function StarButton({
  byUser,
  contentId,
  difficulty,
  direction = 'left',
  dispatch,
  onSetDifficulty,
  onToggleByUser,
  uploader,
  style,
  type
}) {
  const [difficultyModalShown, setDifficultyModalShown] = useState(false);
  const [menuShown, setMenuShown] = useState(false);
  const StarButtonRef = useRef();
  useOutsideClick(StarButtonRef, () => setMenuShown(false));

  return (
    <ErrorBoundary>
      <div ref={StarButtonRef} style={style}>
        <Button
          {...(!!difficulty && byUser
            ? { gold: true }
            : byUser
            ? { wood: true }
            : { love: true })}
          filled={!!difficulty || byUser}
          onClick={onClick}
        >
          <Icon icon="star" />
        </Button>
        {menuShown && (
          <DropdownList
            direction={direction}
            style={{
              position: 'absolute',
              right: 0,<commit_msg>minor color change<commit_after>import React, { useRef, useState } from 'react';
import { useOutsideClick } from 'helpers/hooks';
import PropTypes from 'prop-types';
import Button from 'components/Button';
import Icon from 'components/Icon';
import DropdownList from 'components/DropdownList';
import DifficultyModal from 'components/Modals/DifficultyModal';
import ErrorBoundary from 'components/Wrappers/ErrorBoundary';
import { setByUser } from 'helpers/requestHelpers';
import { connect } from 'react-redux';

StarButton.propTypes = {
  byUser: PropTypes.bool,
  contentId: PropTypes.number,
  difficulty: PropTypes.number,
  direction: PropTypes.string,
  dispatch: PropTypes.func.isRequired,
  onClick: PropTypes.func,
  onSetDifficulty: PropTypes.func,
  onToggleByUser: PropTypes.func,
  style: PropTypes.object,
  type: PropTypes.string.isRequired,
  uploader: PropTypes.object
};

function StarButton({
  byUser,
  contentId,
  difficulty,
  direction = 'left',
  dispatch,
  onSetDifficulty,
  onToggleByUser,
  uploader,
  style,
  type
}) {
  const [difficultyModalShown, setDifficultyModalShown] = useState(false);
  const [menuShown, setMenuShown] = useState(false);
  const StarButtonRef = useRef();
  useOutsideClick(StarButtonRef, () => setMenuShown(false));

  return (
    <ErrorBoundary>
      <div ref={StarButtonRef} style={style}>
        <Button
          {...(!!difficulty && byUser
            ? { gold: true }
            : byUser
            ? { warning: true }
            : { love: true })}
          filled={!!difficulty || byUser}
          onClick={onClick}
        >
          <Icon icon="star" />
        </Button>
        {menuShown && (
          <DropdownList
            direction={direction}
            style={{
              position: 'absolute',
              right: 0,
{'fraction_non_alphanumeric': 0.11663902708678828, 'fraction_numerical': 0.000552791597567717, 'mean_word_length': 3.174163783160323, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '5615040', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1094, 'n_words': 241}