<commit_before>import React from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import moment from 'moment';

import { focusElement } from '../../common/utils/helpers';
import OMBInfo from '../../common/components/OMBInfo';
import SignInLink from '../../common/components/SignInLink';
import FormTitle from '../../common/schemaform/FormTitle';
import FormIntroButtons from '../../common/schemaform/FormIntroButtons';

import { updateLogInUrl } from '../../login/actions';
import { fetchInProgressForm } from '../../common/schemaform/save-load-actions';


class IntroductionPage extends React.Component {
  componentDidMount() {
    focusElement('.va-nav-breadcrumbs-list');
  }

  // TODO: Add shouldComponentUpdate(); it renders like 14 times upon page refresh

  getAlert = (formSaved) => {
    let alert;

    if (this.props.user.login.currentlyLoggedIn) {
      if (formSaved) {
        const savedAt = this.props.savedAt;
        alert = (
          <div>
            <div className="usa-alert usa-alert-info no-background-image">
              <div style={{ paddingBottom: '8px' }}>Application status: <strong>In progress</strong></div>
              <br/>
              <div>Last saved on {moment(savedAt).format('MM/DD/YYYY [at] hh:mma')}</div>
              <div>Complete the form before submitting to apply for health care with the 10-10EZ.</div>
            </div>
            <br/>
          </div>);
      }
    } else {
      alert = (
        <div>
          <div className="usa-alert usa-alert-info">
            <div className="usa-alert-body">
              <strong>Note:</strong> You are now able save a form in progress, and come back to finish it later. To be able to save your form in progress, please <SignInLink isLoggedIn={this.props.user.login.currentlyLoggedIn} loginUrl={this.props.user.login.loginUrl} onUpdateLoginUrl={this.props.updateLogInUrl}>sign in</SignInLink>.
            </div>
          </div>
          <br/>
        </div>);
    }

    return alert;
  }

  render() {
    const { profile } = this.props.user;
    const formSaved = !!(profile && profile.savedForms.includes(this.props.formId));
    const prefillAvailable = !!(profile && profile.prefillsAvailable.includes(this.props.formId));

    return (
      <div className="schemaform-intro">
        <FormTitle title="Apply online for health care with the 10-10ez"/>
        <p>
          Fill out this application with the most accurate information you have. The more accurate it is, the more likely you are to get a rapid response.
        </p>
        <p>
          VA uses the information you submit to determine your eligibility and to provide you with the best service.
        </p>
        <p>
          Federal law provides criminal penalties, including a fine and/or imprisonment for up to 5 years, for concealing a material fact or making a materially false statement. (See <a href="https://www.justice.gov/usam/criminal-resource-manual-903-false-statements-concealment-18-usc-1001" target="_blank">18 U.S.C. 1001</a>)
        </p>
        {this.getAlert(formSaved)}
        <FormIntroButtons
            route={this.props.route}
            router={this.props.router}<commit_msg>Update saved list check for save in progress (#5862)<commit_after>import React from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import moment from 'moment';

import { focusElement } from '../../common/utils/helpers';
import OMBInfo from '../../common/components/OMBInfo';
import SignInLink from '../../common/components/SignInLink';
import FormTitle from '../../common/schemaform/FormTitle';
import FormIntroButtons from '../../common/schemaform/FormIntroButtons';

import { updateLogInUrl } from '../../login/actions';
import { fetchInProgressForm } from '../../common/schemaform/save-load-actions';


class IntroductionPage extends React.Component {
  componentDidMount() {
    focusElement('.va-nav-breadcrumbs-list');
  }

  // TODO: Add shouldComponentUpdate(); it renders like 14 times upon page refresh

  getAlert = (formSaved) => {
    let alert;

    if (this.props.user.login.currentlyLoggedIn) {
      if (formSaved) {
        const savedAt = this.props.savedAt;
        alert = (
          <div>
            <div className="usa-alert usa-alert-info no-background-image">
              <div style={{ paddingBottom: '8px' }}>Application status: <strong>In progress</strong></div>
              <br/>
              <div>Last saved on {moment(savedAt).format('MM/DD/YYYY [at] hh:mma')}</div>
              <div>Complete the form before submitting to apply for health care with the 10-10EZ.</div>
            </div>
            <br/>
          </div>);
      }
    } else {
      alert = (
        <div>
          <div className="usa-alert usa-alert-info">
            <div className="usa-alert-body">
              <strong>Note:</strong> You are now able save a form in progress, and come back to finish it later. To be able to save your form in progress, please <SignInLink isLoggedIn={this.props.user.login.currentlyLoggedIn} loginUrl={this.props.user.login.loginUrl} onUpdateLoginUrl={this.props.updateLogInUrl}>sign in</SignInLink>.
            </div>
          </div>
          <br/>
        </div>);
    }

    return alert;
  }

  render() {
    const { profile } = this.props.user;
    const formSaved = !!(profile && profile.savedForms.some(f => f.form === this.props.formId));
    const prefillAvailable = !!(profile && profile.prefillsAvailable.includes(this.props.formId));

    return (
      <div className="schemaform-intro">
        <FormTitle title="Apply online for health care with the 10-10ez"/>
        <p>
          Fill out this application with the most accurate information you have. The more accurate it is, the more likely you are to get a rapid response.
        </p>
        <p>
          VA uses the information you submit to determine your eligibility and to provide you with the best service.
        </p>
        <p>
          Federal law provides criminal penalties, including a fine and/or imprisonment for up to 5 years, for concealing a material fact or making a materially false statement. (See <a href="https://www.justice.gov/usam/criminal-resource-manual-903-false-statements-concealment-18-usc-1001" target="_blank">18 U.S.C. 1001</a>)
        </p>
        {this.getAlert(formSaved)}
        <FormIntroButtons
            route={this.props.route}
            router={this.props.router}
{'fraction_non_alphanumeric': 0.12877973906369916, 'fraction_numerical': 0.008902532617037606, 'mean_word_length': 2.6565656565656566, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 76, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '7141428', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1831, 'n_words': 539}