Merged in feat/SW-2241-country-map (pull request #2808)

Feat/SW-2241 country map

Approved-by: Erik Tiekstra
Approved-by: Chuma Mcphoy (We Ahead)
This commit is contained in:
Matilda Landström
2025-09-24 12:04:01 +00:00
parent af4f544b8a
commit 00689607bc
93 changed files with 1876 additions and 600 deletions

View File

@@ -5,6 +5,8 @@ import { useMapViewport } from "./use-map-viewport"
import type { FeatureCollection, GeoJsonProperties, Point } from "geojson"
import type { CityMarkerProperties } from "@/types/components/maps/destinationMarkers"
export function useSupercluster<T extends GeoJsonProperties>(
geojson: FeatureCollection<Point, T>,
superclusterOptions: Supercluster.Options<T, ClusterProperties>
@@ -45,16 +47,29 @@ export function useSupercluster<T extends GeoJsonProperties>(
}
// retrieve the hotel ids included in the cluster
const containedHotels = clusters.map((cluster) => {
const containedHotelIds = clusters.map((cluster) => {
if (cluster.properties?.cluster && typeof cluster.id === "number") {
return clusterer.getLeaves(cluster.id).map((hotel) => Number(hotel.id))
return clusterer
.getLeaves(cluster.id)
.map((location) => String(location.id))
}
return []
})
// retrieve the city ids included in the cluster
const containedCityIds = clusters.map((cluster) => {
if (cluster.properties?.cluster && typeof cluster.id === "number") {
return clusterer
.getLeaves(cluster.id)
.map((city) => city.properties as CityMarkerProperties)
}
return []
})
return {
clusters,
containedHotels,
containedHotelIds,
containedCityIds,
getClusterZoom,
}
}