<commit_before>import { compose } from 'redux';
import { connect } from 'react-redux';
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import MenuItem from 'react-bootstrap/lib/MenuItem';
import Button from 'react-bootstrap/lib/Button';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
import Popover from 'react-bootstrap/lib/Popover';
import FontAwesomeIcon from 'fm3/components/FontAwesomeIcon';
import { setTool } from 'fm3/actions/mainActions';
import injectL10n from 'fm3/l10nInjector';

function ToolsMenuButton({ t, tool, expertMode, onToolSet }) {
  const handleToolSelect = useCallback((tool1) => {
    onToolSet(tool1);
  }, [onToolSet]);

  return (
    <OverlayTrigger
      placement="bottom"
      trigger="focus"
      overlay={(
        <Popover id="popover-trigger-click-root-close" className="fm-menu">
          <ul>
            {
              [
                ['route-planner', 'map-signs', 'routePlanner'],
                ['objects', 'map-marker', 'objects'],
                ['gallery', 'picture-o', 'gallery'],
                ['measure-dist', '!icon-ruler', 'measurement'],
                ['track-viewer', 'road', 'trackViewer'],
                ['info-point', 'thumb-tack', 'infoPoint'],
                ['map-details', 'info', 'mapDetails'],
                expertMode && ['changesets', 'pencil', 'changesets'],
              ].filter(x => x).map(([newTool, icon, name]) => (
                <MenuItem
                  key={newTool}
                  onClick={() => handleToolSelect(newTool)}
                  active={tool === newTool}
                >
                  <FontAwesomeIcon icon={icon} /> {t(`tools.${name}`)}
                </MenuItem>
              ))
            }
          </ul>
        </Popover>
      )}
    >
      <Button title={t('tools.tools')} id="tools-button">
        <FontAwesomeIcon icon="briefcase" />
      </Button>
    </OverlayTrigger>
  );
}

ToolsMenuButton.propTypes = {<commit_msg>cleanup<commit_after>import { compose } from 'redux';
import { connect } from 'react-redux';
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import MenuItem from 'react-bootstrap/lib/MenuItem';
import Button from 'react-bootstrap/lib/Button';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
import Popover from 'react-bootstrap/lib/Popover';
import FontAwesomeIcon from 'fm3/components/FontAwesomeIcon';
import { setTool } from 'fm3/actions/mainActions';
import injectL10n from 'fm3/l10nInjector';

function ToolsMenuButton({ t, tool, expertMode, onToolSet }) {
  const handleToolSelect = useCallback(({ target: { dataset } }) => {
    onToolSet(dataset.tool);
  }, [onToolSet]);

  return (
    <OverlayTrigger
      placement="bottom"
      trigger="focus"
      overlay={(
        <Popover id="popover-trigger-click-root-close" className="fm-menu">
          <ul>
            {
              [
                ['route-planner', 'map-signs', 'routePlanner'],
                ['objects', 'map-marker', 'objects'],
                ['gallery', 'picture-o', 'gallery'],
                ['measure-dist', '!icon-ruler', 'measurement'],
                ['track-viewer', 'road', 'trackViewer'],
                ['info-point', 'thumb-tack', 'infoPoint'],
                ['map-details', 'info', 'mapDetails'],
                expertMode && ['changesets', 'pencil', 'changesets'],
              ].filter(x => x).map(([newTool, icon, name]) => (
                <MenuItem
                  key={newTool}
                  data-tool={newTool}
                  onClick={handleToolSelect}
                  active={tool === newTool}
                >
                  <FontAwesomeIcon icon={icon} /> {t(`tools.${name}`)}
                </MenuItem>
              ))
            }
          </ul>
        </Popover>
      )}
    >
      <Button title={t('tools.tools')} id="tools-button">
        <FontAwesomeIcon icon="briefcase" />
      </Button>
    </OverlayTrigger>
  );
}

ToolsMenuButton.propTypes = {
{'fraction_non_alphanumeric': 0.15745310957551825, 'fraction_numerical': 0.003948667324777887, 'mean_word_length': 2.2294820717131474, 'pattern_counts': {'":': 0, '<': 27, '<?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': '4312353', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1149, 'n_words': 230}