From 947b21c5b8b402cce27c9a5f61ba4502364735a9 Mon Sep 17 00:00:00 2001 From: Florian Sommariva <1926041+dtrucs@users.noreply.github.com> Date: Mon, 23 Sep 2024 16:47:51 +0200 Subject: [PATCH] Improve map annotation style for HDViewpoints --- .../components/ViewPointHD/AnnotationItem.tsx | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/Map/components/ViewPointHD/AnnotationItem.tsx b/frontend/src/components/Map/components/ViewPointHD/AnnotationItem.tsx index 5120f7ff9..a5dd51af8 100644 --- a/frontend/src/components/Map/components/ViewPointHD/AnnotationItem.tsx +++ b/frontend/src/components/Map/components/ViewPointHD/AnnotationItem.tsx @@ -6,6 +6,7 @@ import { Circle, CircleMarker, Marker, Polygon, Polyline, Tooltip, useMap } from import Image from 'next/image'; import { TrekMarker } from 'components/Map/Markers/TrekMarker'; import { optimizeAndDefineColor } from 'stylesheet'; +import { cn } from 'services/utils/cn'; type Props = { geometry: Geometry; @@ -39,12 +40,12 @@ const MetaData = ({ properties }: { properties: GeoJsonProperties }) => { return ( - + {Boolean(properties.category?.label) && ( - <> + {properties.category.label} - + )} {properties.name} @@ -70,6 +71,8 @@ export const AnnotationItem = ({ geometry, properties, id }: Props) => { ); } + const annotationType = properties?.category?.id as string; + if (geometry.type === 'Point' || geometry.type === 'MultiPoint') { const coordinatesAsMultiPoint = geometry.type === 'Point' ? [geometry.coordinates] : geometry.coordinates; @@ -93,7 +96,10 @@ export const AnnotationItem = ({ geometry, properties, id }: Props) => { } return ( { return ( [lng, lat])} > @@ -140,7 +149,14 @@ export const AnnotationItem = ({ geometry, properties, id }: Props) => { const radius = Math.sqrt(Math.pow(diagonal, 2) / 2); return ( - + ); @@ -152,7 +168,10 @@ export const AnnotationItem = ({ geometry, properties, id }: Props) => { {coordinatesAsMultiPolygon.map((group, index) => ( line.map<[number, number]>(([lat, lng]) => [lng, lat]))} >