<commit_before>import React from 'react';
import isEmpty from 'lodash/isEmpty';
import classnames from 'classnames';
import { Link } from 'routes';

// Components
import TetherComponent from 'react-tether';


export default function HeaderUser(props) {
  const { user } = props;

  if (!isEmpty(user)) {
    const activeNotificationClassName = classnames({
      '-active': !!user.notifications
    });

    const avatar = (user.avatar) ? `url(${user.avatar})` : 'none';

    return (
      <div className="c-avatar" style={{ backgroundImage: avatar }}>
        <TetherComponent
          attachment="top center"
          constraints={[{
            to: 'window'
          }]}
          targetOffset="-4px 0"
          classes={{
            element: 'c-header-dropdown'
          }}
        >
          {/* First child: This is what the item will be tethered to */}
          <Link route="myrw">
            <a
              onMouseEnter={props.onMouseEnter}
              onMouseLeave={props.onMouseLeave}
            >
              {!user.avatar && <span className="avatar-letter">{user.email.split('')[0]}</span>}
              {user.notifications && <span className={`avatar-notifications ${activeNotificationClassName}`}>{user.notifications}</span>}
            </a>
          </Link>
          {/* Second child: If present, this item will be tethered to the the first child */}
          {props.active &&
            <ul
              className="header-dropdown-list"
              onMouseEnter={props.onMouseEnter}
              onMouseLeave={props.onMouseLeave}
            ><commit_msg>Auth: check that email exists<commit_after>import React from 'react';
import isEmpty from 'lodash/isEmpty';
import classnames from 'classnames';
import { Link } from 'routes';

// Components
import TetherComponent from 'react-tether';


export default function HeaderUser(props) {
  const { user } = props;

  if (!isEmpty(user)) {
    const activeNotificationClassName = classnames({
      '-active': !!user.notifications
    });

    const avatar = (user.avatar) ? `url(${user.avatar})` : 'none';

    return (
      <div className="c-avatar" style={{ backgroundImage: avatar }}>
        <TetherComponent
          attachment="top center"
          constraints={[{
            to: 'window'
          }]}
          targetOffset="-4px 0"
          classes={{
            element: 'c-header-dropdown'
          }}
        >
          {/* First child: This is what the item will be tethered to */}
          <Link route="myrw">
            <a
              onMouseEnter={props.onMouseEnter}
              onMouseLeave={props.onMouseLeave}
            >
              {!user.avatar && <span className="avatar-letter">{user.email && user.email.split('')[0]}</span>}
              {user.notifications && <span className={`avatar-notifications ${activeNotificationClassName}`}>{user.notifications}</span>}
            </a>
          </Link>
          {/* Second child: If present, this item will be tethered to the the first child */}
          {props.active &&
            <ul
              className="header-dropdown-list"
              onMouseEnter={props.onMouseEnter}
              onMouseLeave={props.onMouseLeave}
            >
{'fraction_non_alphanumeric': 0.13205207687538748, 'fraction_numerical': 0.0018598884066955983, 'mean_word_length': 2.1575342465753424, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '4141223', 'n_tokens_mistral': 884, 'n_tokens_neox': 874, 'n_words': 207}