<commit_before>import React, { Component, PropTypes } from 'react';
import { browserHistory, Link } from 'react-router';
import _ from 'lodash';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { autobind } from 'core-decorators';
import { Dropdown, Icon, Menu, Modal } from 'antd';
import * as actions from './redux/actions';
import { SearchInput } from '../common';
import { showCmdDialog } from '../rekit-cmds/redux/actions';
import { About, ProjectExplorer } from './';

export class SidePanel extends Component {
  static propTypes = {
    home: PropTypes.object.isRequired,
    actions: PropTypes.object.isRequired,
  };

  state = {
    searchKey: null,
    aboutDialogVisible: true,
  };

  @autobind
  showAbout() {
    this.setState({
      aboutDialogVisible: true,
    });
  }

  @autobind
  hideAbout() {
    this.setState({
      aboutDialogVisible: false,
    });
  }

  @autobind
  handleAddMenuClick(evt) {
    switch (evt.key) {
      case 'add-feature':
      case 'add-component':
      case 'add-action':
        this.props.actions.showCmdDialog('cmd', {
          type: evt.key,
          ...this.cmdContext,
        });
        break;
      case 'build':
        browserHistory.push('/tools/build');
        break;
      case 'tests':
        browserHistory.push('/tools/tests');
        break;
      case 'test-coverage':
        browserHistory.push('/tools/coverage');
        break;
      case 'about':
        this.showAbout();
        break;
      default:
        break;
    }
  }

  @autobind
  handleSearch(key) {
    this.setState({
      searchKey: key,
    });
  }

  @autobind
  renderAddMenu() {
    return (
      <Menu onClick={this.handleAddMenuClick}>
        <Menu.Item key="add-feature"><Icon type="book" style={{ color: '#29b6f6' }} /> &nbsp;Add feature</Menu.Item>
        <Menu.Item key="add-action"><Icon type="notification" style={{ color: '#ec407a' }} /> &nbsp;Add action</Menu.Item>
        <Menu.Item key="add-component"><Icon type="appstore-o" style={{ color: '#F08036' }} /> &nbsp;Add component</Menu.Item>
        <Menu.Item key="tests"><Icon type="appstore-o" style={{ color: 'transparent' }} /> &nbsp;Run tests</Menu.Item>
        <Menu.Item key="test-coverage"><Icon type="appstore-o" style={{ color: 'transparent' }} /> &nbsp;Test coverage</Menu.Item>
        <Menu.Item key="build"><Icon type="appstore-o" style={{ color: 'transparent' }} /> &nbsp;Build</Menu.Item>
        <Menu.Item key="about"><Icon type="appstore-o" style={{ color: 'transparent' }} /> &nbsp;About</Menu.Item>
      </Menu>
    );
  }

  render() {
    const { home } = this.props;
    const prjName = home.projectName || home.projectRoot.split('/').pop();
    return (
      <div className="home-side-panel">
        <div className="header">
          <Link className="home-link" to="/" title={this.props.home.projectRoot}>
            <h5><Icon type="home" /> {prjName}</h5>
          </Link>
          <Dropdown overlay={this.renderAddMenu()}>
            <label>
              <Icon type="ellipsis" style={{ fontSize: '20px', fontWeight: 'bold' }} />
            </label>
          </Dropdown>
        </div>
        <div className="toolbar">
          <SearchInput onSearch={this.handleSearch} />
        </div>
        <ProjectExplorer searchKey={this.state.searchKey} />
        {this.state.aboutDialogVisible &&
          <Modal
            // visible
            maskClosable
            title=""
            footer=""
            width={1||process.env.NODE_ENV === 'demo' ? '760px' : '360px'}

            onClose={this.hideAbout}
            style={{ top: '50px' }}
          >
            <About />
          </Modal>
        }
      </div>
    );
  }
}

/* istanbul ignore next */
function mapStateToProps(state) {
  return {
    home: state.home,
  };
}

/* istanbul ignore next */
function mapDispatchToProps(dispatch) {
  return {
    actions: bindActionCreators({ ...actions, showCmdDialog }, dispatch)
  };
}

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(SidePanel);
<commit_msg>Show about by default.<commit_after>import React, { Component, PropTypes } from 'react';
import { browserHistory, Link } from 'react-router';
import _ from 'lodash';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { autobind } from 'core-decorators';
import { Dropdown, Icon, Menu, Modal } from 'antd';
import * as actions from './redux/actions';
import { SearchInput } from '../common';
import { showCmdDialog } from '../rekit-cmds/redux/actions';
import { About, ProjectExplorer } from './';

