💄 Trip itinerary: alternate day colors and connect singleton days

This commit is contained in:
itskovacs 2025-08-06 22:36:59 +02:00
parent ac2d217587
commit 5a7c58241c

View File

@ -334,10 +334,7 @@ export class TripComponent implements AfterViewInit {
this.totalPrice = this.totalPrice =
this.trip?.days this.trip?.days
.flatMap((d) => d.items) .flatMap((d) => d.items)
.reduce( .reduce((price, item) => price + (item.price ?? 0), 0) ?? 0;
(price, item) => price + (item.price ?? item.place?.price ?? 0),
0,
) ?? 0;
} }
resetPlaceHighlightMarker() { resetPlaceHighlightMarker() {
@ -447,22 +444,33 @@ export class TripComponent implements AfterViewInit {
"#e6beff", "#e6beff",
"#808000", "#808000",
]; ];
Object.values(dayGroups).forEach((group, idx) => { let prevPoint: [number, number] | null = null;
const path = antPath(
group.map((day: any) => [day.lat, day.lng]), Object.values(dayGroups).forEach((group, idx) => {
{ const coords = group.map((day: any) => [day.lat, day.lng]);
delay: 600, const pathOptions = {
dashArray: [10, 20], delay: 600,
weight: 5, dashArray: [10, 20],
color: COLORS[idx % 14], weight: 5,
pulseColor: "#FFFFFF", color: COLORS[idx % COLORS.length],
paused: false, pulseColor: "#FFFFFF",
reverse: false, paused: false,
hardwareAccelerated: true, reverse: false,
}, hardwareAccelerated: true,
); };
if (coords.length >= 2) {
const path = antPath(coords, pathOptions);
layGroup.addLayer(path);
prevPoint = coords[coords.length - 1];
} else if (coords.length === 1 && prevPoint) {
const path = antPath([prevPoint, coords[0]], pathOptions);
layGroup.addLayer(path);
prevPoint = coords[0];
} else if (coords.length === 1) {
prevPoint = coords[0];
}
layGroup.addLayer(path);
group.forEach((day: any) => { group.forEach((day: any) => {
if (!day.isPlace) layGroup.addLayer(tripDayMarker(day)); if (!day.isPlace) layGroup.addLayer(tripDayMarker(day));
}); });