<commit_before>import React from 'react';
import { connect } from 'react-redux';
import classNames from 'classnames';
import { isChapter33 } from '../helpers';

export class StemEligibilityView extends React.Component {
  onChange = property => {
    this.props.onChange({
      ...this.props.formData,
      ...property,
    });
  };

  inReviewEditMode = () => this.props.onReviewPage && this.props.reviewMode;
  showNotApplyingToStemInformation = () =>
    !this.props.onReviewPage &&
    this.props.determineEligibility !== undefined &&
    !this.props.determineEligibility;

  iconClass = indication =>
    classNames('fa', {
      'fa-check': indication,
      'vads-u-color--green': indication,
      'fa-times': !indication,
      'vads-u-color--gray-medium': !indication,
    });

  iconText = indication =>
    indication ? `You answered yes to` : `You answered no to`;

  renderCheck = (classes, title, text) => (
    <li className="vads-u-margin-bottom--0">
      <span className="fa-li">
        <i className={classes} aria-hidden="true" />
      </span>
      <span className="vads-u-visibility--screen-reader">{title}</span>
      {text}
    </li>
  );

  renderIsEdithNourseRogersScholarshipCheck = () => {
    const { isEdithNourseRogersScholarship, benefit } = this.props;
    const check = isEdithNourseRogersScholarship && isChapter33({ benefit });
    const question = isEdithNourseRogersScholarship && benefit === undefined;

    const classes = question
      ? 'fa fa-question vads-u-color--gray-medium'
      : this.iconClass(check);

    const text = 'Post-9/11 GI Bill beneficiary or Fry Scholarship recipient';
    const title = question ? `You didn't answer` : this.iconText(check);

    return this.renderCheck(classes, title, text);
  };

  renderExhaustionOfBenefitsCheck = () => {
    const {
      exhaustionOfBenefits,
      exhaustionOfBenefitsAfterPursuingTeachingCert,
    } = this.props;

    const exhaustionOfBenefitsCheck =
      exhaustionOfBenefits || exhaustionOfBenefitsAfterPursuingTeachingCert;
    const exhaustionOfBenefitsText =
      'Have used all your education benefits or are within 6 months of doing so';

    return this.renderCheck(
      this.iconClass(exhaustionOfBenefitsCheck),
      this.iconText(exhaustionOfBenefitsCheck),
      exhaustionOfBenefitsText,
    );
  };

  renderIsEnrolledStemCheck = () => {
    const { isEnrolledStem, isPursuingTeachingCert } = this.props;

    const isEnrolledStemCheck = isEnrolledStem || isPursuingTeachingCert;

    const isEnrolledStemText = (
      <span>
        Are enrolled in a STEM undergraduate degree program, <strong>or</strong>
        &nbsp;have earned a STEM degree and are now pursuing a teaching
        certification
      </span>
    );

    return this.renderCheck(
      this.iconClass(isEnrolledStemCheck),
      this.iconText(isEnrolledStemCheck),
      isEnrolledStemText,
    );
  };

  renderChecks = () => (
    <div>
      <p className="vads-u-margin-bottom--1">
        <span className="vads-u-font-family--serif heading-level-4">
          Based on you responses, it appears you're not eligible.
        </span>
        <br />
        <br />
        <b>Your responses:</b>
      </p>
      {/* eslint-disable jsx-a11y/no-redundant-roles */}
      <ul
        className="fa-ul vads-u-margin-left--3 vads-u-margin-top--0p5 stem-eligibility-ul"
        role="list"
      >
        {/* eslint-enable jsx-a11y/no-redundant-roles */}

        {this.renderIsEdithNourseRogersScholarshipCheck()}
        {this.renderExhaustionOfBenefitsCheck()}
        {this.renderIsEnrolledStemCheck()}
      </ul>
    </div>
  );

