<commit_before>import PropTypes from 'prop-types';
import React, { useState } from 'react';

import AlertBox from '@department-of-veterans-affairs/formation-react/AlertBox';

import { HCA_ENROLLMENT_STATUSES } from 'applications/hca/constants';
import {
  getAlertContent,
  getAlertStatusHeadline,
  getAlertStatusInfo,
  getAlertType,
} from 'applications/hca/enrollment-status-helpers';
import DashboardAlert from './DashboardAlert';

const HCAStatusAlert = ({ applicationDate, enrollmentStatus, onRemove }) => {
  const [isShowingConfirmation, setIsShowingConfirmation] = useState(false);

  const showConfirmation = () => {
    setIsShowingConfirmation(true);
  };

  const hideConfirmation = () => {
    setIsShowingConfirmation(false);
  };

  if (isShowingConfirmation) {
    return (
      <AlertBox status="warning">
        <h3
          className="usa-alert-heading"
          tabIndex="-1"
          ref={el => el && el.focus()}
        >
          Are you sure you want to permanently remove this notification?
        </h3>
        <p>
          Please confirm that you want to remove this notification from your{' '}
          <strong>My VA</strong> dashboard. Removing it won’t affect the status
          of your health care application in any way. But once you remove the
          notification, you can’t add it back again.
        </p>
        <button
          className="usa-button-primary vads-u-margin-y--0"
          aria-label="Confirm remove health care application status notification"
          onClick={onRemove}
        >
          Remove the notification
        </button>
        <button
          className="usa-button-secondary vads-u-margin-y--0"
          aria-label="Do not remove the health care application status notification"
          onClick={hideConfirmation}
        >
          Cancel
        </button>
      </AlertBox>
    );
  }

  return (
    <DashboardAlert
      status={getAlertType(enrollmentStatus)}
      headline="Application for health care"
      subheadline="FORM 10-10EZ"
      statusHeadline={getAlertStatusHeadline(enrollmentStatus)}
      statusInfo={getAlertStatusInfo(enrollmentStatus)}
      content={getAlertContent(
        enrollmentStatus,
        applicationDate,
        showConfirmation,
      )}
    />
  );
};

export default HCAStatusAlert;<commit_msg>Update aria labels in HCA notification confirmation (#10274)<commit_after>import PropTypes from 'prop-types';
import React, { useState } from 'react';

import AlertBox from '@department-of-veterans-affairs/formation-react/AlertBox';

import { HCA_ENROLLMENT_STATUSES } from 'applications/hca/constants';
import {
  getAlertContent,
  getAlertStatusHeadline,
  getAlertStatusInfo,
  getAlertType,
} from 'applications/hca/enrollment-status-helpers';
import DashboardAlert from './DashboardAlert';

const HCAStatusAlert = ({ applicationDate, enrollmentStatus, onRemove }) => {
  const [isShowingConfirmation, setIsShowingConfirmation] = useState(false);

  const showConfirmation = () => {
    setIsShowingConfirmation(true);
  };

  const hideConfirmation = () => {
    setIsShowingConfirmation(false);
  };

  if (isShowingConfirmation) {
    return (
      <AlertBox status="warning">
        <h3
          className="usa-alert-heading"
          tabIndex="-1"
          ref={el => el && el.focus()}
        >
          Are you sure you want to permanently remove this notification?
        </h3>
        <p>
          Please confirm that you want to remove this notification from your{' '}
          <strong>My VA</strong> dashboard. Removing it won’t affect the status
          of your health care application in any way. But once you remove the
          notification, you can’t add it back again.
        </p>
        <button
          className="usa-button-primary vads-u-margin-y--0"
          aria-label="Remove the notification of my health care application status"
          onClick={onRemove}
        >
          Remove the notification
        </button>
        <button
          className="usa-button-secondary vads-u-margin-y--0"
          aria-label="Cancel the removal of my the health care application status notification"
          onClick={hideConfirmation}
        >
          Cancel
        </button>
      </AlertBox>
    );
  }

  return (
    <DashboardAlert
      status={getAlertType(enrollmentStatus)}
      headline="Application for health care"
      subheadline="FORM 10-10EZ"
      statusHeadline={getAlertStatusHeadline(enrollmentStatus)}
      statusInfo={getAlertStatusInfo(enrollmentStatus)}
      content={getAlertContent(
        enrollmentStatus,
        applicationDate,
        showConfirmation,
      )}
    />
  );
};

export default HCAStatusAlert;
{'fraction_non_alphanumeric': 0.09801016088060965, 'fraction_numerical': 0.004868755292125318, 'mean_word_length': 2.7619426751592355, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 37, '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': '6745476', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1305, 'n_words': 322}