<commit_before>import React from 'react';
import { connect } from 'react-redux';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
import { Button, Intent, Tooltip } from '@blueprintjs/core';

import CreateCaseDialog from 'src/dialogs/CreateCaseDialog/CreateCaseDialog';
import { selectSession } from 'src/selectors';

const messages = defineMessages({
  login: {
    id: 'case.create.login',
    defaultMessage: 'You must sign in to upload your own data.',
  },
});


class CaseCreateButton extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isOpen: false,
    };
    this.toggle = this.toggle.bind(this);
  }

  toggle() {
    this.setState(({ isOpen }) => ({ isOpen: !isOpen }));
  }

  render() {
    const { intl, session } = this.props;
    if (!session.loggedIn) {
      return (
        <Tooltip content={intl.formatMessage(messages.login)}>
          <Button icon="folder-new" intent={Intent.PRIMARY} disabled>
            <FormattedMessage id="cases.index.create" defaultMessage="New dataset" />
          </Button>
        </Tooltip>
      );
    }
    return (
      <React.Fragment>
        <Button onClick={this.toggle} icon="folder-new" intent={Intent.PRIMARY}>
          <FormattedMessage id="cases.index.create" defaultMessage="New dataset" />
        </Button>
        <CreateCaseDialog
          isOpen={this.state.isOpen}
          toggleDialog={this.toggle}
        />
      </React.Fragment>
    );
  }
}

const mapStateToProps = state => ({ session: selectSession(state) });

CaseCreateButton = connect(mapStateToProps)(CaseCreateButton);
CaseCreateButton = injectIntl(CaseCreateButton);
export default CaseCreateButton;
<commit_msg>Make AnchorButton to fix #769<commit_after>import React from 'react';
import { connect } from 'react-redux';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
import { Button, AnchorButton, Intent, Tooltip, Position } from '@blueprintjs/core';

import CreateCaseDialog from 'src/dialogs/CreateCaseDialog/CreateCaseDialog';
import { selectSession } from 'src/selectors';

const messages = defineMessages({
  login: {
    id: 'case.create.login',
    defaultMessage: 'You must sign in to upload your own data.',
  },
});


class CaseCreateButton extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isOpen: false,
    };
    this.toggle = this.toggle.bind(this);
  }

  toggle() {
    this.setState(({ isOpen }) => ({ isOpen: !isOpen }));
  }

  render() {
    const { intl, session } = this.props;
    if (!session.loggedIn) {
      return (
        <Tooltip
          content={intl.formatMessage(messages.login)}
          position={Position.BOTTOM}
        >
          <AnchorButton icon="folder-new" intent={Intent.PRIMARY} disabled>
            <FormattedMessage id="cases.index.create" defaultMessage="New dataset" />
          </AnchorButton>
        </Tooltip>
      );
    }
    return (
      <React.Fragment>
        <Button onClick={this.toggle} icon="folder-new" intent={Intent.PRIMARY}>
          <FormattedMessage id="cases.index.create" defaultMessage="New dataset" />
        </Button>
        <CreateCaseDialog
          isOpen={this.state.isOpen}
          toggleDialog={this.toggle}
        />
      </React.Fragment>
    );
  }
}

const mapStateToProps = state => ({ session: selectSession(state) });

CaseCreateButton = connect(mapStateToProps)(CaseCreateButton);
CaseCreateButton = injectIntl(CaseCreateButton);
export default CaseCreateButton;

{'fraction_non_alphanumeric': 0.13316441441441443, 'fraction_numerical': 0.0008445945945945946, 'mean_word_length': 3.18, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 29, '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': '6638665', 'n_tokens_mistral': 1038, 'n_tokens_neox': 1038, 'n_words': 221}