-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added login functionality on intro page, styling on applicant info pa…
…ge (#32675) Co-authored-by: Belle P <[email protected]>
- Loading branch information
Showing
4 changed files
with
141 additions
and
21 deletions.
There are no files selected for viewing
110 changes: 110 additions & 0 deletions
110
...ck-form-ae-design-patterns/patterns/pattern2/TaskOrange/components/SaveInProgressInfo.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
import SaveInProgressIntro from 'platform/forms/save-in-progress/SaveInProgressIntro'; | ||
import { VaButton } from '@department-of-veterans-affairs/component-library/dist/react-bindings'; | ||
import { Link } from 'react-router'; | ||
import { selectAuthStatus } from '../../../../utils/selectors/auth-status'; | ||
import VerifiedPrefillAlert from '../../../../shared/components/alerts/VerifiedPrefillAlert'; | ||
import content from '../../../../shared/locales/en/content.json'; | ||
import { getTaskFromUrl } from '../../../../utils/helpers/task'; | ||
import { TASKS } from '../../../../utils/constants'; | ||
|
||
const SaveInProgressInfo = ({ formConfig, pageList }) => { | ||
const { isLoggedOut } = useSelector(selectAuthStatus); | ||
|
||
const { | ||
downtime, | ||
prefillEnabled, | ||
savedFormMessages, | ||
customText, | ||
} = formConfig; | ||
|
||
const task = getTaskFromUrl(formConfig.urlPrefix); | ||
|
||
const buttonOnly = isLoggedOut || task === TASKS.YELLOW; | ||
|
||
// set the props to use for the SaveInProgressIntro components | ||
const sipProps = { | ||
startText: 'Start the education application', | ||
unauthStartText: content['sip-sign-in-to-start-text'], | ||
messages: savedFormMessages, | ||
formConfig: { customText }, | ||
headingLevel: 3, | ||
verifiedPrefillAlert: VerifiedPrefillAlert, | ||
buttonOnly, | ||
hideUnauthedStartLink: true, | ||
prefillEnabled, | ||
downtime, | ||
pageList, | ||
devOnly: { forceShowFormControls: false }, | ||
}; | ||
|
||
const sipIntro = <SaveInProgressIntro {...sipProps} />; | ||
|
||
// set the correct alert to render based on enrollment status | ||
const LoggedInAlertToRender = () => { | ||
return sipIntro; | ||
}; | ||
|
||
const onSignInButtonClick = () => { | ||
const redirectLocation = `${formConfig.rootUrl}${ | ||
formConfig.urlPrefix | ||
}introduction?loggedIn=true`; | ||
|
||
window.location = redirectLocation; | ||
}; | ||
|
||
return isLoggedOut ? ( | ||
<> | ||
<va-alert | ||
status="info" | ||
class="vads-u-margin-y--4" | ||
data-testid="ezr-login-alert" | ||
uswds | ||
> | ||
<h3 slot="headline"> | ||
Sign in now to save time and save your work in progress | ||
</h3> | ||
<p>Here’s how signing in now helps you:</p> | ||
<ul> | ||
<li> | ||
We can fill in some of your information for you to save you time. | ||
</li> | ||
<li> | ||
You can save your work in progress. You’ll have 60 days from when | ||
you start or make updates to your application to come back and | ||
finish it. | ||
</li> | ||
</ul> | ||
<p> | ||
<strong>Note:</strong> You can sign in after you start your | ||
application. But you’ll lose any information you already filled | ||
in. | ||
</p> | ||
<VaButton | ||
onClick={onSignInButtonClick} | ||
text="Sign in to start your application" | ||
/> | ||
<p> | ||
<Link | ||
to="/2/task-orange/introduction?loggedIn=false" | ||
className="schemaform-start-button" | ||
> | ||
Start your application without signing in | ||
</Link> | ||
</p> | ||
</va-alert> | ||
</> | ||
) : ( | ||
<div className="vads-u-margin-y--4">{LoggedInAlertToRender()}</div> | ||
); | ||
}; | ||
|
||
SaveInProgressInfo.propTypes = { | ||
formConfig: PropTypes.object, | ||
pageList: PropTypes.array, | ||
}; | ||
|
||
export default SaveInProgressInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters