<commit_before>import * as React from 'react';
import { MaybeAccount, RootState } from '../../types';
import { connect, Dispatch } from 'react-redux';
import DisconectedAccount from './DisconnectedAccount';
import ConnectedAccountLayout from './ConnectedAccountLayout';
import {
  connectAccountRequest,
  ConnectAccountRequest
} from '../../actions/connectAccount';
import { TabIndex } from 'constants/enums';

interface Props {
  readonly selectedTabIndex: number;
  readonly account: MaybeAccount;
}

interface Handlers {
  readonly onConnect: () => void;
}

class Account extends React.PureComponent<Props & Handlers, never> {
  componentWillReceiveProps({ selectedTabIndex }: Props & Handlers) {
    if (
      this.props.selectedTabIndex !== selectedTabIndex &&
      this.props.account &&
      selectedTabIndex === TabIndex.ACCOUNT
    ) {
      this.props.onConnect();
    }
  }

  public render() {
    return !this.props.account ? (
      <DisconectedAccount />
    ) : (
      <ConnectedAccountLayout />
    );
  }
}

const mapState = (state: RootState): Props => ({
  selectedTabIndex: state.tab,
  account: state.account
});

const mapDispatch = (dispatch: Dispatch<ConnectAccountRequest>): Handlers => ({
  onConnect: () => dispatch(connectAccountRequest())
});

export default connect(mapState, mapDispatch)(Account);<commit_msg>Remove unnecessary negation.<commit_after>import * as React from 'react';
import { MaybeAccount, RootState } from '../../types';
import { connect, Dispatch } from 'react-redux';
import DisconectedAccount from './DisconnectedAccount';
import ConnectedAccountLayout from './ConnectedAccountLayout';
import {
  connectAccountRequest,
  ConnectAccountRequest
} from '../../actions/connectAccount';
import { TabIndex } from 'constants/enums';

interface Props {
  readonly selectedTabIndex: number;
  readonly account: MaybeAccount;
}

interface Handlers {
  readonly onConnect: () => void;
}

class Account extends React.PureComponent<Props & Handlers, never> {
  componentWillReceiveProps({ selectedTabIndex }: Props & Handlers) {
    if (
      this.props.selectedTabIndex !== selectedTabIndex &&
      this.props.account &&
      selectedTabIndex === TabIndex.ACCOUNT
    ) {
      this.props.onConnect();
    }
  }

  public render() {
    return this.props.account ? (
      <ConnectedAccountLayout />
    ) : (
      <DisconectedAccount />
    );
  }
}

const mapState = (state: RootState): Props => ({
  selectedTabIndex: state.tab,
  account: state.account
});

const mapDispatch = (dispatch: Dispatch<ConnectAccountRequest>): Handlers => ({
  onConnect: () => dispatch(connectAccountRequest())
});

export default connect(mapState, mapDispatch)(Account);
{'fraction_non_alphanumeric': 0.128698224852071, 'fraction_numerical': 0.0, 'mean_word_length': 4.142585551330798, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '2629020', 'n_tokens_mistral': 745, 'n_tokens_neox': 754, 'n_words': 177}