The LocationPopup component is used to display a detailed information popup for a specific location on a Mapbox map. It renders a popup containing the location's name, address, brand, operational status, categories, and coordinates.
It expects a location prop of type LocationFeature. The component automatically resolves coordinates from geometry.coordinates or properties.coordinates and determines the appropriate icon using the iconMap utility based on the maki property or poi_category array.
import { LocationPopup } from "@/components/location-popup";
import { LocationFeature } from "@/lib/mapbox/utils";
// Example usage within a map component
function MyMap() {
const selectedLocation: LocationFeature = {
properties: {
name: "Coffee Shop",
full_address: "123 Main St",
poi_category: ["cafe", "food"],
operational_status: "active",
mapbox_id: "mapbox_12345"
},
geometry: {
coordinates: [-122.4194, 37.7749]
}
};
return <LocationPopup location={selectedLocation} />;
}