From 090155c6124584b4d12a9fa154bc953bc50a3a9d Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Thu, 2 May 2024 14:40:19 +0200 Subject: [PATCH] small fixes --- src/Components/Input/TextInput.tsx | 2 +- .../ItemPopupComponents/TextView.tsx | 1 + src/Components/Profile/ActionsButton.tsx | 16 ++++++++++++---- src/Components/Profile/OverlayItemProfile.tsx | 5 ++++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Components/Input/TextInput.tsx b/src/Components/Input/TextInput.tsx index c9b91d8e..8d669a19 100644 --- a/src/Components/Input/TextInput.tsx +++ b/src/Components/Input/TextInput.tsx @@ -18,7 +18,7 @@ type InputTextProps = { export function TextInput({labelTitle, labelStyle, type, dataField, containerStyle, inputStyle, defaultValue, placeholder, autocomplete, updateFormValue} : InputTextProps){ return( -
+
{labelTitle ? diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx index f628ce99..c5a9352d 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx @@ -86,6 +86,7 @@ export const TextView = ({ item, truncate = false, itemTextField}: { item?: Item const CustomExternalLink = ({ href, children }) => ( {children} ); const CustomHashTagLink = ({ children, tag, item }) => { diff --git a/src/Components/Profile/ActionsButton.tsx b/src/Components/Profile/ActionsButton.tsx index 534bce56..ba916eb2 100644 --- a/src/Components/Profile/ActionsButton.tsx +++ b/src/Components/Profile/ActionsButton.tsx @@ -4,6 +4,7 @@ import DialogModal from "../Templates/DialogModal"; import { useItems } from "../Map/hooks/useItems"; import { HeaderView } from "../Map/Subcomponents/ItemPopupComponents/HeaderView"; import { Item } from "../../types"; +import { TextInput } from "../Input"; export function ActionButton({ item, triggerAddButton, triggerItemSelected, existingRelations, itemType, color = "#3D3846", collection = "items" }: { triggerAddButton?: any, @@ -16,13 +17,15 @@ export function ActionButton({ item, triggerAddButton, triggerItemSelected, exis }) { const hasUserPermission = useHasUserPermission(); const [modalOpen, setModalOpen] = useState(false); + const [search, setSearch] = useState(""); + const items = useItems(); const filterdItems = items.filter(i => !itemType || i.layer?.itemType.name == itemType).filter(i => !existingRelations.some(s => s.id == i.id)).filter(i => i.id != item.id) - + return ( <>{hasUserPermission(collection, "update", item) && <> @@ -37,9 +40,14 @@ export function ActionButton({ item, triggerAddButton, triggerItemSelected, exis }
- (setModalOpen(false))} className="!tw-max-w-2xl tw-bg-base-200"> -
- {filterdItems.map(i =>
{ triggerItemSelected(i.id); setModalOpen(false) }}> + (setModalOpen(false))} className="!tw-w-xl !sm:tw-w-2xl tw-min-h-80 tw-bg-base-200"> + { setSearch(val) }}> +
+ {filterdItems.filter(item => { + return search === '' + ? item : + item.name.toLowerCase().includes(search.toLowerCase()); + }).map(i =>
{ triggerItemSelected(i.id); setModalOpen(false) }}>
)}
diff --git a/src/Components/Profile/OverlayItemProfile.tsx b/src/Components/Profile/OverlayItemProfile.tsx index 2592fdd9..a47721fd 100644 --- a/src/Components/Profile/OverlayItemProfile.tsx +++ b/src/Components/Profile/OverlayItemProfile.tsx @@ -106,7 +106,7 @@ export function OverlayItemProfile() { item && setRelations(current => [...current, item]) }) - }, [item,items]) + }, [item, items]) useEffect(() => { @@ -279,6 +279,9 @@ export function OverlayItemProfile() {
updateActiveTab(1)} />
+ {item.layer?.itemType.show_start_end && + + }