From cef4ab8fb6a5e9a43d37845e06c8633bd8c5605b Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Sun, 24 Mar 2024 14:07:54 +0100 Subject: [PATCH] removed update position in header of project explorer --- .../Map/Subcomponents/ItemPopupComponents/HeaderView.tsx | 9 +++++---- src/Components/Map/Subcomponents/ItemViewPopup.tsx | 2 +- src/Components/Map/UtopiaMap.tsx | 6 +++--- src/Components/Profile/OverlayItemProfile.tsx | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx index 585ca4b8..2180e56f 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx @@ -10,7 +10,7 @@ import { useSetSelectPosition } from "../../hooks/useSetItemPosition"; -export function HeaderView({ item, api, editCallback, deleteCallback, itemNameField, itemAvatarField, loading, hideMenu = false, big = false }: { +export function HeaderView({ item, api, editCallback, deleteCallback, itemNameField, itemAvatarField, loading, hideMenu = false, big = false, updatePosition = false }: { item: Item, api?: ItemsApi, editCallback?: any, @@ -19,7 +19,8 @@ export function HeaderView({ item, api, editCallback, deleteCallback, itemNameFi itemAvatarField?: string, loading?: boolean, hideMenu?: boolean, - big?: boolean + big?: boolean, + updatePosition?: boolean }) { @@ -69,8 +70,8 @@ export function HeaderView({ item, api, editCallback, deleteCallback, itemNameFi } - {((api?.updateItem && hasUserPermission(api.collectionName!, "update", item))) &&
  • - setSelectPosition(item)}> + {((api?.updateItem && hasUserPermission(api.collectionName!, "update", item))) && updatePosition &&
  • + {setSelectPosition(item), navigate("/")}}> diff --git a/src/Components/Map/Subcomponents/ItemViewPopup.tsx b/src/Components/Map/Subcomponents/ItemViewPopup.tsx index 785a893f..90c883e3 100644 --- a/src/Components/Map/Subcomponents/ItemViewPopup.tsx +++ b/src/Components/Map/Subcomponents/ItemViewPopup.tsx @@ -61,7 +61,7 @@ export const ItemViewPopup = React.forwardRef((props: ItemViewPopupProps, ref: a return (
    - +
    {props.children ? diff --git a/src/Components/Map/UtopiaMap.tsx b/src/Components/Map/UtopiaMap.tsx index 76b9c36a..697691ef 100644 --- a/src/Components/Map/UtopiaMap.tsx +++ b/src/Components/Map/UtopiaMap.tsx @@ -47,12 +47,12 @@ function UtopiaMap({ document.querySelector('meta[property="og:description"]')?.setAttribute("content", `${document.querySelector('meta[name="description"]')?.getAttribute("content")}`); console.log(e.latlng.lat + ',' + e.latlng.lng); - if (props.selectNewItemPosition != null) { - if ('menuIcon' in props.selectNewItemPosition) { + if (selectNewItemPosition != null) { + if ('menuIcon' in selectNewItemPosition) { props.setItemFormPopup({ layer: props.selectNewItemPosition, position: e.latlng }) props.setSelectNewItemPosition(null) } - if ('position' in props.selectNewItemPosition) { + if ('position' in selectNewItemPosition) { const position = new Geometry(e.latlng.lng,e.latlng.lat); itemUpdate({...selectNewItemPosition as Item, position: position }) setSelectNewItemPosition(null); diff --git a/src/Components/Profile/OverlayItemProfile.tsx b/src/Components/Profile/OverlayItemProfile.tsx index 5c829f94..a138af3a 100644 --- a/src/Components/Profile/OverlayItemProfile.tsx +++ b/src/Components/Profile/OverlayItemProfile.tsx @@ -237,7 +237,7 @@ export function OverlayItemProfile() { <> - navigate("/edit-item/" + item.id)} big /> + navigate("/edit-item/" + item.id)} big updatePosition/>