import { Layer } from "react-map-gl";
import { otherPostamatesLayer } from "./layers-config";
import { useLayersVisibility } from "../../stores/useLayersVisibility";
import { LAYER_IDS } from "./constants";

const typeFilter = ["==", ["get", "type"], "Постамат"];

export const OtherPostamates = () => {
  const { isVisible } = useLayersVisibility();

  return (
    <>
      <Layer
        {...otherPostamatesLayer}
        id={LAYER_IDS.other}
        source={"rivals"}
        source-layer={"public.service_rivals"}
        layout={{
          visibility: isVisible[LAYER_IDS.other] ? "visible" : "none",
        }}
        filter={typeFilter}
      />
    </>
  );
};
