From 6327ae778827b8ce988f7353887ab3a01e8a3384 Mon Sep 17 00:00:00 2001 From: Anton Tranelis <31516529+antontranelis@users.noreply.github.com> Date: Wed, 11 Jun 2025 10:59:24 +0200 Subject: [PATCH] fix(source): fix index plus button (#239) * 3.0.97 * 3.0.98 * 3.0.99 * fix index plus icon * fix linting --- .../PopupStartEndInput.tsx | 4 +- .../Profile/Subcomponents/PlusButton.tsx | 22 +++++----- .../Templates/OverlayItemsIndexPage.tsx | 41 ++++++++----------- 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.tsx index 35db1452..41097025 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.tsx @@ -9,6 +9,7 @@ export interface StartEndInputProps { labelStyle?: string updateStartValue?: (value: string) => void updateEndValue?: (value: string) => void + containerStyle?: string } /** @@ -20,9 +21,10 @@ export const PopupStartEndInput = ({ labelStyle, updateStartValue, updateEndValue, + containerStyle, }: StartEndInputProps) => { return ( -
+
{hasUserPermission(collection, 'create', undefined, layer) && ( -
- -
+ )} ) diff --git a/src/Components/Templates/OverlayItemsIndexPage.tsx b/src/Components/Templates/OverlayItemsIndexPage.tsx index 68818dfe..19d2c70b 100644 --- a/src/Components/Templates/OverlayItemsIndexPage.tsx +++ b/src/Components/Templates/OverlayItemsIndexPage.tsx @@ -8,7 +8,7 @@ import { useEffect, useRef, useState } from 'react' import { toast } from 'react-toastify' import { useAuth } from '#components/Auth/useAuth' -import { TextInput, TextAreaInput } from '#components/Input' +import { TextInput } from '#components/Input' import { useFilterTags } from '#components/Map/hooks/useFilter' import { useAddItem, useItems, useRemoveItem } from '#components/Map/hooks/useItems' import { useLayers } from '#components/Map/hooks/useLayers' @@ -33,15 +33,13 @@ export const OverlayItemsIndexPage = ({ url, layerName, parameterField, - plusButton = true, }: { layerName: string url: string parameterField?: string - plusButton?: boolean }) => { const [loading, setLoading] = useState(false) - const [addItemPopupType, setAddItemPopupType] = useState('') + const [addItemPopupOpen, setAddItemPopupOpen] = useState(false) // eslint-disable-next-line @typescript-eslint/no-unused-vars const parameterFieldDummy = parameterField @@ -52,12 +50,10 @@ export const OverlayItemsIndexPage = ({ } useEffect(() => { - scroll() - }, [addItemPopupType]) - - useEffect(() => { - setAddItemPopupType('') - }, [layerName]) + if (addItemPopupOpen) { + scroll() + } + }, [addItemPopupOpen]) const tags = useTags() const addTag = useAddTag() @@ -106,7 +102,7 @@ export const OverlayItemsIndexPage = ({ } addItem({ ...formItem, user_created: user ?? undefined, id: uuid, layer, public_edit: !user }) setLoading(false) - setAddItemPopupType('') + setAddItemPopupOpen(false) } const deleteItem = async (item: Item) => { @@ -174,15 +170,18 @@ export const OverlayItemsIndexPage = ({ />
))} - {addItemPopupType === 'place' && ( + {addItemPopupOpen && (
submitNewItem(e)}>
+
+ {layer?.menuText} +
- {layer?.itemType.show_start_end_input && } - + {layer?.itemType.show_start_end_input && ( + + )}