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

import { resizeImage } from '../../lib/utils';

import { EXPENSE_STATUS } from '../../constants/expenses';

import Currency from '../../components/Currency';
import ReceiptPreview from '../../components/ReceiptPreview';
import ApproveButton from '../../components/ApproveButton';
import RejectButton from '../../components/RejectButton';
import PayButton from '../../components/PayButton';


const CollectiveExpenseItem = ({ 
  expense, 
  user, 
  i18n,
  compact,
  canApproveOrReject,
  canPay, 
  onApprove,
  onReject,
  onPay,
  authenticatedUser,
  approveInProgress,
  rejectInProgress,
  payInProgress
}) => {

  const canViewReceipt = canApproveOrReject || (authenticatedUser && authenticatedUser.id === expense.UserId);

  // compute which actions to show
  const showApprove = !compact && canApproveOrReject && expense.status === EXPENSE_STATUS.PENDING;
  const showReject = !compact && canApproveOrReject && expense.status === EXPENSE_STATUS.PENDING;
  const showPay = !compact && canPay && expense.status === EXPENSE_STATUS.APPROVED;

  const updateInProgress = approveInProgress[expense.id] || rejectInProgress[expense.id] || payInProgress[expense.id];

  let src, srcSet, href, receiptMessage, receiptHelpTip;

  let submittedByName = user && user.name;

  // show email only if the user can view receipt
  if (canViewReceipt) {
    submittedByName = user && user.name && user.email ? `${user.name} - ${user.email}` : `${user.email}`;
  }

  if (canViewReceipt && expense.attachment) {
    src = resizeImage(expense.attachment, { width: 240 });
    srcSet = resizeImage(expense.attachment, { width: 480 });
    href = expense.attachment;
    receiptMessage = '';
    receiptHelpTip = i18n.getString('validReceiptHelpTip');
  } else {
    src='/static/svg/ticket.svg';
    href = '';<commit_msg>show paypalEmail if available<commit_after>import React, {PropTypes} from 'react';
import ReactTooltip from 'react-tooltip';

import { resizeImage } from '../../lib/utils';

import { EXPENSE_STATUS } from '../../constants/expenses';

import Currency from '../../components/Currency';
import ReceiptPreview from '../../components/ReceiptPreview';
import ApproveButton from '../../components/ApproveButton';
import RejectButton from '../../components/RejectButton';
import PayButton from '../../components/PayButton';


const CollectiveExpenseItem = ({ 
  expense, 
  user, 
  i18n,
  compact,
  canApproveOrReject,
  canPay, 
  onApprove,
  onReject,
  onPay,
  authenticatedUser,
  approveInProgress,
  rejectInProgress,
  payInProgress
}) => {

  const canViewReceipt = canApproveOrReject || (authenticatedUser && authenticatedUser.id === expense.UserId);

  // compute which actions to show
  const showApprove = !compact && canApproveOrReject && expense.status === EXPENSE_STATUS.PENDING;
  const showReject = !compact && canApproveOrReject && expense.status === EXPENSE_STATUS.PENDING;
  const showPay = !compact && canPay && expense.status === EXPENSE_STATUS.APPROVED;

  const updateInProgress = approveInProgress[expense.id] || rejectInProgress[expense.id] || payInProgress[expense.id];

  const userEmail = user && (user.paypalEmail || user.email);

  let src, srcSet, href, receiptMessage, receiptHelpTip;

  let submittedByName = user && user.name;

  // show email only if the user can view receipt
  if (canViewReceipt) {
    submittedByName = user && user.name && userEmail ? `${user.name} - ${userEmail}` : `${userEmail}`;
  }

  if (canViewReceipt && expense.attachment) {
    src = resizeImage(expense.attachment, { width: 240 });
    srcSet = resizeImage(expense.attachment, { width: 480 });
    href = expense.attachment;
    receiptMessage = '';
    receiptHelpTip = i18n.getString('validReceiptHelpTip');
  } else {
    src='/static/svg/ticket.svg';
    href = '';
{'fraction_non_alphanumeric': 0.1395169578622816, 'fraction_numerical': 0.0051387461459403904, 'mean_word_length': 4.17686170212766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5829412', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1185, 'n_words': 274}