Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle/various bugfixes enhancements updates #212

Merged
merged 5 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 22 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
"ol": "6.12.0",
"ol-contextmenu": "^3.3.2",
"ol-mapbox-style": "^8.2.1",
"proj4": "^2.7.0",
"proj4": "^2.7.5",
"rc-menu": "^9.8.4",
"rc-slider": "^8.7.1",
"re-resizable": "^6.9.0",
"react": "^17.0.1",
"re-resizable": "^6.9.1",
"react": "^17.0.2",
"react-autocomplete": "^1.8.1",
"react-collapsible": "^2.10.0",
"react-color": "^2.19.3",
"react-copy-to-clipboard": "^5.0.3",
"react-copy-to-clipboard": "^5.0.4",
"react-datepicker": "^2.16.0",
"react-device-detect": "^1.15.0",
"react-dom": "^16.14.0",
"react-device-detect": "^1.17.0",
"react-dom": "^17.0.2",
"react-ga4": "^2.0.0",
"react-github-btn": "^1.4.0",
"react-highlight-words": "^0.16.0",
"react-icons": "^4.7.1",
"react-icons": "^4.8.0",
"react-masonry-css": "^1.0.16",
"react-responsive-modal": "^3.6.0",
"react-router-dom": "^4.3.1",
Expand All @@ -37,7 +37,6 @@
"react-sidebar": "^3.0.2",
"react-slick": "^0.25.2",
"react-sortable-hoc": "^2.0.0",
"react-sortable-hoc-ie-optimization": "^0.8.5",
"react-switch": "^5.0.1",
"react-table": "^7.8.0",
"react-table-sticky": "^1.1.3",
Expand Down
37 changes: 1 addition & 36 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"htmlIdentify": false,
"leftClickIdentify": false,
"excludeIdentifyTitleName": false,
"allowIdentifyExport": false,
"showFeedbackMessageOnStartup": false,
"showWhatsNewOnStartup": false,
"showWhatsNewPopupOnStartup": false,
"showTermsOnStartup": true,
"googleAnalyticsID": "G-GC5RRXFML6",

"appStatsUrl": "https://opengis.simcoe.ca/api_v2/public/stats/write/",
"apiUrl": "https://opengis.simcoe.ca/api_v2/",
"apiUrlDev": "http://localhost:8085/",
Expand All @@ -39,40 +39,6 @@
"pushMapNotificationIDs": [1, 5, 6],
"showHelpButtonInsteadOfFeedback": false,
"onCoordinateZoomID": false,
"centerCoords": [-8878504.68, 5543492.45],
"defaultZoom": 10,
"maxZoom": 20,
"controls": {
"rotate": true,
"fullScreen": true,
"zoomInOut": true,
"currentLocation": true,
"zoomExtent": true,
"scale": true,
"scaleLine": true,
"basemap": true
},
"mapTheme": "SIMCOE_COUNTY",
"showFloatingMenuHeader": false,
"showLoadingScreens": false,
"storageKeys": {
"SearchHistory": "searchHistory",
"Draw": "myMaps",
"URLDontShowAgain": "sc_dontshowagain"
},
"onlyStandardCursor": true,
"restrictOriginForUrlWindow": false,
"rightClickMenuVisibility": {
"sc-floating-menu-basic-mode": true,
"sc-floating-menu-property-click": true,
"sc-floating-menu-add-mymaps": true,
"sc-floating-menu-save-map-extent": true,
"sc-floating-menu-report-problem": true,
"sc-floating-menu-identify": true,
"sc-floating-menu-google-maps": false,
"sc-floating-menu-more": true
},

"centerCoords": [-8878504.68, 5543492.45],
"defaultZoom": 10,
"maxZoom": 20,
Expand All @@ -98,7 +64,6 @@
},
"onlyStandardCursor": true,
"restrictOriginForUrlWindow": false,

