🐛 fix trip empty dates redirection

This commit is contained in:
itskovacs 2025-10-13 11:43:36 +02:00
parent 524a18c152
commit 2b7d517c51

View File

@ -496,9 +496,11 @@ export class TripComponent implements AfterViewInit {
resetMapBounds() {
if (!this.places.length) {
if (!this.trip?.days.length) return;
const itemsWithCoordinates = this.flattenedTripItems.filter((i) => i.lat != null && i.lng != null);
if (!itemsWithCoordinates.length) return;
this.map?.fitBounds(
this.flattenedTripItems.filter((i) => i.lat != null && i.lng != null).map((i) => [i.lat!, i.lng!]),
itemsWithCoordinates.map((i) => [i.lat!, i.lng!]),
{ padding: [30, 30] },
);
return;