<commit_before>import React, { PropTypes } from 'react';
import purebem from 'purebem';

import Avatar from './Avatar';
import NavLink from './NavLink';


const block = purebem.of('user');

const User = React.createClass({

    propTypes: {
        data: PropTypes.object.isRequired,
        isExpanded: PropTypes.bool.isRequired,
        onClick: PropTypes.func.isRequired,
    },

    renderDropdown() {
        if (!this.props.isExpanded) {
            return null;
        }

        return (
            <nav className={ block('links') }>
                <NavLink baseClass={ block('link') } to="/profile">Home</NavLink>
                <NavLink baseClass={ block('link', ['logout']) } to="/login">Logout</NavLink>
            </nav>
        );
    },

    render() {
        const { profileImageURL, email } = this.props.data;
        const { isExpanded } = this.props;

        return (
            <div className={ block({ active: isExpanded }) } onClick={ () => this.props.onClick(!isExpanded) }>
                <Avatar className={ block('avatar') } url={ profileImageURL } />
                <div className={ block('name') }>{ email }</div>
                { this.renderDropdown() }
            </div>
        );
    }
});

export default User;<commit_msg>displayName added to User to display name instead of email if possible<commit_after>import React, { PropTypes } from 'react';
import purebem from 'purebem';

import Avatar from './Avatar';
import NavLink from './NavLink';


const block = purebem.of('user');

const User = React.createClass({

    propTypes: {
        data: PropTypes.object.isRequired,
        isExpanded: PropTypes.bool.isRequired,
        onClick: PropTypes.func.isRequired,
    },

    renderDropdown() {
        if (!this.props.isExpanded) {
            return null;
        }

        return (
            <nav className={ block('links') }>
                <NavLink baseClass={ block('link') } to="/profile">Home</NavLink>
                <NavLink baseClass={ block('link', ['logout']) } to="/login">Logout</NavLink>
            </nav>
        );
    },

    render() {
        const { displayName, email, profileImageURL } = this.props.data;
        const { isExpanded } = this.props;

        return (
            <div className={ block({ active: isExpanded }) } onClick={ () => this.props.onClick(!isExpanded) }>
                <Avatar className={ block('avatar') } url={ profileImageURL } />
                <div className={ block('name') }>{ displayName || email }</div>
                { this.renderDropdown() }
            </div>
        );
    }
});

export default User;
{'fraction_non_alphanumeric': 0.14929362352042763, 'fraction_numerical': 0.0, 'mean_word_length': 2.1680773881499396, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, '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': '3911211', 'n_tokens_mistral': 755, 'n_tokens_neox': 739, 'n_words': 172}