From 871e853340391ffa78426df638f05476e07baf6a Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Thu, 11 Jul 2024 12:17:28 +0200 Subject: [PATCH] allow unlisted layers --- src/Components/Map/Layer.tsx | 5 +++-- src/Components/Map/Subcomponents/AddButton.tsx | 4 ++-- src/Components/Map/Subcomponents/Controls/FilterControl.tsx | 2 +- src/Components/Map/Subcomponents/Controls/LayerControl.tsx | 4 +++- src/types.ts | 3 ++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Components/Map/Layer.tsx b/src/Components/Map/Layer.tsx index cecfd051..430d8d49 100644 --- a/src/Components/Map/Layer.tsx +++ b/src/Components/Map/Layer.tsx @@ -45,6 +45,7 @@ export const Layer = ({ customEditLink, customEditParameter, public_edit_items, + listed = true, setItemFormPopup, itemFormPopup, clusterRef @@ -83,8 +84,8 @@ export const Layer = ({ useEffect(() => { - data && setItemsData({ data, children, name, menuIcon, menuText, menuColor, markerIcon, markerShape, markerDefaultColor, markerDefaultColor2, api, itemType, itemNameField, itemSubnameField, itemTextField, itemAvatarField, itemColorField, itemOwnerField, itemTagsField, itemOffersField, itemNeedsField, onlyOnePerOwner, customEditLink, customEditParameter, public_edit_items, setItemFormPopup, itemFormPopup, clusterRef }); - api && setItemsApi({ data, children, name, menuIcon, menuText, menuColor, markerIcon, markerShape, markerDefaultColor, markerDefaultColor2, api, itemType, itemNameField, itemSubnameField, itemTextField, itemAvatarField, itemColorField, itemOwnerField, itemTagsField, itemOffersField, itemNeedsField, onlyOnePerOwner, customEditLink, customEditParameter, public_edit_items, setItemFormPopup, itemFormPopup, clusterRef }); + data && setItemsData({ data, children, name, menuIcon, menuText, menuColor, markerIcon, markerShape, markerDefaultColor, markerDefaultColor2, api, itemType, itemNameField, itemSubnameField, itemTextField, itemAvatarField, itemColorField, itemOwnerField, itemTagsField, itemOffersField, itemNeedsField, onlyOnePerOwner, customEditLink, customEditParameter, public_edit_items, listed, setItemFormPopup, itemFormPopup, clusterRef }); + api && setItemsApi({ data, children, name, menuIcon, menuText, menuColor, markerIcon, markerShape, markerDefaultColor, markerDefaultColor2, api, itemType, itemNameField, itemSubnameField, itemTextField, itemAvatarField, itemColorField, itemOwnerField, itemTagsField, itemOffersField, itemNeedsField, onlyOnePerOwner, customEditLink, customEditParameter, public_edit_items, listed, setItemFormPopup, itemFormPopup, clusterRef }); }, [data, api]) useMapEvents({ diff --git a/src/Components/Map/Subcomponents/AddButton.tsx b/src/Components/Map/Subcomponents/AddButton.tsx index d5f4b794..f5d6c7ff 100644 --- a/src/Components/Map/Subcomponents/AddButton.tsx +++ b/src/Components/Map/Subcomponents/AddButton.tsx @@ -11,7 +11,7 @@ export default function AddButton({ triggerAction }: { triggerAction: React.Disp const canAddItems = () => { let canAdd = false; layers.map(layer => { - if (layer.api?.createItem && hasUserPermission(layer.api.collectionName!, "create", undefined, layer)) canAdd = true; + if (layer.api?.createItem && hasUserPermission(layer.api.collectionName!, "create", undefined, layer) && layer.listed) canAdd = true; }) return canAdd; } @@ -28,7 +28,7 @@ export default function AddButton({ triggerAction }: { triggerAction: React.Disp