export class SidePanel extends Component {
  static propTypes = {
    home: PropTypes.object.isRequired,
    actions: PropTypes.object.isRequired,
  };

  state = {
    searchKey: null,
    aboutDialogVisible: true,
  };

  @autobind
  showAbout() {
    this.setState({
      aboutDialogVisible: true,
    });
  }

  @autobind
  hideAbout() {
    this.setState({
      aboutDialogVisible: false,
    });
  }

  @autobind
  handleAddMenuClick(evt) {
    switch (evt.key) {
      case 'add-feature':
      case 'add-component':
      case 'add-action':
        this.props.actions.showCmdDialog('cmd', {
          type: evt.key,
          ...this.cmdContext,
        });
        break;
      case 'build':
        browserHistory.push('/tools/build');
        break;
      case 'tests':
        browserHistory.push('/tools/tests');
        break;
      case 'test-coverage':
        browserHistory.push('/tools/coverage');
        break;
      case 'about':
        this.showAbout();
        break;
      default:
        break;
    }
  }

  @autobind
  handleSearch(key) {
    this.setState({
      searchKey: key,
    });
  }

  @autobind
  renderAddMenu() {
    return (
      <Menu onClick={this.handleAddMenuClick}>
        <Menu.Item key="add-feature"><Icon type="book" style={{ color: '#29b6f6' }} /> &nbsp;Add feature</Menu.Item>
        <Menu.Item key="add-action"><Icon type="notification" style={{ color: '#ec407a' }} /> &nbsp;Add action</Menu.Item>
        <Menu.Item key="add-component"><Icon type="appstore-o" style={{ color: '#F08036' }} /> &nbsp;Add component</Menu.Item>
        <Menu.Item key="tests"><Icon type="appstore-o" style={{ color: 'transparent' }} /> &nbsp;Run tests</Menu.Item>
        <Menu.Item key="test-coverage"><Icon type="appstore-o" style={{ color: 'transparent' }} /> &nbsp;Test coverage</Menu.Item>
        <Menu.Item key="build"><Icon type="appstore-o" style={{ color: 'transparent' }} /> &nbsp;Build</Menu.Item>
        <Menu.Item key="about"><Icon type="appstore-o" style={{ color: 'transparent' }} /> &nbsp;About</Menu.Item>
      </Menu>
    );
  }

  render() {
    const { home } = this.props;
    const prjName = home.projectName || home.projectRoot.split('/').pop();
    return (
      <div className="home-side-panel">
        <div className="header">
          <Link className="home-link" to="/" title={this.props.home.projectRoot}>
            <h5><Icon type="home" /> {prjName}</h5>
          </Link>
          <Dropdown overlay={this.renderAddMenu()}>
            <label>
              <Icon type="ellipsis" style={{ fontSize: '20px', fontWeight: 'bold' }} />
            </label>
          </Dropdown>
        </div>
        <div className="toolbar">
          <SearchInput onSearch={this.handleSearch} />
        </div>
        <ProjectExplorer searchKey={this.state.searchKey} />
        {this.state.aboutDialogVisible &&
          <Modal
            visible
            maskClosable
            title=""
            footer=""
            width={1||process.env.NODE_ENV === 'demo' ? '760px' : '360px'}

            onClose={this.hideAbout}
            style={{ top: '50px' }}
          >
            <About />
          </Modal>
        }
      </div>
    );
  }
}

/* istanbul ignore next */
function mapStateToProps(state) {
  return {
    home: state.home,
  };
}

/* istanbul ignore next */
function mapDispatchToProps(dispatch) {
  return {
    actions: bindActionCreators({ ...actions, showCmdDialog }, dispatch)
  };
}

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(SidePanel);

{'fraction_non_alphanumeric': 0.16291860180884868, 'fraction_numerical': 0.006110975311659741, 'mean_word_length': 2.476210705182668, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 91, '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': '7224478', 'n_tokens_mistral': 2545, 'n_tokens_neox': 2530, 'n_words': 517}