From c5c6374d6dd2ebe3cb796d9117a1b3a5f8f5f0ae Mon Sep 17 00:00:00 2001 From: Sebastian Stein Date: Tue, 25 Jun 2024 14:10:58 +0200 Subject: [PATCH] - changed: do not show AddButton in embedded mode or when the user is not logged in --- src/Components/Map/UtopiaMap.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Components/Map/UtopiaMap.tsx b/src/Components/Map/UtopiaMap.tsx index 278949a6..dc8dd10b 100644 --- a/src/Components/Map/UtopiaMap.tsx +++ b/src/Components/Map/UtopiaMap.tsx @@ -17,6 +17,7 @@ import { TagsControl } from "./Subcomponents/Controls/TagsControl"; import { useSelectPosition, useSetMapClicked,useSetSelectPosition } from "./hooks/useSelectPosition"; import { useClusterRef, useSetClusterRef } from "./hooks/useClusterRef"; import { Feature, Geometry as GeoJSONGeometry } from 'geojson'; +import {useAuth} from "../Auth"; // for refreshing map on resize (needs to be implemented) const mapDivRef = React.createRef(); @@ -71,6 +72,10 @@ function UtopiaMap({ embedded != "true" && setEmbedded(false) }, [location]); + const { isAuthenticated } = useAuth(); + + + const onEachFeature = (feature: Feature, layer: L.Layer) => { if (feature.properties) { layer.bindPopup(feature.properties.name); @@ -112,7 +117,9 @@ function UtopiaMap({ }} />} - + {!embedded && isAuthenticated && ( + + )} {selectNewItemPosition != null &&