From ab4d60c950f3529ed00eae94bcf4615279d97005 Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Thu, 11 Jul 2024 13:57:11 +0200 Subject: [PATCH] optimizations for unlisted user items --- src/Components/Map/Subcomponents/Controls/SearchControl.tsx | 2 +- src/Components/Profile/OverlayItemProfile.tsx | 3 ++- src/Components/Profile/OverlayItemProfileSettings.tsx | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx index 2d32a070..d00a534f 100644 --- a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx +++ b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx @@ -65,7 +65,7 @@ export const SearchControl = () => { setItemsResults(items.filter(item => { if (item.layer?.itemNameField) item.name = getValue(item, item.layer.itemNameField) if (item.layer?.itemTextField) item.text = getValue(item, item.layer.itemTextField) - return value.length > 2 && (item.name?.toLowerCase().includes(value.toLowerCase()) || item.text?.toLowerCase().includes(value.toLowerCase())) + return value.length > 2 && ((item.layer?.listed && item.name?.toLowerCase().includes(value.toLowerCase()) || item.text?.toLowerCase().includes(value.toLowerCase()))) })) let phrase = value; if (value.startsWith("#")) phrase = value.substring(1); diff --git a/src/Components/Profile/OverlayItemProfile.tsx b/src/Components/Profile/OverlayItemProfile.tsx index 0c592882..bde728b7 100644 --- a/src/Components/Profile/OverlayItemProfile.tsx +++ b/src/Components/Profile/OverlayItemProfile.tsx @@ -68,6 +68,7 @@ export function OverlayItemProfile() { scroll(); }, [addItemPopupType]) + const profile = items.find(i => (i.user_created?.id === item.id) && i.layer?.itemType.name === "user"); const updateActiveTab = (id: number) => { setActiveTab(id); @@ -304,7 +305,7 @@ export function OverlayItemProfile() { {item.layer?.itemType.onepager && <> {item.user_created.first_name && ( - + )} {/* Description Section */} diff --git a/src/Components/Profile/OverlayItemProfileSettings.tsx b/src/Components/Profile/OverlayItemProfileSettings.tsx index aa404dd7..2a21d4cb 100644 --- a/src/Components/Profile/OverlayItemProfileSettings.tsx +++ b/src/Components/Profile/OverlayItemProfileSettings.tsx @@ -205,7 +205,7 @@ export function OverlayItemProfileSettings() { position: item.position, contact: contact, telephone: telephone, - markerIcon: markerIcon, + ...markerIcon && {markerIcon: markerIcon}, next_appointment: nextAppointment, ...image.length > 10 && { image: image }, ...offers.length > 0 && { offers: offer_updates },