Skip to content

Commit

Permalink
Merge pull request #1825 from hackforla/1813-Add-NC-Name-Pill
Browse files Browse the repository at this point in the history
Add NC name pill to Search and Filters modal on address selection
  • Loading branch information
Brandoncyu authored Sep 13, 2024
2 parents be99cba + 5d8b41c commit ce5d828
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions components/Map/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@ class Map extends React.Component {
dispatchGetNcByLngLat,
dispatchUpdateNcId,
dispatchCloseBoundaries,
dispatchUpdateSelectedCouncils,
dispatchUpdateUnselectedCouncils,
councils
} = this.props;

// Reset boundaries input
Expand All @@ -558,6 +561,17 @@ class Map extends React.Component {

const ncIdOfAddressSearch = getNcByLngLatv2({ longitude, latitude });
if (!isEmpty(ncIdOfAddressSearch)) {
//Adding name pill to search bar
const newSelectedCouncil = councils.find(
({ councilId }) => councilId === ncIdOfAddressSearch,
);
if (!newSelectedCouncil) {
throw new Error('Council Id in address search geocoder result could not be found');
}
const newSelected = [newSelectedCouncil];
dispatchUpdateSelectedCouncils(newSelected);
dispatchUpdateUnselectedCouncils(councils);

dispatchUpdateNcId(Number(ncIdOfAddressSearch));
this.setState({
address: address,
Expand Down

0 comments on commit ce5d828

Please sign in to comment.