optimizations for unlisted user items

This commit is contained in:
Anton Tranelis 2024-07-11 13:57:11 +02:00
parent 871e853340
commit ab4d60c950
3 changed files with 4 additions and 3 deletions

View File

@ -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);

View File

@ -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 && (
<ContactInfo name={item.user_created.first_name} avatar={item.user_created.avatar} email={item.contact} telephone={item.telephone} />
<ContactInfo name={profile?.name ? profile.name : item.user_created.first_name} avatar={profile?.image ? profile.image : item.user_created.avatar} email={item.contact} telephone={item.telephone} />
)}
{/* Description Section */}

View File

@ -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 },