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

Stop scroll capture on crash map and upgrade react-map-gl to v7 #1398

Merged
merged 35 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4d62255
Remove unused LocationEditMap component
mddilley Mar 7, 2024
575c9c4
Remove location map draw toolbar; uninstall react-map-gl-draw dependency
mddilley Mar 12, 2024
bbbf667
Upgrade react-map-gl and mapbox-gl; comment out broken code
mddilley Mar 12, 2024
1ed0990
Update map settings and make it render
mddilley Mar 12, 2024
0eed3e3
Show nav and full screen controls
mddilley Mar 12, 2024
0b5f4c4
Fix marker position and pin styles so they track position correctly
mddilley Mar 12, 2024
b90a7cc
Move shared map config into params obj; fix mapStyle render
mddilley Mar 13, 2024
6144088
Update browserlist values; add defaults for initialState
mddilley Mar 13, 2024
9e75b70
Convert basic CrashEditCoords features
mddilley Mar 13, 2024
af22cb6
Add missing css import
mddilley Mar 13, 2024
67ed1dd
Merge branch 'md-15867-stop-scroll-capture' into md-15867-edit-coords…
mddilley Mar 13, 2024
c63da80
Reimplement marker dragging and animations
mddilley Mar 13, 2024
369421c
Use rest of CrashEditCoordsMap props; update handle form submit
mddilley Mar 13, 2024
65316a9
Update update form reset and cancel handlers
mddilley Mar 13, 2024
9da9886
Fix maxBounds and remove old code that is covered
mddilley Mar 13, 2024
025110d
Fix maxBounds typo
mddilley Mar 14, 2024
ff8bbc3
Merge branch 'md-15867-stop-scroll-capture' into md-15867-edit-coords…
mddilley Mar 14, 2024
44e78db
Merge branch 'master' into md-15867-stop-scroll-capture
mddilley Mar 14, 2024
ac98036
Merge branch 'md-15867-stop-scroll-capture' into md-15867-edit-coords…
mddilley Mar 14, 2024
2a72d5a
Jump map to new coords on reset; close map after reset
mddilley Mar 14, 2024
6043754
Add isSubmitting to disable buttons on form submit
mddilley Mar 14, 2024
3127ea9
Show location polygon on map
mddilley Mar 14, 2024
fd4a03c
Initialize map to location polygon with padding
mddilley Mar 14, 2024
c88020c
Remove old code and fix initial latitude
mddilley Mar 14, 2024
90c219e
Resize on load to match diagram height
mddilley Mar 14, 2024
c327643
Merge branch 'md-15867-stop-scroll-capture' into md-15867-edit-coords…
mddilley Mar 14, 2024
d6fa913
Add env helper file and use prod s3 path for crash diagrams if local
mddilley Mar 15, 2024
7c92430
Merge branch 'md-15867-edit-coords-map' into md-15867-location-map
mddilley Mar 15, 2024
5eb16f4
Remove another unused pkg from the LocationEditMap
mddilley Mar 15, 2024
1625fda
Add helper to truncate lat/lon and use in CrashEditLatLonForm
mddilley Mar 19, 2024
46c5ecc
Merge branch 'md-15867-edit-coords-map' into md-15867-location-map
mddilley Mar 19, 2024
d79918c
Remove coop gestures from crash edit map
mddilley Mar 20, 2024
1c98de7
Merge branch 'md-15867-edit-coords-map' into md-15867-location-map
mddilley Mar 20, 2024
9311e06
Merge pull request #1400 from cityofaustin/md-15867-location-map
mddilley Mar 22, 2024
6bd8b4b
Merge pull request #1399 from cityofaustin/md-15867-edit-coords-map
mddilley Mar 22, 2024
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
4,834 changes: 528 additions & 4,306 deletions atd-vze/package-lock.json

Large diffs are not rendered by default.

30 changes: 18 additions & 12 deletions atd-vze/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"@coreui/icons": "0.3.0",
"@coreui/react": "^2.5.1",
"@handsontable/react": "^3.1.3",
"@math.gl/web-mercator": "^3.6.3",
"@turf/bbox": "^6.5.0",
"@turf/difference": "6.0.1",
"apollo-boost": "^0.4.4",
Expand All @@ -37,9 +36,8 @@
"graphql": "^14.4.2",
"handsontable": "12.1.3",
"lodash.get": "^4.4.2",
"mapbox-gl": "^0.47.0",
"mapbox-gl": "^3.2.0",
"multiselect-react-dropdown": "^2.0.25",
"nebula.gl": "^0.15.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-apollo": "^3.0.0",
Expand All @@ -49,9 +47,7 @@
"react-csv-reader": "^3.0.6",
"react-datepicker": "^2.9.6",
"react-dom": "^16.8.6",
"react-map-gl": "^5.1.1",
"react-map-gl-draw": "^0.15.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package was only used by the unneeded LocationEditMap component removed in this PR. It isn't compatible with the new react-map-gl version anyways.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✌️

"react-map-gl-geocoder": "^2.0.11",
"react-map-gl": "^7.1.7",
"react-router-config": "^5.0.1",
"react-router-dom": "^5.1.2",
"react-test-renderer": "^16.8.6",
Expand Down Expand Up @@ -84,12 +80,22 @@
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 9",
"not op_mini all"
],
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all",
"not safari < 10",
"not chrome < 51",
"not android < 5",
"not ie < 12"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}",
Expand Down
1 change: 1 addition & 0 deletions atd-vze/src/helpers/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const isDev = window.location.hostname === "localhost";
24 changes: 24 additions & 0 deletions atd-vze/src/helpers/map.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import React from "react";
import { Source, Layer } from "react-map-gl";

const TOKEN = process.env.REACT_APP_MAPBOX_TOKEN;
// This API key is managed by CTM. Contact help desk for maintenance and troubleshooting.
const NEARMAP_KEY = process.env.REACT_APP_NEARMAP_KEY;

export const defaultInitialState = {
latitude: 30.2747,
longitude: -97.7406,
zoom: 17,
};

export const mapParameters = {
touchPitch: false,
dragRotate: false,
boxZoom: false,
maxBounds: [[-99, 29], [-96, 32]],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love the touch of making a bounding box so you cant go exploring the whole planet anymore!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

mapboxAccessToken: TOKEN,
mapStyle: "mapbox://styles/mapbox/satellite-streets-v11",
};

export const LOCATION_MAP_CONFIG = {
mapStyle: "mapbox://styles/mapbox/satellite-streets-v11",
sources: {
Expand Down Expand Up @@ -105,3 +121,11 @@ export const LabeledAerialSourceAndLayer = () => {
</>
);
};

/**
* Shorten a coordinate to 6 decimal places
* @param {string|number} coordinate - latitude or longitude
* @returns {string} - truncated coordinate
*/
export const truncateCoordinate = coordinate =>
parseFloat(coordinate).toFixed(6);
3 changes: 2 additions & 1 deletion atd-vze/src/views/Crashes/CrashDiagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import {
} from "reactstrap";
import axios from "axios";
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
import { isDev } from "../../helpers/environment";

const CrashDiagram = props => {
const [rotation, setRotation] = useState(0);

// Set S3 folder for diagram depending on environment
const s3Folder =
process.env.NODE_ENV === "production" ? "production" : "staging";
process.env.NODE_ENV === "production" || isDev ? "production" : "staging";

const requestCR3 = () => {
const requestUrl = `${process.env.REACT_APP_CR3_API_DOMAIN}/cr3/download/${props.crashId}`;
Expand Down
Loading