Skip to content

Commit

Permalink
provide better user feedback on pid/pin/address search.
Browse files Browse the repository at this point in the history
  • Loading branch information
devinleighsmith committed Nov 6, 2023
1 parent eeb49ab commit 2a2ed19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,17 @@ export const PropertyFilter: React.FC<React.PropsWithChildren<IPropertyFilterPro
onChange={() => {
setFieldValue('latitude', null);
setFieldValue('longitude', null);
setFieldValue('pinOrPid', null);
}}
/>
</NoRightPaddingColumn>
<StyledCol xs="3" md="2" lg="4" xl="3">
{values.searchBy === 'pinOrPid' && (
<Input field="pinOrPid" placeholder="Enter a PID or PIN"></Input>
<Input
field="pinOrPid"
placeholder="Enter a PID or PIN"
displayErrorTooltips
></Input>
)}
{values.searchBy === 'address' && useGeocoder && (
<GeocoderAutoComplete
Expand Down Expand Up @@ -150,7 +155,7 @@ export const PropertyFilter: React.FC<React.PropsWithChildren<IPropertyFilterPro
</StyledCol>
<Col xs="auto">
<SearchButton
disabled={isSubmitting}
disabled={isSubmitting || !(values.pinOrPid || values.latitude || values.longitude)}
onClick={() => searchButtonClicked && searchButtonClicked()}
/>
</Col>
Expand Down
11 changes: 1 addition & 10 deletions source/frontend/src/utils/YupSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
});

0 comments on commit 2a2ed19

Please sign in to comment.