<commit_before>/*
 *
 * Menu
 *
 */

import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import { createStructuredSelector } from 'reselect';
import messages from './messages';
import { selectMenu } from './actions';
import { editBabyName } from 'containers/EditBabyName/actions';

export class Menu extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
  render() {
    const { menu, personChooser, onButtonClick, onBackButtonClick } = this.props;

    if (personChooser) {
      if (!menu) {
        return (
          <div>
            <h1>Menu</h1>

            <form>
              <input type="button" value={messages.addBabyName.defaultMessage} onClick={() => {
                onButtonClick("addBabyName")
              }}></input>

              <input type="button" value={messages.rateBabyName.defaultMessage} onClick={() => {
                onButtonClick("rateBabyName")
              }}></input>          

              <input type="button" value={messages.listBabyNames.defaultMessage} onClick={() => {
                onButtonClick("listBabyNames")
              }}></input>

            </form>
          </div>
        );
      }

      return (
        <form>
          <input type="button" value={messages.back.defaultMessage} onClick={() => {
            onBackButtonClick();
            onButtonClick("");
          }}></input>
        </form>
      );  
    }
    
    return null;
  }
}

Menu.propTypes = {
};

const mapStateToProps = (state) => {
  return {
    menu: state.toObject().menu,
    personChooser: state.toObject().personChooser
  };
}

function mapDispatchToProps(dispatch) {
  return {
    onButtonClick: (link) => {
      dispatch(selectMenu(link));
    },

    onBackButtonClick: () => {
      dispatch(editBabyName(""));
    }
  };
}

export default connect(mapStateToProps, mapDispatchToProps)(Menu);<commit_msg>Add list button to rate baby names page<commit_after>/*
 *
 * Menu
 *
 */

import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import { createStructuredSelector } from 'reselect';
import messages from './messages';
import { selectMenu } from './actions';
import { editBabyName } from 'containers/EditBabyName/actions';

export class Menu extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
  render() {
    const { menu, personChooser, onButtonClick, onBackButtonClick, onListButtonClick } = this.props;

    if (personChooser) {
      if (!menu) {
        return (
          <div>
            <h1>Menu</h1>

            <form>
              <input type="button" value={messages.addBabyName.defaultMessage} onClick={() => {
                onButtonClick("addBabyName")
              }}></input>

              <input type="button" value={messages.rateBabyName.defaultMessage} onClick={() => {
                onButtonClick("rateBabyName")
              }}></input>          

              <input type="button" value={messages.listBabyNames.defaultMessage} onClick={() => {
                onButtonClick("listBabyNames")
              }}></input>

            </form>
          </div>
        );
      }

      if (menu === "rateBabyName") {
        return (
          <form>
            <input type="button" value={messages.back.defaultMessage} onClick={() => {
              onBackButtonClick();
              onButtonClick("");
            }}></input>

            <input type="button" value={messages.listBabyNames.defaultMessage} onClick={() => {
              onListButtonClick();
            }}></input>
          </form>
        );
      }

      return (
        <form>
          <input type="button" value={messages.back.defaultMessage} onClick={() => {
            onBackButtonClick();
            onButtonClick("");
          }}></input>
        </form>
      );
    }
    
    return null;
  }
}

Menu.propTypes = {
};

const mapStateToProps = (state) => {
  return {
    menu: state.toObject().menu,
    personChooser: state.toObject().personChooser
  };
}

function mapDispatchToProps(dispatch) {
  return {
    onButtonClick: (link) => {
      dispatch(selectMenu(link));
    },

    onBackButtonClick: () => {
      dispatch(editBabyName(""));
    },

    onListButtonClick: () => {
      dispatch(editBabyName(""));
      dispatch(selectMenu("listBabyNames"));
    }
  };
}

export default connect(mapStateToProps, mapDispatchToProps)(Menu);
{'fraction_non_alphanumeric': 0.14632531450011035, 'fraction_numerical': 0.0008828073273008167, 'mean_word_length': 2.2557471264367814, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 58, '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': '332290', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1265, 'n_words': 241}