<commit_before>// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP

import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { logout } from '../actions';
import Menu from 'grommet/components/Menu';
import Gravatar from 'react-gravatar';
import Drop from 'grommet/utils/Drop';

class SessionMenu extends Component {

  constructor() {
    super();
    this._onLogout = this._onLogout.bind(this);
  }

  _onLogout(event) {
    console.log('click callback');
    event.preventDefault();
    this.props.dispatch(logout());
  }

  render() {
    const { session: {email}, dropAlign } = this.props;
    var icon = <Gravatar email={email || ''} default="mm"/>;
    return (
      <Menu icon={icon} dropAlign={dropAlign} a11yTitle="Open Session Menu">
        <a tabIndex="0" href="#" onClick={this._onLogout}>Logout</a>
      </Menu>
    );
  }

}

SessionMenu.propTypes = {
  dropAlign: Drop.alignPropType,
  session: PropTypes.shape({
    email: PropTypes.string
  })
};

SessionMenu.defaultProps = {
  direction: 'down'
};

let select = (state) => ({session: state.session});

export default connect(select)(SessionMenu);<commit_msg>Added anchor to logout menu.<commit_after>// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP

import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { logout } from '../actions';
import Menu from 'grommet/components/Menu';
import Anchor from 'grommet/components/Anchor';
import Gravatar from 'react-gravatar';
import Drop from 'grommet/utils/Drop';

class SessionMenu extends Component {

  constructor() {
    super();
    this._onLogout = this._onLogout.bind(this);
  }

  _onLogout(event) {
    event.preventDefault();
    this.props.dispatch(logout());
  }

  render() {
    const { session: {email}, dropAlign } = this.props;
    var icon = <Gravatar email={email || ''} default="mm"/>;
    return (
      <Menu icon={icon} dropAlign={dropAlign} a11yTitle="Open Session Menu">
        <Anchor href="#" onClick={this._onLogout}>Logout</Anchor>
      </Menu>
    );
  }

}

SessionMenu.propTypes = {
  dropAlign: Drop.alignPropType,
  session: PropTypes.shape({
    email: PropTypes.string
  })
};

SessionMenu.defaultProps = {
  direction: 'down'
};

let select = (state) => ({session: state.session});

export default connect(select)(SessionMenu);
{'fraction_non_alphanumeric': 0.1502288805659592, 'fraction_numerical': 0.008739076154806492, 'mean_word_length': 3.9669421487603307, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6416921', 'n_tokens_mistral': 764, 'n_tokens_neox': 743, 'n_words': 182}