-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add AOI modal and search bar in map
Closes #122
- Loading branch information
Showing
8 changed files
with
129 additions
and
61 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as React from 'react'; | ||
import propTypes from 'prop-types'; | ||
import { Sherlock, LocatorSuggestProvider } from '@agrc/sherlock'; | ||
import config from '../config'; | ||
import Graphic from '@arcgis/core/Graphic'; | ||
import Extent from '@arcgis/core/geometry/Extent'; | ||
import { Modal, ModalBody } from 'reactstrap'; | ||
|
||
const AOIModal = ({ setExtent }) => { | ||
const onMatch = (graphics) => { | ||
setExtent(new Extent(graphics[0].attributes.extent)); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<Modal isOpen={true}> | ||
<ModalBody> | ||
<p>What is your area of interest? Search for things like counties, cities, addresses, place names, etc...</p> | ||
<Sherlock | ||
provider={new LocatorSuggestProvider(config.urls.masquerade, 3857)} | ||
modules={{ Graphic }} | ||
onSherlockMatch={onMatch} | ||
/> | ||
</ModalBody> | ||
</Modal> | ||
</div> | ||
); | ||
}; | ||
|
||
AOIModal.propTypes = { | ||
setExtent: propTypes.func.isRequired, | ||
}; | ||
|
||
export default AOIModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.esri-view { | ||
.map-container { | ||
position: absolute; | ||
top: 75px; | ||
bottom: 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import throttle from 'lodash.throttle'; | ||
|
||
const key = 'broadband:map-extent'; | ||
let wired = false; | ||
|
||
export default function persistMapExtent(mapView) { | ||
if (mapView && !wired) { | ||
mapView.watch( | ||
'extent', | ||
throttle(() => { | ||
localStorage.setItem(key, JSON.stringify(mapView.extent)); | ||
}, 1000) | ||
); | ||
|
||
wired = true; | ||
} | ||
|
||
const item = localStorage.getItem(key); | ||
|
||
if (item) { | ||
return JSON.parse(item); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
const config = {}; | ||
const config = { | ||
urls: { | ||
masquerade: 'https://masquerade-kkktr623oa-uc.a.run.app/arcgis/rest/services/UtahLocator/GeocodeServer', | ||
}, | ||
}; | ||
|
||
export default config; |