<commit_before>import React, { Component } from 'react';
import {
    IconButton,
    Popper,
    Paper,
    ClickAwayListener,
    MenuItem,
    MenuList,
    Fade,
    // ListItemIcon,
    // ListItemText,
    // Divider,
} from '@material-ui/core';
import AccountCircle from '@material-ui/icons/AccountCircle';
// import NightMode from '@material-ui/icons/Brightness2';
import { withStyles } from '@material-ui/core/styles';
import { Link } from 'react-router-dom';
// import qs from 'qs';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';

const styles = theme => ({
    profileMenu: {
        zIndex: theme.zIndex.modal + 1,
        paddingTop: '5px',
    },
    userLink: {
        color: theme.palette.getContrastText(theme.palette.background.appBar),
        fontSize: theme.typography.fontSize,
        textTransform: 'uppercase',
    },
    accountIcon: {
        marginRight: 10,
    },
});

/**
 * Render the User Avatar with their name inside the Top AppBar component
 *
 * @class Avatar
 * @extends {Component}
 */
class Avatar extends Component {
    /**
     *Creates an instance of Avatar.
     * @param {Object} props @inheritdoc
     * @memberof Avatar
     */
    constructor(props) {
        super(props);
        this.state = {
            openMenu: false,
            profileIcon: null,
        };
        this.toggleMenu = this.toggleMenu.bind(this);
    }

    /**
     *
     * Open and Close (Toggle) Avatar dropdown menu
     * @param {React.SyntheticEvent} event `click` event on Avatar
     * @memberof Avatar
     */
    toggleMenu(event) {
        this.setState({
            openMenu: !this.state.openMenu,
            profileIcon: event.currentTarget,
        });
    }

    /**
     * Do OIDC logout redirection
     * @param {React.SyntheticEvent} e Click event of the submit button
     */
    doOIDCLogout = (e) => {
        e.preventDefault();
        window.location = '/publisher-new/services/logout';
    };

    /**
     *
     * @inheritdoc
     * @returns {React.Component} @inheritdoc
     * @memberof Avatar
     */
    render() {
        const { classes, user } = this.props;
        // const { pathname } = window.location;
        // const params = qs.stringify({
        //     referrer: pathname.split('/').reduce((acc, cv, ci) => (ci <= 1 ? '' : acc + '/' + cv)),
        // });
        const { openMenu, profileIcon } = this.state;
        return (
            <React.Fragment>
                <IconButton
                    id='profile-menu-btn'
                    aria-owns='profile-menu-appbar'<commit_msg>Fix login button click issue<commit_after>import React, { Component } from 'react';
import {
    IconButton,
    Popper,
    Paper,
    ClickAwayListener,
    MenuItem,
    MenuList,
    Fade,
    // ListItemIcon,
    // ListItemText,
    // Divider,
} from '@material-ui/core';
import AccountCircle from '@material-ui/icons/AccountCircle';
// import NightMode from '@material-ui/icons/Brightness2';
import { withStyles } from '@material-ui/core/styles';
import { Link } from 'react-router-dom';
// import qs from 'qs';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';

const styles = theme => ({
    profileMenu: {
        zIndex: theme.zIndex.modal + 1,
        paddingTop: '5px',
    },
    userLink: {
        color: theme.palette.getContrastText(theme.palette.background.appBar),
        fontSize: theme.typography.fontSize,
        textTransform: 'uppercase',
    },
    accountIcon: {
        marginRight: 10,
    },
});

/**
 * Render the User Avatar with their name inside the Top AppBar component
 *
 * @class Avatar
 * @extends {Component}
 */
class Avatar extends Component {
    /**
     *Creates an instance of Avatar.
     * @param {Object} props @inheritdoc
     * @memberof Avatar
     */
    constructor(props) {
        super(props);
        this.state = {
            openMenu: false,
            profileIcon: null,
        };
        this.toggleMenu = this.toggleMenu.bind(this);
    }

    /**
     *
     * Open and Close (Toggle) Avatar dropdown menu
     * @param {React.SyntheticEvent} event `click` event on Avatar
     * @memberof Avatar
     */
    toggleMenu(event) {
        if (event.currentTarget.type === 'button') {
            this.setState({
                openMenu: !this.state.openMenu,
                profileIcon: event.currentTarget,
            });
        }
    }

    /**
     * Do OIDC logout redirection
     * @param {React.SyntheticEvent} e Click event of the submit button
     */
    doOIDCLogout = (e) => {
        e.preventDefault();
        window.location = '/publisher-new/services/logout';
    };

    /**
     *
     * @inheritdoc
     * @returns {React.Component} @inheritdoc
     * @memberof Avatar
     */
    render() {
        const { classes, user } = this.props;
        // const { pathname } = window.location;
        // const params = qs.stringify({
        //     referrer: pathname.split('/').reduce((acc, cv, ci) => (ci <= 1 ? '' : acc + '/' + cv)),
        // });
        const { openMenu, profileIcon } = this.state;
        return (
            <React.Fragment>
                <IconButton
                    id='profile-menu-btn'
                    aria-owns='profile-menu-appbar'
{'fraction_non_alphanumeric': 0.13213610586011343, 'fraction_numerical': 0.002268431001890359, 'mean_word_length': 2.0495677233429395, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '1470940', 'n_tokens_mistral': 1603, 'n_tokens_neox': 1588, 'n_words': 364}