Conversation
Sorry. I was trying to click on the details of the failed PR build and the content moved. I accidentally clicked "ready for review" |
No worries! |
2e1c2be
to
47ff877
Compare
47ff877
to
3a8d75e
Compare
@@ -1,519 +1,276 @@ | |||
import React, { Component, Fragment } from 'react'; | |||
import React, { useEffect, useRef, useState } from 'react'; | |||
import { bool, func, number, shape, string } from 'prop-types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff here isn't really meaningful -- this is an entirely new file, but I deleted the prior one and replaced it with the React-Leaflet implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work switching over to Leaflet. All the interactions are in tact and seem to perform a bit better. I just have a few minor suggestions related to style and zoom behavior.
), | ||
]} | ||
onClose={() => setFacilitiesToDisambiguate(null)} | ||
> | ||
<FacilitiesMapPopup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this in 6ebbd43
html: `<span>${clusterCount}</span>`, | ||
}); | ||
}} | ||
onClusterClick={({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is taken care of by b9d1915 as well: we no longer adjust the zoom level on moving toward the details page, so it'll just keep the existing zoom level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ended up solving this in a different way: viz., we only set the map view for a details page if it is an initial page load, navigating directly to the details page.
? selectedMarkerIcon | ||
: unselectedMarkerIcon | ||
} | ||
onClick={() => navigateToFacilityDetails(f.id)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled this (and also continued adjusting the minZoom setup) in b9d1915
return L.divIcon({ | ||
className: iconClassName, | ||
iconSize, | ||
html: `<span>${clusterCount}</span>`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the application font and tweaking the span style so that the numbers appear more centered.
diff --git a/src/app/src/components/FacilitiesMap.jsx b/src/app/src/components/FacilitiesMap.jsx
index 8669cc1..ca794f1 100644
--- a/src/app/src/components/FacilitiesMap.jsx
+++ b/src/app/src/components/FacilitiesMap.jsx
@@ -214,9 +214,9 @@ function FacilitiesMap({
})();
return L.divIcon({
- className: iconClassName,
+ className: `cluster-icon ${iconClassName}`,
iconSize,
- html: `<span>${clusterCount}</span>`,
+ html: `<span style="margin: -0.1rem; display: block;">${clusterCount}</span>`,
});
}}
onClusterClick={({
diff --git a/src/app/src/styles/css/leafletMap.css b/src/app/src/styles/css/leafletMap.css
index 71c6d98..aea2022 100644
--- a/src/app/src/styles/css/leafletMap.css
+++ b/src/app/src/styles/css/leafletMap.css
@@ -1,3 +1,7 @@
+.cluster-icon {
+ font-family: ff-tisa-sans-web-pro, sans-serif;
+}
+
.cluster-icon-one {
width: 53px;
height: 53px;
Before
After
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool -- I added this in b615822
@@ -7,29 +7,6 @@ export const initialCenter = Object.freeze({ | |||
lng: 5, | |||
}); | |||
|
|||
export const initialZoom = 1; | |||
export const initialZoom = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this in fcf2a55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3a8d75e
to
3f97964
Compare
I set the minZoom to 1 in dd37625 |
fd63ec1 adjusts the map panning behavior: Previously we were setting the view anew each time a new facility details page got pushed onto the stack. Now I've adjusted things so that we only set the view around the facility if user has navigated directly to the details screen without traversing the main facilities search. We discussed this behavior in Slack and determined that it was the preferred behavior. |
@jwalgran I think this is ready for another look! Apologies for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really excellent. A big upgrade in map interactions. I think there is only one thing we need to fix up. Now that we are not zooming on every select, the selection can get out of sync with the map if you select an item from the list that is not in the viewport. I think Google Maps shows the best way of handling this situation, where you don't move the map if you click a result on the map, but do move the map if you click an item in the sidebar.
That makes sense to me -- I'll add this interaction before merging. |
6ebbd43
to
725d4ce
Compare
Going to squash this momentarily but 5e69460 has the changes to make the map panning work like:
I also commented the |
Replace the FacilitiesMap's Google Maps implementation with one which uses Leaflet but otherwise has feature parity.
5e69460
to
ca766cb
Compare
Overview
This PR replaces the existing Google Map component with a React Leaflet map using a Google Basemap (via GoogleMutant, via some React wrappers). I believe it has feature parity with the Google Map component version on staging, although the cluster marker sizes may be slightly different.
Connects #706
Notes
Leaflet.markercluster wants a peer dependency of Leaflet 1.3.something. There's an open PR to fix this by adjusting how it declares its peer dependencies, but the yarn install output here will currently report an incorrect peer dependency. Here's the PR:
Leaflet/Leaflet.markercluster#946
The library seems to work regardless of the peer dependency mismatch, however.
Testing Instructions
./scripts/update
and./scripts/resetdb
and./scripts/server
shell_plus
, set two facilities to live atPoint(0, 0)
. I did this just to make them easily searchable:Hello
in the app and verify that you see two facilities at the same point and that the disambiguation thing works the same as it does on stagingChecklist
fixup!
commits have been squashed