From 2a2ed19f41652d431f3be7a086e5b89199694a65 Mon Sep 17 00:00:00 2001 From: devinleighsmith Date: Fri, 3 Nov 2023 17:15:03 -0700 Subject: [PATCH] provide better user feedback on pid/pin/address search. --- .../src/features/properties/filter/PropertyFilter.tsx | 9 +++++++-- source/frontend/src/utils/YupSchema.ts | 11 +---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/source/frontend/src/features/properties/filter/PropertyFilter.tsx b/source/frontend/src/features/properties/filter/PropertyFilter.tsx index 6c6a937152..728049f238 100644 --- a/source/frontend/src/features/properties/filter/PropertyFilter.tsx +++ b/source/frontend/src/features/properties/filter/PropertyFilter.tsx @@ -116,12 +116,17 @@ export const PropertyFilter: React.FC { setFieldValue('latitude', null); setFieldValue('longitude', null); + setFieldValue('pinOrPid', null); }} /> {values.searchBy === 'pinOrPid' && ( - + )} {values.searchBy === 'address' && useGeocoder && ( searchButtonClicked && searchButtonClicked()} /> diff --git a/source/frontend/src/utils/YupSchema.ts b/source/frontend/src/utils/YupSchema.ts index 9ec526e144..6846481576 100644 --- a/source/frontend/src/utils/YupSchema.ts +++ b/source/frontend/src/utils/YupSchema.ts @@ -27,14 +27,5 @@ export const UserUpdateSchema = Yup.object().shape({ }); export const FilterBarSchema = Yup.object().shape({ - minLotSize: Yup.number() - .typeError('Invalid') - .positive('Must be greater than 0') - .max(200000, 'Invalid'), - maxLotSize: Yup.number() - .typeError('Invalid') - .positive('Must be greater than 0') - .max(200000, 'Invalid') - /* Reference minLotSize field in validating maxLotSize value */ - .moreThan(Yup.ref('minLotSize'), 'Must be greater than Min Lot Size'), + pinOrPid: Yup.string().matches(/^\d{0,3}-\d{3}-\d{3}$|^\d{0,9}$/, 'Invalid PIN or PID'), });