  renderErrorMessage = () => {
    const { errors, showErrors } = this.props;
    if (showErrors) {
      return (
        <div>
          {errors.map(error => (
            <span key={error} className="usa-input-error-message" role="alert"><commit_msg>1995-STEM: "Based on you responses" should be "Based on your responses" (#11821)<commit_after>import React from 'react';
import { connect } from 'react-redux';
import classNames from 'classnames';
import { isChapter33 } from '../helpers';

export class StemEligibilityView extends React.Component {
  onChange = property => {
    this.props.onChange({
      ...this.props.formData,
      ...property,
    });
  };

  inReviewEditMode = () => this.props.onReviewPage && this.props.reviewMode;
  showNotApplyingToStemInformation = () =>
    !this.props.onReviewPage &&
    this.props.determineEligibility !== undefined &&
    !this.props.determineEligibility;

  iconClass = indication =>
    classNames('fa', {
      'fa-check': indication,
      'vads-u-color--green': indication,
      'fa-times': !indication,
      'vads-u-color--gray-medium': !indication,
    });

  iconText = indication =>
    indication ? `You answered yes to` : `You answered no to`;

  renderCheck = (classes, title, text) => (
    <li className="vads-u-margin-bottom--0">
      <span className="fa-li">
        <i className={classes} aria-hidden="true" />
      </span>
      <span className="vads-u-visibility--screen-reader">{title}</span>
      {text}
    </li>
  );

  renderIsEdithNourseRogersScholarshipCheck = () => {
    const { isEdithNourseRogersScholarship, benefit } = this.props;
    const check = isEdithNourseRogersScholarship && isChapter33({ benefit });
    const question = isEdithNourseRogersScholarship && benefit === undefined;

    const classes = question
      ? 'fa fa-question vads-u-color--gray-medium'
      : this.iconClass(check);

    const text = 'Post-9/11 GI Bill beneficiary or Fry Scholarship recipient';
    const title = question ? `You didn't answer` : this.iconText(check);

    return this.renderCheck(classes, title, text);
  };

  renderExhaustionOfBenefitsCheck = () => {
    const {
      exhaustionOfBenefits,
      exhaustionOfBenefitsAfterPursuingTeachingCert,
    } = this.props;

    const exhaustionOfBenefitsCheck =
      exhaustionOfBenefits || exhaustionOfBenefitsAfterPursuingTeachingCert;
    const exhaustionOfBenefitsText =
      'Have used all your education benefits or are within 6 months of doing so';

    return this.renderCheck(
      this.iconClass(exhaustionOfBenefitsCheck),
      this.iconText(exhaustionOfBenefitsCheck),
      exhaustionOfBenefitsText,
    );
  };

  renderIsEnrolledStemCheck = () => {
    const { isEnrolledStem, isPursuingTeachingCert } = this.props;

    const isEnrolledStemCheck = isEnrolledStem || isPursuingTeachingCert;

    const isEnrolledStemText = (
      <span>
        Are enrolled in a STEM undergraduate degree program, <strong>or</strong>
        &nbsp;have earned a STEM degree and are now pursuing a teaching
        certification
      </span>
    );

    return this.renderCheck(
      this.iconClass(isEnrolledStemCheck),
      this.iconText(isEnrolledStemCheck),
      isEnrolledStemText,
    );
  };

  renderChecks = () => (
    <div>
      <p className="vads-u-margin-bottom--1">
        <span className="vads-u-font-family--serif heading-level-4">
          Based on your responses, it appears you're not eligible.
        </span>
        <br />
        <br />
        <b>Your responses:</b>
      </p>
      {/* eslint-disable jsx-a11y/no-redundant-roles */}
      <ul
        className="fa-ul vads-u-margin-left--3 vads-u-margin-top--0p5 stem-eligibility-ul"
        role="list"
      >
        {/* eslint-enable jsx-a11y/no-redundant-roles */}

        {this.renderIsEdithNourseRogersScholarshipCheck()}
        {this.renderExhaustionOfBenefitsCheck()}
        {this.renderIsEnrolledStemCheck()}
      </ul>
    </div>
  );

  renderErrorMessage = () => {
    const { errors, showErrors } = this.props;
    if (showErrors) {
      return (
        <div>
          {errors.map(error => (
            <span key={error} className="usa-input-error-message" role="alert">
{'fraction_non_alphanumeric': 0.12719633307868602, 'fraction_numerical': 0.005729564553093965, 'mean_word_length': 2.9138016940707523, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 77, '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': '5452682', 'n_tokens_mistral': 2546, 'n_tokens_neox': 2453, 'n_words': 480}