import type { LayoutElementProperties } from "@vertigis/web/components"; import { LayoutElement } from "@vertigis/web/components"; import { useWatchCollectionAndRerender } from "@vertigis/web/ui"; import MenuList from "@vertigis/web/ui/MenuList"; import Typography from "@vertigis/web/ui/Typography"; import type { FC } from "react"; import PointOfInterest from "./PointOfInterest"; import type PointsOfInterestModel from "./PointsOfInterestModel"; import "./PointsOfInterest.css"; const PointsOfInterest: FC> = props => { const { model } = props; // Re-render whenever points of interest are added or removed from the // collection. useWatchCollectionAndRerender(model.pointsOfInterest); return ( Points of Interest {model.pointsOfInterest.toArray().map(poi => ( { // This function returns `Promise` which // resolves when the map is done zooming, but in // this case we only need to kick it off and don't // need to wait for it to finish. // // eslint-disable-next-line @typescript-eslint/no-floating-promises model.goto(poi); }} onDelete={() => { model.pointsOfInterest.remove(poi); }} /> ))} ); }; export default PointsOfInterest;