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

import compose from 'recompose/compose';
import withHandlers from 'recompose/withHandlers';
import setPropTypes from 'recompose/setPropTypes';

import {
  passBall,
  setUserMenuPosition,
  toggleBallMenu,
  completesSession,
} from 'vclub/redux/club/sharing';

import styles from './Member.css';

const enhance = compose(

  setPropTypes({
    dispatch: PropTypes.func,
    member: PropTypes.shape({
      id: PropTypes.string.isRequired,
      master: PropTypes.bool.isRequired,
    }).isRequired,
    user: PropTypes.shape({
      id: PropTypes.string.isRequired,
      name: PropTypes.string.isRequired,
      master: PropTypes.bool.isRequired,
    }).isRequired,
    done: PropTypes.arrayOf(PropTypes.string).isRequired,
    ballPosition: PropTypes.string,
  }),

  withHandlers({
    onMemberClick: (props) => () => {
      const {
        user,
        member,
        ballPosition,
        showUserMenu,
        dispatch,
      } = props;

      if (ballPosition === member.id) {
        return;
      }
      if (user.master || user.id === ballPosition) {
        dispatch(setUserMenuPosition(showUserMenu ? null : member.id));
      }
    },

    onPassBallClick: (props) => () => {
      const { member, user, dispatch, ballPosition } = props;
      if (user.master || user.id === ballPosition) {
        dispatch(passBall(member.id));
      }
    },

    onBallClick: (props) => () => {
      const { dispatch, user } = props;
      if (user.master) {
        dispatch(toggleBallMenu(true));
      }
    },

    onCompletesSessionClick: (props) => () => {
      const { dispatch } = props;
      dispatch(completesSession());
    },
  }),
);

function Member(props) {
  const {
    member,
    ballPosition,
    done,
    showUserMenu,
    showBallMenu,
    onPassBallClick,
    onBallClick,
    onMemberClick,
    onCompletesSessionClick,
  } = props;

  const memberIsDone = done.includes(member.id);

  return (
    <div className={styles.memberContainer}><commit_msg>Hide showBallMenu after double click on a ball<commit_after>import React, { PropTypes } from 'react';

import compose from 'recompose/compose';
import withHandlers from 'recompose/withHandlers';
import setPropTypes from 'recompose/setPropTypes';

import {
  passBall,
  setUserMenuPosition,
  toggleBallMenu,
  completesSession,
} from 'vclub/redux/club/sharing';

import styles from './Member.css';

const enhance = compose(

  setPropTypes({
    dispatch: PropTypes.func,
    member: PropTypes.shape({
      id: PropTypes.string.isRequired,
      master: PropTypes.bool.isRequired,
    }).isRequired,
    user: PropTypes.shape({
      id: PropTypes.string.isRequired,
      name: PropTypes.string.isRequired,
      master: PropTypes.bool.isRequired,
    }).isRequired,
    done: PropTypes.arrayOf(PropTypes.string).isRequired,
    ballPosition: PropTypes.string,
  }),

  withHandlers({
    onMemberClick: (props) => () => {
      const {
        user,
        member,
        ballPosition,
        showUserMenu,
        dispatch,
      } = props;

      if (ballPosition === member.id) {
        return;
      }
      if (user.master || user.id === ballPosition) {
        dispatch(setUserMenuPosition(showUserMenu ? null : member.id));
      }
    },

    onPassBallClick: (props) => () => {
      const { member, user, dispatch, ballPosition } = props;
      if (user.master || user.id === ballPosition) {
        dispatch(passBall(member.id));
      }
    },

    onBallClick: (props) => () => {
      const { dispatch, user, showBallMenu, member } = props;
      if (user.master) {
        dispatch(toggleBallMenu(showBallMenu ? null : member.id));
      }
    },

    onCompletesSessionClick: (props) => () => {
      const { dispatch } = props;
      dispatch(completesSession());
    },
  }),
);

function Member(props) {
  const {
    member,
    ballPosition,
    done,
    showUserMenu,
    showBallMenu,
    onPassBallClick,
    onBallClick,
    onMemberClick,
    onCompletesSessionClick,
  } = props;

  const memberIsDone = done.includes(member.id);

  return (
    <div className={styles.memberContainer}>
{'fraction_non_alphanumeric': 0.12800192122958692, 'fraction_numerical': 0.0, 'mean_word_length': 2.776065276518586, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '6946552', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1269, 'n_words': 254}