From 678779e628bd1316475d08431d9e57a94e77761c Mon Sep 17 00:00:00 2001 From: pearl-truss Date: Thu, 14 Sep 2023 11:22:23 -0400 Subject: [PATCH] ensure file upload only shows required/optional contract and rate pages --- .../src/components/FileUpload/FileUpload.tsx | 14 ++++++++++++-- .../ContractDetails/ContractDetails.tsx | 1 + .../RateDetails/SingleRateCert/SingleRateCert.tsx | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/services/app-web/src/components/FileUpload/FileUpload.tsx b/services/app-web/src/components/FileUpload/FileUpload.tsx index 86504a0799..5a464c991c 100644 --- a/services/app-web/src/components/FileUpload/FileUpload.tsx +++ b/services/app-web/src/components/FileUpload/FileUpload.tsx @@ -33,6 +33,7 @@ export type FileUploadProps = { hint?: React.ReactNode initialItems?: FileItemT[] isLabelVisible?: boolean + showRequiredOptionalLabel?: boolean uploadFile: (file: File) => Promise scanFile?: (key: string) => Promise // optional function to be called after uploading (used for scanning) deleteFile: (key: string) => Promise @@ -61,9 +62,9 @@ export const FileUpload = ({ uploadFile, scanFile, deleteFile, - // ariaRequired, onFileItemsUpdate, isContractOnly, + showRequiredOptionalLabel = false, shouldDisplayMissingCategoriesError = false, innerInputRef, ...inputProps @@ -420,13 +421,22 @@ export const FileUpload = ({ fileItems.length )} added ` + let isRequiredLabel + if (showRequiredOptionalLabel) { + if (isRequired) { + isRequiredLabel = 'Required' + } else { + isRequiredLabel = 'Optional' + } + } + return ( - {isRequired ? 'Required' : 'Optional'} + {isRequiredLabel} {error} diff --git a/services/app-web/src/pages/StateSubmission/ContractDetails/ContractDetails.tsx b/services/app-web/src/pages/StateSubmission/ContractDetails/ContractDetails.tsx index 251dd665ef..fcc2bd323d 100644 --- a/services/app-web/src/pages/StateSubmission/ContractDetails/ContractDetails.tsx +++ b/services/app-web/src/pages/StateSubmission/ContractDetails/ContractDetails.tsx @@ -522,6 +522,7 @@ export const ContractDetails = ({ label="Upload contract" renderMode="list" aria-required + showRequiredOptionalLabel={true} error={documentsErrorMessage} hint={ @@ -222,6 +223,7 @@ export const SingleRateCert = ({ label="Upload supporting documents" renderMode="list" aria-required={false} + showRequiredOptionalLabel={true} error={showFieldErrors('supportingDocuments')} hint={