fix(collections): pins on the map show their place's category (#3073)

The server nests a saved place's category, while the markers and the hover
card read the flat fields a trip place carries, so every pin on a
collection's map was the grey default. The map now hands its places on with
the category's colour, icon and name where the markers look for them.
This commit is contained in:
Maurice
2026-11-12 22:02:05 +01:00
parent 10d1a61614
commit f13a0aa6ee
3 changed files with 45 additions and 2 deletions
@@ -93,6 +93,25 @@ export function mappablePlaces(places: CollectionPlace[]): CollectionPlace[] {
return places.filter(p => p && typeof p.lat === 'number' && typeof p.lng === 'number')
}
/**
* A saved place with its category where the trip map reads it. The server nests a
* collection place's category (`category.color`), the markers and the hover card
* read the flat fields a trip place carries, so every pin here was the grey default
* (#3073).
*/
export function withMarkerCategory(place: CollectionPlace): CollectionPlace & {
category_name: string | null
category_color: string | null
category_icon: string | null
} {
return {
...place,
category_name: place.category?.name ?? null,
category_color: place.category?.color ?? null,
category_icon: place.category?.icon ?? null,
}
}
/**
* Normalise a user-typed link: prepend https:// when there's no scheme so the
* href is absolute (a bare "booking.com" would otherwise resolve relative to the