"rightClickMenuVisibility": {
"sc-floating-menu-basic-mode": true,
"sc-floating-menu-property-click": true,
Expand Down
44 changes: 30 additions & 14 deletions src/header/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Select from "react-select";

// URLS
const googleDirectionsURL = (lat, long) => `https://www.google.com/maps?saddr=Current+Location&daddr=${lat},${long}`;
const searchURL = (apiUrl, searchText, type, muni, limit) => `${apiUrl}public/search/?q=${searchText}&type=${type}&muni=${muni}&limit=${limit}`;
const searchURL = (apiUrl, searchText, type, muni, limit) => `${apiUrl}public/search?q=${searchText}&type=${type}&muni=${muni}&limit=${limit}`;
const searchInfoURL = (apiUrl, locationID) => `${apiUrl}public/search/${locationID}`;
const searchTypesURL = (apiUrl) => `${apiUrl}public/search/types`;

Expand Down Expand Up @@ -78,7 +78,7 @@ class Search extends Component {
window.emitter.addListener("tocLoaded", () => this.onInitialSearch());

// LISTEN FOR EXTERNAL COMPONENT SEARCH
window.emitter.addListener("searchItem", (searchType, searchText, hidden = false) => this.onSearch(searchType, searchText, hidden));
window.emitter.addListener("searchItem", (searchType, searchText, hidden = false, timeout = undefined) => this.onSearch(searchType, searchText, hidden, timeout));

this.state = {
value: "",
Expand Down Expand Up @@ -109,7 +109,13 @@ class Search extends Component {

componentDidMount() {
helpers.waitForLoad(["map", "settings"], Date.now(), 30, () => {
if (window.config.municipality !== undefined) this.setState({ municipality: window.config.municipality });
let muni = window.config.municipality;
if (!muni) {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
muni = urlParams.get("MUNI");
}
if (muni) this.setState({ municipality: muni });
this.apiUrl = window.config.apiUrl;
this.storageKey = window.config.storageKeys.SearchHistory;
if (window.config.search) {
Expand Down Expand Up @@ -169,7 +175,7 @@ class Search extends Component {
this.onSearch(search_type, search);
};

onSearch = (search_type = undefined, search = undefined, hidden = false) => {
onSearch = (search_type = undefined, search = undefined, hidden = false, timeout = undefined) => {
if (!search && search === null) return;
if (!search_type && search_type === null) {
search_type = "All";
Expand All @@ -181,7 +187,7 @@ class Search extends Component {
});
helpers.getJSON(encodeURI(searchURL(this.apiUrl, search, search_type, this.state.municipality, 1)), (responseJson) => {
if (responseJson[0] !== undefined && responseJson[0].location_id !== null && responseJson[0].location_id !== undefined) {
helpers.getJSON(searchInfoURL(this.apiUrl, responseJson[0].location_id), (result) => this.jsonCallback(result, hidden));
helpers.getJSON(searchInfoURL(this.apiUrl, responseJson[0].location_id), (result) => this.jsonCallback(result, hidden, timeout));
}
});
};
Expand Down Expand Up @@ -278,7 +284,7 @@ class Search extends Component {
}
}

jsonCallback(result, hidden = false) {
jsonCallback(result, hidden = false, timeout = undefined) {
if (!hidden) {
const savedResult = Object.assign({}, result);
delete savedResult["geojson"];
Expand Down Expand Up @@ -336,6 +342,18 @@ class Search extends Component {

searchGeoLayer.setZIndex(300);
searchIconLayer.setZIndex(300);
} else if (hidden && timeout) {
// SET SOURCE
fullFeature.setProperties({
label: result.alias ? result.alias : result.name,
name: result.name,
is_open_data: result.is_open_data !== undefined && result.is_open_data !== null ? result.is_open_data : true,
});
searchGeoLayer.getSource().addFeature(fullFeature);
searchGeoLayer.setZIndex(300);
setTimeout(() => {
searchGeoLayer.getSource().clear();
}, timeout);
}

const zoomFactor = window.config.featureHighlitStyles && window.config.featureHighlitStyles["zoomFactor"] >= 0 ? window.config.featureHighlitStyles["zoomFactor"] : 1;
Expand All @@ -359,8 +377,6 @@ class Search extends Component {
window.map.getView().setZoom(window.map.getView().getZoom() - zoomFactor);
}

//fullFeature.setStyle(myMapsHelpers.getDefaultDrawStyle([255, 0, 0, 0.8], false, 2, fullFeature.getGeometry().getType()));
//fullFeature.setStyle(defaultStyle);
if (result.geojson.indexOf("Point") !== -1) {
const pointStyle = new Style({
image: new CircleStyle({
Expand Down Expand Up @@ -389,15 +405,15 @@ class Search extends Component {

fullFeature.setStyle(pointStyle);
} else {
let defaultStyle = drawingHelpers.getDefaultDrawStyle(
let defaultStyle = drawingHelpers.getDefaultDrawStyle({
drawColor:
window.config.featureHighlitStyles && window.config.featureHighlitStyles["stroke"] !== null && window.config.featureHighlitStyles["stroke"] !== undefined
? window.config.featureHighlitStyles["stroke"]
: [255, 0, 0, 0.8],
false,
window.config.featureHighlitStyles && window.config.featureHighlitStyles["strokeWidth"] ? window.config.featureHighlitStyles["strokeWidth"] : 2,

fullFeature.getGeometry().getType()
);
isText: false,
strokeWidth: window.config.featureHighlitStyles && window.config.featureHighlitStyles["strokeWidth"] ? window.config.featureHighlitStyles["strokeWidth"] : 2,
pointType: fullFeature.getGeometry().getType(),
});
defaultStyle.setFill(
new Fill({
color:
Expand Down
Loading