import React, { useMemo } from "react";
import { useSelector } from "react-redux";
import LayerTree from "react-spatial/components/LayerTree";
import useTranslation from "../../utils/useTranslation";
import InfosButton from "../InfosButton";
function DrawLayerMenu() {
  const {
    t
  } = useTranslation();
  const layers = useSelector(state => state.map.layers);
  const drawLayer = useSelector(state => state.map.drawLayer);
  const drawIds = useSelector(state => state.app.drawIds);
  const titles = useMemo(() => {
    return {
      layerShow: t("Layer anzeigen"),
      layerHide: t("Layer verbergen")
    };
  }, [t]);
  if (!drawIds) {
    return null;
  }
  return /*#__PURE__*/React.createElement("div", {
    className: "wkp-draw-layer-menu"
  }, /*#__PURE__*/React.createElement("div", {
    className: "wkp-layer-tree"
  }, /*#__PURE__*/React.createElement(LayerTree, {
    isItemHidden: layer => layer !== drawLayer,
    renderItemContent: (layer, layerTreeComp) => /*#__PURE__*/React.createElement(React.Fragment, null, layer.renderItemContent ? layer.renderItemContent(layerTreeComp) : layerTreeComp.renderItemContent(layer), layer.get("hasInfos") && /*#__PURE__*/React.createElement(InfosButton, {
      selectedInfo: layer
    })),
    layers: layers,
    titles: titles,
    t: t
  })));
}
export default /*#__PURE__*/React.memo(DrawLayerMenu);
//# sourceMappingURL=DrawLayerMenu.js.map