<commit_before>import React from 'react';
import { FormattedMessage } from 'react-intl';
import { Button, OverlayTrigger, Popover, Glyphicon } from 'react-bootstrap';

import messages from './messages';

class AllDistricts extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
  trackOpen = () => {
    mixpanel.track('all_districts_button_clicked');
  }
  render() {
    const overlay = (
      <Popover id="all-districts" title={<FormattedMessage {...messages.popoverTitle} />}>
        <FormattedMessage {...messages.popoverContent} />
      </Popover>
    );
    return (
      <OverlayTrigger rootClose trigger="click" placement="bottom" overlay={overlay}>
        <Button
          onClick={this.trackOpen}
          bsStyle="link"
        >
          <FormattedMessage {...messages.button} /> <Glyphicon glyph="chevron-right" />
        </Button>
      </OverlayTrigger>
    );
  }
}<commit_msg>Only track when all districts button is not opened yet<commit_after>import React from 'react';
import { FormattedMessage } from 'react-intl';
import { Button, OverlayTrigger, Popover, Glyphicon } from 'react-bootstrap';

import messages from './messages';

class AllDistricts extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
  constructor(props) {
    super(props);
    this.state = {
      isOpened: false,
    };
  }
  trackOpen = () => {
    this.setState({ isOpened: !this.state.isOpened });
    !this.state.isOpened && mixpanel.track('all_districts_button_clicked');
  }
  render() {
    const overlay = (
      <Popover id="all-districts" title={<FormattedMessage {...messages.popoverTitle} />}>
        <FormattedMessage {...messages.popoverContent} />
      </Popover>
    );
    return (
      <OverlayTrigger rootClose trigger="click" placement="bottom" overlay={overlay}>
        <Button
          onClick={this.trackOpen}
          bsStyle="link"
        >
          <FormattedMessage {...messages.button} /> <Glyphicon glyph="chevron-right" />
        </Button>
      </OverlayTrigger>
    );
  }
}
{'fraction_non_alphanumeric': 0.14086538461538461, 'fraction_numerical': 0.0, 'mean_word_length': 3.0803921568627453, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '923526', 'n_tokens_mistral': 624, 'n_tokens_neox': 613, 'n_words': 122}