diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx index 3ea0433b..cb6c5f1e 100644 --- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx +++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx @@ -11,7 +11,7 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ import EllipsisVerticalIcon from '@heroicons/react/16/solid/EllipsisVerticalIcon' -import { MapPinIcon, ShareIcon } from '@heroicons/react/24/outline' +import { MapPinIcon, ShareIcon } from '@heroicons/react/24/solid' import PencilIcon from '@heroicons/react/24/solid/PencilIcon' import TrashIcon from '@heroicons/react/24/solid/TrashIcon' import { useState } from 'react' @@ -32,6 +32,7 @@ import TargetDotSVG from '#assets/targetDot.svg' import { useAppState } from '#components/AppShell/hooks/useAppState' import { useGeoDistance } from '#components/Map/hooks/useGeoDistance' import { useHasUserPermission } from '#components/Map/hooks/usePermissions' +import { useReverseGeocode } from '#components/Map/hooks/useReverseGeocode' import { useGetItemTags } from '#components/Map/hooks/useTags' import DialogModal from '#components/Templates/DialogModal' @@ -49,7 +50,7 @@ export function HeaderView({ big = false, truncateSubname = true, hideSubname = false, - showAddress = false, + showAddress = true, }: { item?: Item api?: ItemsApi @@ -78,7 +79,10 @@ export function HeaderView({ const title = item?.name ?? item?.layer?.item_default_name const subtitle = item?.subname - const [address] = useState('') + const { address } = useReverseGeocode( + item?.position?.coordinates as [number, number] | undefined, + showAddress, + ) const params = new URLSearchParams(window.location.search) @@ -181,8 +185,8 @@ export function HeaderView({ return ( <>
-
-
+
+
{avatar && (
)} -
+
{title}
- {showAddress && address && !hideSubname && ( -
- {address} + {showAddress && address && ( +
+ + + {address} +
)} - {subtitle && !hideSubname && ( + {subtitle && !showAddress && (
- {subtitle} + {subtitle}
)}
@@ -235,7 +242,7 @@ export function HeaderView({ hasUserPermission(api?.collectionName!, 'update', item)) && !hideMenu && (
-