Skip to content

Commit

Permalink
feat(signers-map2): addresssing pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
BLuEScioN committed Jun 13, 2024
1 parent e746950 commit 2d99ca7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
7 changes: 0 additions & 7 deletions src/app/signers/SignersHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ export function SignersHeaderLayout({
</Flex>
<Flex
flexDirection={['column', 'column', 'row', 'row', 'row']}
// gridTemplateColumns={[
// '100%',
// '100%',
// 'repeat(3, 1fr)',
// 'repeat(3, 1fr)',
// 'repeat(3, 1fr)',
// ]}
width="100%"
height="100%"
gap={4}
Expand Down
11 changes: 6 additions & 5 deletions src/app/signers/SignersMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,18 @@ const MarkerClickHandler = ({ markerLatLng }: { markerLatLng: MarkerLatLng | und
const map = useMap();

Check warning on line 195 in src/app/signers/SignersMap.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/signers/SignersMap.tsx#L194-L195

Added lines #L194 - L195 were not covered by tests

const prevMarkerLatLng = useRef<MarkerLatLng | undefined>(markerLatLng);

Check warning on line 197 in src/app/signers/SignersMap.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/signers/SignersMap.tsx#L197

Added line #L197 was not covered by tests

useEffect(() => {
prevMarkerLatLng.current = markerLatLng;

Check warning on line 200 in src/app/signers/SignersMap.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/signers/SignersMap.tsx#L199-L200

Added lines #L199 - L200 were not covered by tests
}, [markerLatLng]);

// A new marker is clicked if the previous marker is undefined and the current marker is defined, or if the lat/lng of the current marker is different from the previous marker
const newMarkerClicked =
(prevMarkerLatLng.current === undefined && markerLatLng !== undefined) ||
(prevMarkerLatLng.current &&
markerLatLng &&
prevMarkerLatLng.current.lat !== markerLatLng.lat) ||
(prevMarkerLatLng.current && markerLatLng && prevMarkerLatLng.current.lng !== markerLatLng.lng);

Check warning on line 209 in src/app/signers/SignersMap.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/signers/SignersMap.tsx#L206-L209

Added lines #L206 - L209 were not covered by tests
useEffect(() => {
prevMarkerLatLng.current = markerLatLng;
}, [markerLatLng]);

useEffect(() => {

Check warning on line 211 in src/app/signers/SignersMap.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/signers/SignersMap.tsx#L211

Added line #L211 was not covered by tests
if (!newMarkerClicked) return;
Expand Down Expand Up @@ -358,8 +361,6 @@ export function SignersMap({
maxBounds={BOUNDS}
>
<TileLayer
// url="https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{r}.png"
// url="https://{s}.basemaps.cartocdn.com/rastertiles/light_nolabels/{z}/{x}/{y}{r}.png"
url={mapUrl}
noWrap={true}
minZoom={1}
Expand Down

0 comments on commit 2d99ca7

Please sign in to comment.