Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix: render Lucide category icons on map markers instead of text/emoji

Maurice4733955531eb
diff --git a/client/src/components/Map/MapView.tsx b/client/src/components/Map/MapView.tsx
index 85a1e30e5..a35aef5a5 100644
--- a/client/src/components/Map/MapView.tsx
+++ b/client/src/components/Map/MapView.tsx
@@ -1,12 +1,20 @@
-import { useEffect, useRef, useState, useMemo, useCallback } from 'react'
+import { useEffect, useRef, useState, useMemo, useCallback, createElement } from 'react'
import DOM from 'react-dom'
+import { renderToStaticMarkup } from 'react-dom/server'
import { MapContainer, TileLayer, Marker, Tooltip, Polyline, CircleMarker, Circle, useMap } from 'react-leaflet'
import MarkerClusterGroup from 'react-leaflet-cluster'
import L from 'leaflet'
import 'leaflet.markercluster/dist/MarkerCluster.css'
import 'leaflet.markercluster/dist/MarkerCluster.Default.css'
import { mapsApi } from '../../api/client'
-import { getCategoryIcon } from '../shared/categoryIcons'
+import { getCategoryIcon, CATEGORY_ICON_MAP } from '../shared/categoryIcons'
+
+function categoryIconSvg(iconName: string | null | undefined, size: number): string {
+ const IconComponent = (iconName && CATEGORY_ICON_MAP[iconName]) || CATEGORY_ICON_MAP['MapPin']
+ try {
+ return renderToStaticMarkup(createElement(IconComponent, { size, color: 'white', strokeWidth: 2.5 }))
+ } catch { return '' }
+}
import type { Place } from '../../types'
// Fix default marker icons for vite
@@ -85,7 +93,7 @@ function createPlaceIcon(place, orderNumbers, isSelected) {
display:flex;align-items:center;justify-content:center;
cursor:pointer;position:relative;
">
- <span style="font-size:${isSelected ? 18 : 15}px;line-height:1;">${icon}</span>
+ ${categoryIconSvg(place.category_icon, isSelected ? 18 : 15)}
${badgeHtml}
</div>`,
iconSize: [size, size],