Skip to content

Commit deb9b54

Browse files
committed
fix(map): prioritize milestone/stop markers over driving on dedup
1 parent 5dca937 commit deb9b54

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

frontend/src/components/RouteMap.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ function MapBounds({ points }: { points: [number, number][] }) {
5252
return null;
5353
}
5454

55+
const TYPE_PRIORITY: Record<MarkerType, number> = {
56+
milestone: 3,
57+
stop: 2,
58+
driving: 1,
59+
};
60+
5561
function markerType(event: TimelineEvent): MarkerType {
5662
const remark = event.remark.toLowerCase();
5763
if (remark.includes("pickup") || remark.includes("dropoff")) return "milestone";
@@ -64,14 +70,16 @@ export function RouteMap({ events }: RouteMapProps) {
6470
const deduped = new Map<string, LocationMarker>();
6571
events.forEach((event, index) => {
6672
if (event.lat === 0 && event.lng === 0) return;
67-
if (!deduped.has(event.location)) {
73+
const type = markerType(event);
74+
const existing = deduped.get(event.location);
75+
if (!existing || TYPE_PRIORITY[type] > TYPE_PRIORITY[existing.type]) {
6876
deduped.set(event.location, {
6977
key: `${event.location}-${index}`,
7078
location: event.location,
7179
remark: event.remark,
7280
lat: event.lat,
7381
lng: event.lng,
74-
type: markerType(event),
82+
type,
7583
});
7684
}
7785
});

0 commit comments

Comments
 (0)