diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..62df50f1 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +14.17.0 diff --git a/components/admin/permit-holders/Header.tsx b/components/admin/permit-holders/Header.tsx index 33b93ad3..8553ec85 100644 --- a/components/admin/permit-holders/Header.tsx +++ b/components/admin/permit-holders/Header.tsx @@ -1,3 +1,4 @@ +import { useRouter } from 'next/router'; import { Alert, AlertIcon, @@ -18,6 +19,7 @@ import { ChevronDownIcon, ChevronLeftIcon } from '@chakra-ui/icons'; // Chakra U import Link from 'next/link'; // Link import { ApplicantStatus } from '@lib/graphql/types'; import PermitHolderStatusBadge from '@components/admin/PermitHolderStatusBadge'; +import ConfirmDeleteApplicantModal from '@components/admin/permit-holders/table/ConfirmDeleteApplicantModal'; import SetPermitHolderToInactiveModal from '@components/admin/permit-holders/table/ConfirmSetInactiveModal'; import SetPermitHolderToActiveModal from '@components/admin/permit-holders/table/ConfirmSetActiveModal'; import AdditionalNotesModal from '@components/admin/permit-holders/additional-notes/Modal'; @@ -37,6 +39,8 @@ export default function PermitHolderHeader({ applicant: { id, name, status, inactiveReason, notes }, refetch, }: PermitHolderHeaderProps) { + const router = useRouter(); + // Set Permit Holder Inactive/Active modal state const { isOpen: isSetPermitHolderStatusModalOpen, @@ -44,6 +48,13 @@ export default function PermitHolderHeader({ onClose: onCloseSetPermitHolderStatusModal, } = useDisclosure(); + // Delete applicant modal state + const { + isOpen: isDeleteApplicantModalOpen, + onOpen: onOpenDeleteApplicantModal, + onClose: onCloseDeleteApplicantModal, + } = useDisclosure(); + // Additional notes modal state const { isOpen: isNotesModalOpen, @@ -97,6 +108,13 @@ export default function PermitHolderHeader({ > {`Set as ${status === 'ACTIVE' ? 'Inactive' : 'Active'}`} + + {'Delete Permit Holder'} + @@ -143,6 +161,17 @@ export default function PermitHolderHeader({ onClose={onCloseSetPermitHolderStatusModal} /> )} + { + /* Do not refetch, redirect to permit holders page */ + }} + onClose={() => { + onCloseDeleteApplicantModal(); + router.push('/admin/permit-holders'); + }} + /> {/* Additional notes modal */} - Gender: {gender === 'OTHER' ? otherGender : titlecase(gender)} + Gender: {gender === 'OTHER' && otherGender ? otherGender : titlecase(gender)} diff --git a/components/admin/permit-holders/permit-holder-information/EditModal.tsx b/components/admin/permit-holders/permit-holder-information/EditModal.tsx index b6af3fd7..ba6c1734 100644 --- a/components/admin/permit-holders/permit-holder-information/EditModal.tsx +++ b/components/admin/permit-holders/permit-holder-information/EditModal.tsx @@ -76,6 +76,7 @@ export default function EditUserInformationModal({ }} validationSchema={permitHolderInformationSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => (
diff --git a/components/admin/permit-holders/table/ConfirmDeleteApplicantModal.tsx b/components/admin/permit-holders/table/ConfirmDeleteApplicantModal.tsx new file mode 100644 index 00000000..db86f3f8 --- /dev/null +++ b/components/admin/permit-holders/table/ConfirmDeleteApplicantModal.tsx @@ -0,0 +1,115 @@ +import { SyntheticEvent } from 'react'; +import { + Modal, + ModalOverlay, + ModalContent, + ModalHeader, + ModalFooter, + ModalBody, + Button, + Text, + useToast, +} from '@chakra-ui/react'; +import { useMutation } from '@tools/hooks/graphql'; +import { + DeleteApplicantRequest, + DeleteApplicantResponse, + DELETE_APPLICANT, +} from '@tools/admin/permit-holders/permit-holders-table'; + +type ConfirmDeleteApplicantModalProps = { + readonly isOpen: boolean; + readonly applicantId: number; + readonly refetch: () => void; + readonly onClose: () => void; +}; + +/** + * Delete applicant confirmation modal + */ +export default function ConfirmDeleteApplicantModal({ + isOpen, + applicantId, + refetch, + onClose, +}: ConfirmDeleteApplicantModalProps) { + const toast = useToast(); + + // API call to deleteApplicant + const [deleteApplicant] = useMutation( + DELETE_APPLICANT, + { + onCompleted: data => { + if (data.deleteApplicant.ok) { + toast({ + status: 'success', + description: `Permit holder successfully deleted.`, + }); + } else { + toast({ + status: 'error', + description: `Failed to delete permit holder.`, + }); + } + }, + } + ); + + // Close modal handler + const handleClose = () => { + onClose(); + }; + + // Sets permit holder status to inactive and closes modal + const handleSubmit = async (event: SyntheticEvent) => { + event.preventDefault(); + await deleteApplicant({ + variables: { input: { id: applicantId } }, + }); + refetch(); + onClose(); + }; + + return ( + + + + + + + {`Delete Permit Holder`} + + + + + Are you sure you want to delete this permit holder? This action is irreversible. + + + + All of this user's data, including associated applications and permits will be + permanently deleted. + + + + If you would like to retain this data, please cancel and mark this user as inactive + instead. + + + + + + + + + + ); +} diff --git a/components/admin/requests/Header.tsx b/components/admin/requests/Header.tsx index e823f8ba..878aedb8 100644 --- a/components/admin/requests/Header.tsx +++ b/components/admin/requests/Header.tsx @@ -1,15 +1,33 @@ -import { Box, Flex, HStack, Text, Link, VStack, Alert, AlertIcon } from '@chakra-ui/react'; // Chakra UI -import { ChevronLeftIcon } from '@chakra-ui/icons'; // Chakra UI icon +import { useRouter } from 'next/router'; +import { + Alert, + AlertIcon, + Box, + Button, + Flex, + HStack, + Link, + Menu, + MenuButton, + MenuItem, + MenuList, + Text, + useDisclosure, + VStack, +} from '@chakra-ui/react'; // Chakra UI +import { ChevronDownIcon, ChevronLeftIcon } from '@chakra-ui/icons'; // Chakra UI icon import NextLink from 'next/link'; // Link import RequestStatusBadge from '@components/admin/RequestStatusBadge'; // Request status badge import ShopifyBadge from '@components/admin/ShopifyBadge'; import PermitTypeBadge from '@components/admin/PermitTypeBadge'; +import ConfirmDeleteRequestModal from './delete/ConfirmDeleteRequestModal'; import { ApplicationStatus, ApplicationType, PermitType } from '@lib/graphql/types'; import { titlecase } from '@tools/string'; import { formatDateYYYYMMDD, formatDateYYYYMMDDLocal } from '@lib/utils/date'; import { getPermanentPermitExpiryDate } from '@lib/utils/permit-expiry'; type RequestHeaderProps = { + readonly id: number; readonly applicationType: ApplicationType; readonly permitType: PermitType; readonly createdAt: Date; @@ -24,6 +42,7 @@ type RequestHeaderProps = { /** * Header of View Request page + * @param id Application id * @param applicationType Type of application * @param permitType Type of permit * @param createdAt Date permit was created at @@ -36,6 +55,7 @@ type RequestHeaderProps = { * @param reasonForRejection Reason for rejecting application */ export default function RequestHeader({ + id, applicationType, permitType, createdAt, @@ -55,6 +75,8 @@ export default function RequestHeader({ expiryDateText = `Expiry date: ${formatDateYYYYMMDD(permitExpiry)}`; } else if (permitType === 'TEMPORARY' && !!temporaryPermitExpiry) { expiryDateText = `This permit will expire: ${formatDateYYYYMMDD(temporaryPermitExpiry)}`; + } else if (applicationType === 'REPLACEMENT' && !!permitExpiry) { + expiryDateText = `This permit will expire: ${formatDateYYYYMMDD(permitExpiry)}`; } else if (permitType === 'PERMANENT') { expiryDateText = `This permit will expire: ${formatDateYYYYMMDD( getPermanentPermitExpiryDate() @@ -63,6 +85,15 @@ export default function RequestHeader({ expiryDateText = null; } + const router = useRouter(); + + // Delete application modal state + const { + isOpen: isDeleteApplicationModalOpen, + onOpen: onOpenDeleteApplicationModal, + onClose: onCloseDeleteApplicationModal, + } = useDisclosure(); + return ( @@ -88,6 +119,27 @@ export default function RequestHeader({ Received on {formatDateYYYYMMDDLocal(createdAt)} at{' '} {createdAt.toLocaleTimeString('en-CA')} + + } + height="30px" + bg="background.gray" + _hover={{ bg: 'background.grayHover' }} + color="black" + > + More Actions + + + + {'Delete Request'} + + + {displayShopifyUrl && ( @@ -127,6 +179,17 @@ export default function RequestHeader({ )} + { + /* Do not refetch, redirect to main page */ + }} + onClose={() => { + onCloseDeleteApplicationModal(); + router.push('/admin'); + }} + /> ); diff --git a/components/admin/requests/additional-questions/EditModal.tsx b/components/admin/requests/additional-questions/EditModal.tsx index 6c2b0181..b7af9dad 100644 --- a/components/admin/requests/additional-questions/EditModal.tsx +++ b/components/admin/requests/additional-questions/EditModal.tsx @@ -61,6 +61,7 @@ export default function EditAdditionalInformationModal({ initialValues={{ additionalInformation: additionalInformation }} validationSchema={editAdditionalQuestionsSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => (
diff --git a/components/admin/requests/delete/ConfirmDeleteRequestModal.tsx b/components/admin/requests/delete/ConfirmDeleteRequestModal.tsx new file mode 100644 index 00000000..dabba9e0 --- /dev/null +++ b/components/admin/requests/delete/ConfirmDeleteRequestModal.tsx @@ -0,0 +1,111 @@ +import { SyntheticEvent } from 'react'; +import { + Modal, + ModalOverlay, + ModalContent, + ModalHeader, + ModalFooter, + ModalBody, + Button, + Text, + useToast, +} from '@chakra-ui/react'; +import { useMutation } from '@tools/hooks/graphql'; +import { + DeleteApplicationRequest, + DeleteApplicationResponse, + DELETE_APPLICATION_MUTATION, +} from '@tools/admin/requests/delete-request-modal'; + +type ConfirmDeleteRequestModalProps = { + readonly isOpen: boolean; + readonly applicationId: number; + readonly refetch: () => void; + readonly onClose: () => void; +}; + +/** + * Delete request confirmation modal + */ +export default function ConfirmDeleteRequestModal({ + isOpen, + applicationId, + refetch, + onClose, +}: ConfirmDeleteRequestModalProps) { + const toast = useToast(); + + // API call to deleteApplication + const [deleteApplication] = useMutation( + DELETE_APPLICATION_MUTATION, + { + onCompleted: data => { + if (data.deleteApplication.ok) { + toast({ + status: 'success', + description: `Request successfully deleted.`, + }); + } else { + toast({ + status: 'error', + description: `Failed to delete request.`, + }); + } + }, + } + ); + + // Close modal handler + const handleClose = () => { + onClose(); + }; + + // Sets permit holder status to inactive and closes modal + const handleSubmit = async (event: SyntheticEvent) => { + event.preventDefault(); + await deleteApplication({ + variables: { input: { id: applicationId } }, + }); + refetch(); + onClose(); + }; + + return ( + + + + + + + {`Delete Request`} + + + + + Are you sure you want to delete this request? This action is irreversible. + + + + All data associated with this request will be permanently deleted and will no longer + show under the permit holder's recent apps. + + + + + + + + + + + ); +} diff --git a/components/admin/requests/doctor-information/EditModal.tsx b/components/admin/requests/doctor-information/EditModal.tsx index d41568f9..1235fbd5 100644 --- a/components/admin/requests/doctor-information/EditModal.tsx +++ b/components/admin/requests/doctor-information/EditModal.tsx @@ -80,6 +80,7 @@ export default function EditDoctorInformationModal({ initialValues={{ doctorInformation }} validationSchema={editPhysicianInformationSchema} onSubmit={handleSubmit} + validateOnMount > {({ isValid }) => (
diff --git a/components/admin/requests/guardian-information/EditModal.tsx b/components/admin/requests/guardian-information/EditModal.tsx index c66c2984..4e50a7ae 100644 --- a/components/admin/requests/guardian-information/EditModal.tsx +++ b/components/admin/requests/guardian-information/EditModal.tsx @@ -136,6 +136,7 @@ const EditGuardianInformationModal: FC = ({ children, guardianInformation }} validationSchema={editGuardianInformationSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/admin/requests/payment-information/EditModal.tsx b/components/admin/requests/payment-information/EditModal.tsx index 65827b15..f79db65f 100644 --- a/components/admin/requests/payment-information/EditModal.tsx +++ b/components/admin/requests/payment-information/EditModal.tsx @@ -66,6 +66,7 @@ export default function EditPaymentDetailsModal({ initialValues={{ paymentInformation }} validationSchema={editPaymentInformationSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/admin/requests/permit-holder-information/Card.tsx b/components/admin/requests/permit-holder-information/Card.tsx index 2f0aee3a..a64b95c5 100644 --- a/components/admin/requests/permit-holder-information/Card.tsx +++ b/components/admin/requests/permit-holder-information/Card.tsx @@ -94,6 +94,8 @@ const Card: FC = props => { | null; if (type === 'NEW') { const validatedData = await permitHolderInformationSchema.validate(permitHolderData); + // TODO: Remove this once schema is updated + validatedData.otherGender = ''; ({ data } = await updateNewPermitHolderInformation({ variables: { input: { id: applicationId, ...validatedData } }, diff --git a/components/admin/requests/permit-holder-information/EditModal.tsx b/components/admin/requests/permit-holder-information/EditModal.tsx index 31a010ab..2c890145 100644 --- a/components/admin/requests/permit-holder-information/EditModal.tsx +++ b/components/admin/requests/permit-holder-information/EditModal.tsx @@ -79,6 +79,7 @@ export default function EditPermitHolderInformationModal({ initialValues={{ permitHolder: { ...permitHolderInformation } }} validationSchema={editRequestPermitHolderInformationSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/admin/requests/physician-assessment/EditModal.tsx b/components/admin/requests/physician-assessment/EditModal.tsx index 869cf1b0..d2a317e9 100644 --- a/components/admin/requests/physician-assessment/EditModal.tsx +++ b/components/admin/requests/physician-assessment/EditModal.tsx @@ -63,6 +63,7 @@ export default function EditPhysicianAssessmentModal({ }} validationSchema={editPhysicianAssessmentSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/admin/requests/processing/TasksCard.tsx b/components/admin/requests/processing/TasksCard.tsx index b9048833..6d3d482f 100644 --- a/components/admin/requests/processing/TasksCard.tsx +++ b/components/admin/requests/processing/TasksCard.tsx @@ -106,8 +106,8 @@ export default function ProcessingTasksCard({ applicationId }: ProcessingTasksCa const [generateInvoice, { loading: generateInvoiceLoading }] = useMutation(GENERATE_INVOICE_MUTATION); - const handleGenerateInvoice = async () => { - await generateInvoice({ variables: { input: { applicationId } } }); + const handleGenerateInvoice = async (isDonation: boolean) => { + await generateInvoice({ variables: { input: { applicationId, isDonation } } }); refetch(); }; @@ -184,6 +184,7 @@ export default function ProcessingTasksCard({ applicationId }: ProcessingTasksCa paidThroughShopify, shopifyConfirmationNumber, shopifyOrderNumber, + donationAmount, processing: { status, appNumber, @@ -327,7 +328,6 @@ export default function ProcessingTasksCard({ applicationId }: ProcessingTasksCa ) : null} - {/* Task 2: Hole punch parking permit: Mark as complete (CHECK) */} ) : null} - - {/* Task 3: Create a new wallet card: Mark as complete (CHECK) */} + {/* Task 3: Review Information: Review Information (MODAL) */} - {walletCardCreated && !reviewRequestCompleted ? ( - - ) : !walletCardCreated && !reviewRequestCompleted ? ( - - ) : null} - - - {/* Task 4: Review Information: Review Information (MODAL) */} - handleReviewRequestInformation(true)} onUndo={() => { @@ -464,11 +410,14 @@ export default function ProcessingTasksCard({ applicationId }: ProcessingTasksCa loading={reviewRequestInformationLoading} /> - - {/* Task 5: Generate Invoice */} + {/* Task 4: Generate Invoice */} = 20 + ? 'Generate invoice and donation receipt' + : 'Generate invoice' + } description="Invoice number will be automatically assigned" isCompleted={invoice !== null} showLog={showTaskLog} @@ -487,9 +436,13 @@ export default function ProcessingTasksCard({ applicationId }: ProcessingTasksCa height="35px" bg="background.gray" _hover={!reviewRequestCompleted ? undefined : { bg: 'background.grayHover' }} - disabled={!reviewRequestCompleted || generateInvoiceLoading} color="black" - onClick={handleGenerateInvoice} + onClick={() => { + Number(donationAmount) >= 20 + ? handleGenerateInvoice(true) + : handleGenerateInvoice(false); + }} + isDisabled={!reviewRequestCompleted || generateInvoiceLoading} isLoading={generateInvoiceLoading} loadingText="Generate document" fontWeight="normal" @@ -520,10 +473,9 @@ export default function ProcessingTasksCard({ applicationId }: ProcessingTasksCa )} - - {/* Task 6: Upload document: Choose document (UPLOAD FILE) */} + {/* Task 5: Upload document: Choose document (UPLOAD FILE) */} - + {/* Task 6: Create a new wallet card: Mark as complete (CHECK) */} + + {walletCardCreated ? ( + + ) : ( + + )} + {/* Task 7: Mail out: Mark as complete (CHECK) */} handleMailOut(false)} - disabled={mailOutLoading} + isDisabled={mailOutLoading} isLoading={mailOutLoading} loadingText="Undo" fontWeight="normal" @@ -585,10 +588,10 @@ export default function ProcessingTasksCard({ applicationId }: ProcessingTasksCa marginLeft="auto" height="35px" bg="background.gray" - _hover={documentsUrl === null ? undefined : { bg: 'background.grayHover' }} + _hover={!walletCardCreated ? undefined : { bg: 'background.grayHover' }} color="black" - disabled={documentsUrl === null || mailOutLoading} onClick={() => handleMailOut(true)} + isDisabled={!walletCardCreated || mailOutLoading} isLoading={mailOutLoading} loadingText="Mark as complete" fontWeight="normal" diff --git a/components/admin/requests/reason-for-replacement/EditModal.tsx b/components/admin/requests/reason-for-replacement/EditModal.tsx index 49031c72..01fc674b 100644 --- a/components/admin/requests/reason-for-replacement/EditModal.tsx +++ b/components/admin/requests/reason-for-replacement/EditModal.tsx @@ -64,6 +64,7 @@ export default function EditReasonForReplacementModal({ }} validationSchema={editReasonForReplacementFormSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/applicant/renewals/IdentityVerification.tsx b/components/applicant/renewals/IdentityVerification.tsx index bc3202c2..2b512c69 100644 --- a/components/applicant/renewals/IdentityVerification.tsx +++ b/components/applicant/renewals/IdentityVerification.tsx @@ -124,6 +124,7 @@ const IdentityVerification: FC = () => { }} validationSchema={verifyIdentitySchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/applicant/renewals/RenewalForm/AdditionalInformationSection.tsx b/components/applicant/renewals/RenewalForm/AdditionalInformationSection.tsx index 1d5408c9..464ed427 100644 --- a/components/applicant/renewals/RenewalForm/AdditionalInformationSection.tsx +++ b/components/applicant/renewals/RenewalForm/AdditionalInformationSection.tsx @@ -48,6 +48,7 @@ const AdditionalInformationSection: FC = () => { initialValues={{ ...additionalInformation }} validationSchema={additionalQuestionsSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/applicant/renewals/RenewalForm/ContactInformationSection.tsx b/components/applicant/renewals/RenewalForm/ContactInformationSection.tsx index 23e465be..96fc785f 100644 --- a/components/applicant/renewals/RenewalForm/ContactInformationSection.tsx +++ b/components/applicant/renewals/RenewalForm/ContactInformationSection.tsx @@ -59,6 +59,7 @@ const ContactInformationSection: FC = () => { }} validationSchema={applicantFacingRenewalContactSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/applicant/renewals/RenewalForm/DoctorInformationSection.tsx b/components/applicant/renewals/RenewalForm/DoctorInformationSection.tsx index 37cbb4db..ddafb165 100644 --- a/components/applicant/renewals/RenewalForm/DoctorInformationSection.tsx +++ b/components/applicant/renewals/RenewalForm/DoctorInformationSection.tsx @@ -87,6 +87,7 @@ const DoctorInformationSection: FC = () => { }} validationSchema={applicantFacingRenewalDoctorSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/applicant/renewals/RenewalForm/DonationSection.tsx b/components/applicant/renewals/RenewalForm/DonationSection.tsx index f72701ff..aa5870cb 100644 --- a/components/applicant/renewals/RenewalForm/DonationSection.tsx +++ b/components/applicant/renewals/RenewalForm/DonationSection.tsx @@ -35,6 +35,7 @@ const DonationSection: FC = () => { }} validationSchema={applicantFacingRenewalDonationSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/applicant/renewals/RenewalForm/PersonalAddressSection.tsx b/components/applicant/renewals/RenewalForm/PersonalAddressSection.tsx index 674f5147..2ed5c0eb 100644 --- a/components/applicant/renewals/RenewalForm/PersonalAddressSection.tsx +++ b/components/applicant/renewals/RenewalForm/PersonalAddressSection.tsx @@ -64,6 +64,7 @@ const PersonalAddressSection: FC = () => { }} validationSchema={applicantFacingRenewalPersonalAddressSchema} onSubmit={handleSubmit} + validateOnMount > {({ values, isValid }) => ( diff --git a/components/form/CheckboxField.tsx b/components/form/CheckboxField.tsx index 478bbccf..f67eece3 100644 --- a/components/form/CheckboxField.tsx +++ b/components/form/CheckboxField.tsx @@ -13,13 +13,13 @@ const CheckboxField: FC = props => { const isChecked = field.value; return ( - + {children} - {meta.touched && meta.error ? meta.error : null} + {meta.error || null} diff --git a/components/form/CheckboxGroupField.tsx b/components/form/CheckboxGroupField.tsx index 0b961dcd..e6ecfde2 100644 --- a/components/form/CheckboxGroupField.tsx +++ b/components/form/CheckboxGroupField.tsx @@ -24,14 +24,14 @@ const CheckboxGroupField: FC = props => { }; return ( - + {label} {children} - {meta.touched && meta.error ? meta.error : null} + {meta.error || null} diff --git a/components/form/DateField.tsx b/components/form/DateField.tsx index 63145e10..263f83c7 100644 --- a/components/form/DateField.tsx +++ b/components/form/DateField.tsx @@ -29,12 +29,12 @@ const DateField: FC = props => { }; return ( - + {label} - {meta.touched && meta.error ? meta.error : null} + {meta.error || null} {children} diff --git a/components/form/NumberField.tsx b/components/form/NumberField.tsx index ca45745f..d1cb4057 100644 --- a/components/form/NumberField.tsx +++ b/components/form/NumberField.tsx @@ -21,14 +21,14 @@ const NumberField: FC = props => { const [field, meta] = useField(name); return ( - + {label} - {meta.touched && meta.error ? meta.error : null} + {meta.error || null} {children} diff --git a/components/form/RadioGroupField.tsx b/components/form/RadioGroupField.tsx index cd0971e9..cfba0323 100644 --- a/components/form/RadioGroupField.tsx +++ b/components/form/RadioGroupField.tsx @@ -24,14 +24,14 @@ const RadioGroupField: FC = props => { }; return ( - + {label && {label}} {children} - {meta.touched && meta.error ? meta.error : null} + {meta.error || null} diff --git a/components/form/SelectField.tsx b/components/form/SelectField.tsx index 81f82ccf..2a373bfc 100644 --- a/components/form/SelectField.tsx +++ b/components/form/SelectField.tsx @@ -20,12 +20,12 @@ const SelectField: FC = props => { const [field, meta] = useField(name); return ( - + {label}