<commit_before>import React from 'react';
import { get } from 'lodash';
import Menu from '@material-ui/core/Menu';
import IconButton from '@material-ui/core/IconButton';
import Avatar from '@material-ui/core/Avatar';
import { string, func, shape } from 'prop-types';

import InnerProfileMenu from './InnerProfileMenu';

export default class ProfileMenu extends React.Component {
  static propTypes = {
    className: string,
    onLogout: func.isRequired,
    user: shape({
      userName: string,
      kvp: shape({
        firstName: string,
        lastName: string,
        image: string
      })
    })
  };

  state = {
    open: false,
    anchorEl: null
  };

  openMenu = event => {
    this.setState({ open: true, anchorEl: event.currentTarget });
  };

  closeMenu = () => {
    this.setState({
      open: false
    });
  };

  handleLogout = () => {
    this.props.onLogout();
  };

  handleEditProfile = () => {
    // fixme: show edit profile modal
    window.location =
      'https://enterprise.veritone.com/switch-app/default/edit-profile';
  };

  render() {
    const userProfileImage =<commit_msg>avoid errors from undefined user<commit_after>import React from 'react';
import { get } from 'lodash';
import Menu from '@material-ui/core/Menu';
import IconButton from '@material-ui/core/IconButton';
import Avatar from '@material-ui/core/Avatar';
import { string, func, shape } from 'prop-types';

import InnerProfileMenu from './InnerProfileMenu';

export default class ProfileMenu extends React.Component {
  static propTypes = {
    className: string,
    onLogout: func.isRequired,
    user: shape({
      userName: string,
      kvp: shape({
        firstName: string,
        lastName: string,
        image: string
      })
    })
  };

  static defaultProps = {
    user: {}
  };

  state = {
    open: false,
    anchorEl: null
  };

  openMenu = event => {
    this.setState({ open: true, anchorEl: event.currentTarget });
  };

  closeMenu = () => {
    this.setState({
      open: false
    });
  };

  handleLogout = () => {
    this.props.onLogout();
  };

  handleEditProfile = () => {
    // fixme: show edit profile modal
    window.location =
      'https://enterprise.veritone.com/switch-app/default/edit-profile';
  };

  render() {
    const userProfileImage =
{'fraction_non_alphanumeric': 0.13695652173913042, 'fraction_numerical': 0.0, 'mean_word_length': 2.81592039800995, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '6987644', 'n_tokens_mistral': 714, 'n_tokens_neox': 697, 'n_words': 173}