mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 09:54:14 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user