/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/restrict-plus-operands */ import { useEffect, useState } from 'react' import { Link } from 'react-router-dom' import { useAppState } from '#components/AppShell/hooks/useAppState' import { useItems } from '#components/Map/hooks/useItems' import { Item } from '#src/types' export const ContactInfoView = ({ item, heading }: { item: Item; heading: string }) => { const appState = useAppState() const [profileOwner, setProfileOwner] = useState() const items = useItems() useEffect(() => { // eslint-disable-next-line no-console console.log( 'user:', items.find( (i) => i.user_created?.id === item.user_created?.id && i.layer?.itemType.name === appState.userType, ), ) setProfileOwner( items.find( (i) => i.user_created?.id === item.user_created?.id && i.layer?.itemType.name === appState.userType, ), ) // eslint-disable-next-line react-hooks/exhaustive-deps }, [item, items]) return (

{heading}

{profileOwner?.image && (
{profileOwner?.name}
)}

{profileOwner?.name}

{item.contact && (

{item.contact}

)} {item.telephone && (

{item.telephone}

)}
) } // eslint-disable-next-line react/prop-types const ConditionalLink = ({ url, children }) => { const params = new URLSearchParams(window.location.search) if (url) { return {children} } return children }