File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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+
5561function 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 } ) ;
You can’t perform that action at this time.
0 commit comments