You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
import { Layer } from "react-map-gl";
|
|
import { approvePointLayer } from "./layers-config";
|
|
import { useLayersVisibility } from "../../stores/useLayersVisibility";
|
|
import { STATUSES } from "../../config";
|
|
import { useRegionFilterExpression } from "./useRegionFilterExpression";
|
|
import { LAYER_IDS } from "./constants";
|
|
import { useOnApprovalPointsFilters } from "../../stores/useOnApprovalPointsFilters";
|
|
|
|
const statusExpression = ["==", ["get", "status"], STATUSES.onApproval];
|
|
|
|
export const OnApprovalPoints = () => {
|
|
const { isVisible } = useLayersVisibility();
|
|
const {
|
|
filters: { region },
|
|
} = useOnApprovalPointsFilters();
|
|
const regionFilterExpression = useRegionFilterExpression(region);
|
|
|
|
const filter = regionFilterExpression
|
|
? ["all", statusExpression, regionFilterExpression]
|
|
: statusExpression;
|
|
|
|
return (
|
|
<>
|
|
<Layer
|
|
{...approvePointLayer}
|
|
id={LAYER_IDS.approve}
|
|
source={"points"}
|
|
source-layer={"public.service_points_with_dist"}
|
|
layout={{
|
|
visibility: isVisible[LAYER_IDS.approve] ? "visible" : "none",
|
|
}}
|
|
filter={filter}
|
|
/>
|
|
</>
|
|
);
|
|
};
|