generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Story] Indicate voluntary reporter status (#1000)
Added frontend support for Voluntary Filing Status and renamed some page elements. ## Changes - Added a Radio Button Group component to handle the state stuff of the radio buttons. - Added the Indicate Voluntary Reporter Status section and Radio buttons to the Point of Contact Page - Added Zod validation for the voluntary reporter status - Fixed a bug which caused the extension field to no longer be optional and fixed a test related to it - Updated verbiage from Point of Contact to Filing Details where appropriate - Updated other verbiage to be in line with the Figma docs - Moved and updated the Voluntary Reporter status section in the Sign and Submit page - Updated tests to use new verbiage where appropriate and fix test failures ## How to test this PR 1. Read the notes 2. Pull the branch 3. Restart any stack components as necessary 4. Access the site 5. Fill out a submission until you can navigate to the 'Provide Filing Details' page 6. Verify that everything appears as expected. 7. Without filing anything out, attempt to submit the form 8. Verify that the appropriate errors appear for the Voluntary Reporter Status being blank 9. Fill out the form 10. Click 'Continue to next step' 11. Verify that the sign and submit page contains the Voluntary Reporter Status section in the right place and that it appears correct. ## Screenshots <img width="706" alt="Screenshot 2024-10-24 at 12 57 23 PM" src="https://github.com/user-attachments/assets/b7a3bd9c-c6c1-4131-a0b6-600b97c0fed4"> <img width="810" alt="Screenshot 2024-10-24 at 12 57 46 PM" src="https://github.com/user-attachments/assets/7136271c-8139-4e3a-8e88-281ad61ac40a"> <img width="787" alt="Screenshot 2024-10-24 at 12 57 02 PM" src="https://github.com/user-attachments/assets/aa8f4b06-7352-489a-b081-9b98f3a03ce8"> <img width="797" alt="Screenshot 2024-10-24 at 12 57 13 PM" src="https://github.com/user-attachments/assets/91ef6082-62c5-40b3-a933-dcac4d16bd2b"> <img width="798" alt="Screenshot 2024-10-24 at 12 59 42 PM" src="https://github.com/user-attachments/assets/87e78cac-d6db-498e-8773-b522c74d1d2f"> <img width="789" alt="Screenshot 2024-10-24 at 1 00 22 PM" src="https://github.com/user-attachments/assets/a460dbf5-1e81-41df-a2cf-96ab85775bca"> <img width="823" alt="Screenshot 2024-10-24 at 12 58 04 PM" src="https://github.com/user-attachments/assets/633aff83-5ed6-4dee-851c-141929fe787c"> ## Notes - There may be e2e test failures at the moment. I am putting off completely fixing/extending them until the follow on work - Would like to rename all appropriate instances of PointOfContact to FilingDetails as a part of the follow on work as well.
- Loading branch information
1 parent
c7167c4
commit ce7802d
Showing
24 changed files
with
525 additions
and
154 deletions.
There are no files selected for viewing
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
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
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,26 @@ | ||
import { filingApiClient, request } from 'api/axiosService'; | ||
import type { SblAuthProperties } from 'api/useSblAuth'; | ||
import type { FormattedVoluntaryReporterStatusSchema } from 'types/formTypes'; | ||
|
||
interface Options { | ||
data: FormattedVoluntaryReporterStatusSchema; | ||
lei: string; | ||
filingPeriod: string; | ||
} | ||
|
||
const submitVoluntaryReporterStatus = async ( | ||
auth: SblAuthProperties, | ||
options: Options, | ||
): Promise<null> => { | ||
const { data, lei, filingPeriod } = options; | ||
|
||
return request<FormattedVoluntaryReporterStatusSchema, null>({ | ||
axiosInstance: filingApiClient, | ||
url: `/v1/filing/institutions/${lei}/filings/${filingPeriod}/is-voluntary`, | ||
method: 'put', | ||
data, | ||
headers: { Authorization: `Bearer ${auth.user?.access_token}` }, | ||
}); | ||
}; | ||
|
||
export default submitVoluntaryReporterStatus; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Label } from 'design-system-react'; | ||
|
||
function RadioButtonGroup({ | ||
id = 'radio-button-group', | ||
label = 'Radio Group', | ||
onChange = undefined, | ||
children, | ||
}: { | ||
id?: string | null | undefined; | ||
label?: string | null | undefined; | ||
onChange?: React.ChangeEventHandler<HTMLInputElement> | null | undefined; | ||
children: React.ReactNode; | ||
}): JSX.Element { | ||
const ENTER_KEY_CODE = 13; | ||
|
||
const onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => { | ||
if ( | ||
!event.altKey && | ||
!event.ctrlKey && | ||
!event.metaKey && | ||
!event.shiftKey && | ||
event.keyCode === ENTER_KEY_CODE | ||
) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
(event.target as HTMLInputElement).click(); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
<Label | ||
id={id ?? undefined} | ||
htmlFor={`${id}-radio-group`} | ||
className='mb-[0.9375rem]' | ||
> | ||
{label} | ||
</Label> | ||
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */} | ||
<div | ||
id={`${id}-radio-group`} | ||
onKeyDown={onKeyDown} | ||
onChange={onChange ?? undefined} | ||
> | ||
{children} | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
RadioButtonGroup.defaultProps = { | ||
id: 'radio-button-group', | ||
label: 'Radio Group', | ||
onChange: undefined, | ||
}; | ||
|
||
export default RadioButtonGroup; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import PointOfContact from 'pages/PointOfContact'; | ||
import FilingDetails from 'pages/PointOfContact'; | ||
|
||
function FilingContact(): JSX.Element { | ||
return <PointOfContact />; | ||
return <FilingDetails />; | ||
} | ||
|
||
export default FilingContact; |
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
Oops, something went wrong.