import { Button, Spin, Tooltip } from "antd"; import { CATEGORIES, MODES, STATUSES } from "../../config"; import { useMode } from "../../stores/useMode"; import { LAYER_IDS } from "../Layers/constants"; import { PopupWrapper } from "./PopupWrapper"; import { PendingPointPopup } from "./mode-popup/PendingPointPopup"; import { OnApprovalPointPopup } from "./mode-popup/OnApprovalPointPopup"; import { WorkingPointPopup } from "./mode-popup/WorkingPointPopup"; import { FeatureProperties } from "./mode-popup/FeatureProperties"; import { usePopup } from "../../stores/usePopup.js"; import { PanoramaIcon } from "../../icons/PanoramaIcon"; import { useGetPopupPoints } from "../../api.js"; import { doesMatchFilter } from "../../utils.js"; import Checkbox from "antd/es/checkbox/Checkbox"; import { usePointSelection } from "../../stores/usePointSelection.js"; import { usePendingPointsFilters } from "../../stores/usePendingPointsFilters.js"; const SingleFeaturePopup = ({ feature, point }) => { const { mode } = useMode(); const isRivals = feature.layer?.id.includes(LAYER_IDS.pvz) || feature.layer?.id.includes(LAYER_IDS.other); const isPendingPoint = feature.properties.status === STATUSES.pending; const isWorkingPoint = feature.properties.status === STATUSES.working; if (isRivals) { return ; } if (mode === MODES.ON_APPROVAL && !isPendingPoint) { return ; } if (mode === MODES.WORKING && isWorkingPoint) { return ; } if (mode === MODES.PENDING && isPendingPoint) return ; return ; }; const MultipleFeaturesPopup = ({ features, points }) => { const { setPopup } = usePopup(); const { selection, include, exclude } = usePointSelection(); const { filters, ranges } = usePendingPointsFilters(); return (
{features.map((feature) => { const featureId = feature.properties.id; const point = points.find(p => p.id === featureId); const isSelected = (doesMatchFilter(filters, ranges, feature) && !selection.excluded.has(featureId)) || selection.included.has(featureId); const handleSelect = () => { if (isSelected) { exclude(featureId); } else { include(featureId); } }; return (
{feature.properties.status === STATUSES.pending && ( )}
); })}
); }; const YandexPanoramaLink = ({ lat, lng }) => { const link = `https://yandex.ru/maps/?panorama[point]=${lng},${lat}` return ( ); } export const MapPopup = ({ features, lat, lng, onClose }) => { const {data: points, isLoading} = useGetPopupPoints(features); const getContent = () => { if (features.length === 1) { return ; } return ; }; return ( {isLoading ? : getContent()} ); };