Skip to content

Commit

Permalink
Merge pull request #3583 from bcgov/NDT-521-CBC-ERs-RDs-and-Geonames-…
Browse files Browse the repository at this point in the history
…dropdown-does-not-allow-autocomplete

fix: autocomplete community source widget
  • Loading branch information
ccbc-service-account authored Oct 4, 2024
2 parents e4a3008 + 3cec086 commit c0a65d3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.195.5](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.195.4...v1.195.5) (2024-10-04)

### Bug Fixes

- autocomplete community source widget ([57c3c00](https://github.com/bcgov/CONN-CCBC-portal/commit/57c3c00a3576b5b199a2b6f77a047e29d30097a9))
- duplicates on geoname dropdown ([f764b30](https://github.com/bcgov/CONN-CCBC-portal/commit/f764b30765bf334667bb69c95c29c614c277fae9))

## [1.195.4](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.195.3...v1.195.4) (2024-10-03)

### Bug Fixes
Expand Down
23 changes: 20 additions & 3 deletions app/lib/theme/widgets/custom/CommunitySourceWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ const CommunitySourceWidget: React.FC<CommunitySourceWidgetProps> = (props) => {
value: geographicNameId,
label: bcGeographicName,
});
const [economicRegionInputValue, setEconomicRegionInputValue] = useState('');
const [regionalDistrictInputValue, setRegionalDistrictValue] = useState('');
const [geographicNameInputValue, setGeographicNameInputValue] = useState('');

useEffect(() => {
setSelectedEconomicRegion(economicRegion);
Expand Down Expand Up @@ -119,9 +122,12 @@ const CommunitySourceWidget: React.FC<CommunitySourceWidgetProps> = (props) => {
setSelectedEconomicRegion(val);
}
}}
onInputChange={(e, val) => {
setEconomicRegionInputValue(val);
}}
style={{ width: '200px' }}
value={selectedEconomicRegion}
inputValue={selectedEconomicRegion ?? ''}
inputValue={economicRegionInputValue}
options={economicRegionOptions}
getOptionLabel={(option) => option}
renderInput={(params) => (
Expand All @@ -147,8 +153,11 @@ const CommunitySourceWidget: React.FC<CommunitySourceWidgetProps> = (props) => {
setSelectedRegionalDistrict(val);
}
}}
onInputChange={(e, val) => {
setRegionalDistrictValue(val);
}}
value={selectedRegionalDistrict}
inputValue={selectedRegionalDistrict ?? ''}
inputValue={regionalDistrictInputValue}
options={
regionalDistrictOptions[selectedEconomicRegion]
? [...regionalDistrictOptions[selectedEconomicRegion]]
Expand Down Expand Up @@ -177,6 +186,11 @@ const CommunitySourceWidget: React.FC<CommunitySourceWidgetProps> = (props) => {
label="Geographic Name"
/>
)}
renderOption={(renderProps, option) => (
<li {...renderProps} key={option.value}>
{option.label}
</li>
)}
options={getGeographicNameOptions(
selectedRegionalDistrict,
selectedEconomicRegion
Expand All @@ -189,7 +203,7 @@ const CommunitySourceWidget: React.FC<CommunitySourceWidgetProps> = (props) => {
return option.label ?? '';
}}
value={selectedGeographicName}
inputValue={selectedGeographicName?.label ?? ''}
inputValue={geographicNameInputValue}
onChange={(e, val, reason) => {
if (reason === 'clear') {
setSelectedGeographicName({ value: null, label: '' });
Expand All @@ -205,6 +219,9 @@ const CommunitySourceWidget: React.FC<CommunitySourceWidgetProps> = (props) => {
});
}
}}
onInputChange={(e, val) => {
setGeographicNameInputValue(val);
}}
/>
{!rowId && (
<StyledButton
Expand Down
1 change: 1 addition & 0 deletions db/sqitch.plan
Original file line number Diff line number Diff line change
Expand Up @@ -695,3 +695,4 @@ computed_columns/cbc_history 2024-09-03T15:16:07Z Anthony Bushara <anthony@butto
@1.195.2 2024-10-03T15:39:57Z CCBC Service Account <ccbc@button.is> # release v1.195.2
@1.195.3 2024-10-03T15:51:06Z CCBC Service Account <ccbc@button.is> # release v1.195.3
@1.195.4 2024-10-03T22:15:09Z CCBC Service Account <ccbc@button.is> # release v1.195.4
@1.195.5 2024-10-04T20:22:04Z CCBC Service Account <ccbc@button.is> # release v1.195.5
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CONN-CCBC-portal",
"version": "1.195.4",
"version": "1.195.5",
"main": "index.js",
"repository": "https://github.com/bcgov/CONN-CCBC-portal.git",
"author": "Romer, Meherzad CITZ:EX <Meherzad.Romer@gov.bc.ca>",
Expand Down

0 comments on commit c0a65d3

Please sign in to comment.