-
-
+
+ )
+ }
+
+ const getListingsCombined = () => {
+ return (
+
+
-
+
)
}
diff --git a/sites/public/src/components/listings/ListingsList.tsx b/sites/public/src/components/listings/ListingsList.tsx
index 07be2e2566..26e4e23196 100644
--- a/sites/public/src/components/listings/ListingsList.tsx
+++ b/sites/public/src/components/listings/ListingsList.tsx
@@ -1,9 +1,10 @@
import * as React from "react"
-import { Listing } from "@bloom-housing/shared-helpers/src/types/backend-swagger"
-import { Heading } from "@bloom-housing/ui-seeds"
+import { useMap } from "@vis.gl/react-google-maps"
+import { Listing, ListingMapMarker } from "@bloom-housing/shared-helpers/src/types/backend-swagger"
+import { Heading, Button } from "@bloom-housing/ui-seeds"
import { ZeroListingsItem } from "@bloom-housing/doorway-ui-components"
import { LoadingOverlay, t, InfoCard, LinkButton } from "@bloom-housing/ui-components"
-import { getListings } from "../../lib/helpers"
+import { getBoundsZoomLevel, getListings } from "../../lib/helpers"
import { Pagination } from "./Pagination"
import styles from "./ListingsCombined.module.scss"
@@ -13,9 +14,14 @@ type ListingsListProps = {
lastPage: number
onPageChange: (page: number) => void
loading: boolean
+ mapMarkers: ListingMapMarker[] | null
}
const ListingsList = (props: ListingsListProps) => {
+ const map = useMap()
+
+ if (!map) return null
+
const listingsDiv = (
@@ -25,7 +31,28 @@ const ListingsList = (props: ListingsListProps) => {
{getListings(props.listings)}
) : (
- {/* */}
+ {props.mapMarkers.length > 0 && (
+
+ )}
)}
diff --git a/sites/public/src/components/listings/ListingsMap.tsx b/sites/public/src/components/listings/ListingsMap.tsx
index 3c2c5c3be2..a10444da63 100644
--- a/sites/public/src/components/listings/ListingsMap.tsx
+++ b/sites/public/src/components/listings/ListingsMap.tsx
@@ -1,6 +1,5 @@
import React, { useState } from "react"
-import { APIProvider, Map } from "@vis.gl/react-google-maps"
-import { useJsApiLoader } from "@react-google-maps/api"
+import { Map } from "@vis.gl/react-google-maps"
import { Heading } from "@bloom-housing/ui-seeds"
import { t } from "@bloom-housing/ui-components"
import { ListingMapMarker } from "@bloom-housing/shared-helpers/src/types/backend-swagger"
@@ -60,16 +59,10 @@ const getMarkers = (listings: ListingMapMarker[]) => {
}
const ListingsMap = (props: ListingsMapProps) => {
- const { isLoaded } = useJsApiLoader({
- googleMapsApiKey: props.googleMapsApiKey,
- })
-
const [infoWindowIndex, setInfoWindowIndex] = useState
(null)
const markers: MapMarkerData[] | null = getMarkers(props.listings)
- if (!isLoaded) return <>>
-
return (
)
}
diff --git a/sites/public/src/components/listings/MapClusterer.tsx b/sites/public/src/components/listings/MapClusterer.tsx
index 39a2ef3c1d..8d7f9a6f96 100644
--- a/sites/public/src/components/listings/MapClusterer.tsx
+++ b/sites/public/src/components/listings/MapClusterer.tsx
@@ -186,6 +186,10 @@ export const MapClusterer = ({
return
} else {
map.fitBounds(bounds, document.getElementById("listings-map").clientWidth * 0.05)
+ if (visibleMarkers.length === 1) {
+ const zoomLevel = getBoundsZoomLevel(bounds)
+ map.setZoom(zoomLevel - 7)
+ }
setTimeout(() => {
setIsFirstBoundsLoad(false)
}, 1000)