<commit_before>import { defineMessages, F, injectIntl } from '../../shared/i18n';
import HelpOutlineRoundedIcon from '@material-ui/icons/HelpOutlineRounded';
import IconButton from '@material-ui/core/IconButton';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import React, { PureComponent } from 'react';
import styles from './Help.module.css';

const messages = defineMessages({
  help: { msg: 'Help' },
});

class Help extends PureComponent {
  constructor() {
    super();

    this.state = {
      anchorEl: null,
    };
  }

  handleMenuOpenerClick = event => {
    this.setState({ anchorEl: event.currentTarget });
  };

  handleStyleguide = () => {
    this.setState({ anchorEl: null });
    window.open('http://localhost:9001', 'styleguide');
  };

  handleLanguage = () => {
    this.setState({ anchorEl: null });
    window.location.href = '/?lang=fr';
  };

  renderStyleguide() {
    // Conditionally compile this code. Should not appear in production.
    if (process.env.NODE_ENV === 'development') {
      return (
        <MenuItem key="styleguide" onClick={this.handleStyleguide}>
          Styleguide
        </MenuItem>
      );
    }<commit_msg>help: fix up menu not closing when clicking away<commit_after>import { defineMessages, F, injectIntl } from '../../shared/i18n';
import HelpOutlineRoundedIcon from '@material-ui/icons/HelpOutlineRounded';
import IconButton from '@material-ui/core/IconButton';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import React, { PureComponent } from 'react';
import styles from './Help.module.css';

const messages = defineMessages({
  help: { msg: 'Help' },
});

class Help extends PureComponent {
  constructor() {
    super();

    this.state = {
      anchorEl: null,
    };
  }

  handleMenuOpenerClick = event => {
    this.setState({ anchorEl: event.currentTarget });
  };

  handleStyleguide = () => {
    this.handleClose();
    window.open('http://localhost:9001', 'styleguide');
  };

  handleLanguage = () => {
    this.handleClose();
    window.location.href = '/?lang=fr';
  };

  handleClose = () => {
    this.setState({ anchorEl: null });
  };

  renderStyleguide() {
    // Conditionally compile this code. Should not appear in production.
    if (process.env.NODE_ENV === 'development') {
      return (
        <MenuItem key="styleguide" onClick={this.handleStyleguide}>
          Styleguide
        </MenuItem>
      );
    }
{'fraction_non_alphanumeric': 0.152, 'fraction_numerical': 0.0048, 'mean_word_length': 3.334488734835355, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, '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': '5129599', 'n_tokens_mistral': 759, 'n_tokens_neox': 753, 'n_words': 172}