Sửa lỗi khi click vào nút bản đồ

This commit is contained in:
2026-06-14 09:48:09 +07:00
parent 5cfb5b9d15
commit b3519c94cd
10 changed files with 89 additions and 51 deletions
+2 -1
View File
@@ -160,7 +160,8 @@ export const ItineraryTimeline = ({ onAddLocation }: { onAddLocation?: (legId: s
<div className="ml-2">
{leg.locations.map((location, idx) => {
const nextLocation = leg.locations[idx + 1];
// Logic quan trọng: Gán điểm cuối chặng này nối với điểm đầu chặng sau
const nextLocation = leg.locations[idx + 1] || legs[legIdx + 1]?.locations[0];
const distanceToNext = nextLocation
? calculateDistance(location.latitude, location.longitude, nextLocation.latitude, nextLocation.longitude)
: null;