<commit_before>import _ from 'lodash';
import { Link } from 'react-router';
import moment from 'moment';
import PropTypes from 'prop-types';
import React from 'react';

import { appealStatusDescriptions } from '../utils/appeal-helpers';
import { getStatusContents } from '../utils/appeals-v2-helpers';

const renderNextAction = (lastEvent, previousHistory) => {
  if (lastEvent.type === 'ssoc' && previousHistory[0].type !== 'soc') {
    return null;
  }
  const nextAction = appealStatusDescriptions(lastEvent, previousHistory).nextAction;
  return nextAction && nextAction.title;
};

// TODO: Get a proper mapping of programArea -> display output
const appealTypeMap = {
  compensation: 'Compensation',
  pension: 'Pension',
  insurance: 'Insurance',
  loan_guaranty: 'Loan Guaranty', // eslint-disable-line
  education: 'Education',
  vre: 'VRE',
  medical: 'Medical',
  burial: 'Burial',
  bva: 'BVA',
  other: 'Other',
  multiple: 'Multiple',
};


export default function AppealListItem({ appeal }) {
  const { status } = appeal.attributes;
  // always show merged event on top
  const events = _.orderBy(appeal.attributes.events, [e => e.type === 'merged', e => moment(e.date).unix()], ['desc', 'desc']);
  const lastEvent = events[0];
  const firstEvent = events[events.length - 1];
  const previousHistory = events.slice(1);

  return (
    <div className="claim-list-item-container">
      <h3 className="claim-list-item-header-v2">
        Appeal of {appealTypeMap[appeal.attributes.programArea]}
        <br/>
        Decision Received {moment(firstEvent.date).format('MMMM D, YYYY')}
      </h3>
      <div className="card-status">
        <div className={`status-circle ${appeal.attributes.active ? 'open' : 'closed'}`}/>
        <p><strong>Status:</strong> {getStatusContents(status.type, status.details).title}</p>
      </div>
      <div className="communications"><commit_msg>Add issues to appeal card (#7306)<commit_after>import _ from 'lodash';
import { Link } from 'react-router';
import moment from 'moment';
import PropTypes from 'prop-types';
import React from 'react';

import { appealStatusDescriptions } from '../utils/appeal-helpers';
import { getStatusContents } from '../utils/appeals-v2-helpers';

const renderNextAction = (lastEvent, previousHistory) => {
  if (lastEvent.type === 'ssoc' && previousHistory[0].type !== 'soc') {
    return null;
  }
  const nextAction = appealStatusDescriptions(lastEvent, previousHistory).nextAction;
  return nextAction && nextAction.title;
};

// TODO: Get a proper mapping of programArea -> display output
const appealTypeMap = {
  compensation: 'Compensation',
  pension: 'Pension',
  insurance: 'Insurance',
  loan_guaranty: 'Loan Guaranty', // eslint-disable-line
  education: 'Education',
  vre: 'VRE',
  medical: 'Medical',
  burial: 'Burial',
  bva: 'BVA',
  other: 'Other',
  multiple: 'Multiple',
};


export default function AppealListItem({ appeal }) {
  const { status } = appeal.attributes;
  // always show merged event on top
  const events = _.orderBy(appeal.attributes.events, [e => e.type === 'merged', e => moment(e.date).unix()], ['desc', 'desc']);
  const lastEvent = events[0];
  const firstEvent = events[events.length - 1];
  const previousHistory = events.slice(1);

  return (
    <div className="claim-list-item-container">
      <h3 className="claim-list-item-header-v2">
        Appeal of {appealTypeMap[appeal.attributes.programArea]}
        <br/>
        Decision Received {moment(firstEvent.date).format('MMMM D, YYYY')}
      </h3>
      <div className="card-status">
        <div className={`status-circle ${appeal.attributes.active ? 'open' : 'closed'}`}/>
        <p><strong>Status:</strong> {getStatusContents(status.type, status.details).title}</p>
      </div>
      {appeal.attributes.description &&
        <span><strong>{appeal.attributes.issues.length === 1 ? 'Issue' : 'Issues'} on appeal:</strong> {appeal.attributes.description}</span>}
      <div className="communications">
{'fraction_non_alphanumeric': 0.1579343193782903, 'fraction_numerical': 0.005264477312609677, 'mean_word_length': 4.108834827144686, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 39, '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': '2136778', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1201, 'n_words': 296}