diff --git a/src/src/app/components/dashboard/dashboard.component.ts b/src/src/app/components/dashboard/dashboard.component.ts
index 1e485bb..d969226 100644
--- a/src/src/app/components/dashboard/dashboard.component.ts
+++ b/src/src/app/components/dashboard/dashboard.component.ts
@@ -78,6 +78,7 @@ export interface MarkerOptions extends L.MarkerOptions {
export class DashboardComponent implements AfterViewInit {
searchInput = new FormControl("");
info: Info | undefined;
+ isLowNet: boolean = false;
viewSettings = false;
viewFilters = false;
@@ -111,6 +112,7 @@ export class DashboardComponent implements AfterViewInit {
private fb: FormBuilder,
) {
this.currencySigns = this.utilsService.currencySigns();
+ this.isLowNet = this.utilsService.isLowNet;
this.settingsForm = this.fb.group({
mapLat: [
@@ -244,6 +246,13 @@ export class DashboardComponent implements AfterViewInit {
if (this.viewMarkersList) this.setVisibleMarkers();
}
+ toggleLowNet() {
+ this.utilsService.toggleLowNet();
+ setTimeout(() => {
+ this.updateMarkersAndClusters();
+ }, 200);
+ }
+
get filteredPlaces(): Place[] {
return this.places.filter((p) => {
if (!this.filter_display_visited && p.visited) return false;
@@ -264,7 +273,7 @@ export class DashboardComponent implements AfterViewInit {
}
placeToMarker(place: Place): L.Marker {
- let marker = placeToMarker(place);
+ let marker = placeToMarker(place, this.isLowNet);
marker
.on("click", (e) => {
this.selectedPlace = place;
@@ -456,6 +465,7 @@ export class DashboardComponent implements AfterViewInit {
if (index > -1) this.places.splice(index, 1);
this.closePlaceBox();
this.updateMarkersAndClusters();
+ if (this.viewMarkersList) this.setVisibleMarkers();
},
});
},
@@ -499,6 +509,7 @@ export class DashboardComponent implements AfterViewInit {
setTimeout(() => {
this.updateMarkersAndClusters();
}, 10);
+ if (this.viewMarkersList) this.setVisibleMarkers();
},
});
},
@@ -561,6 +572,7 @@ export class DashboardComponent implements AfterViewInit {
toggleMarkersList() {
this.viewMarkersList = !this.viewMarkersList;
+ if (this.viewMarkersList) this.setVisibleMarkers();
}
toggleMarkersListSearch() {
@@ -649,7 +661,13 @@ export class DashboardComponent implements AfterViewInit {
this.activeCategories = new Set(
this.categories.map((c) => c.name),
);
- this.updateMarkersAndClusters();
+ this.places = this.places.map((p) => {
+ if (p.category.id == category.id) return { ...p, category };
+ return p;
+ });
+ setTimeout(() => {
+ this.updateMarkersAndClusters();
+ }, 100);
}
},
});
diff --git a/src/src/app/components/trip/trip.component.html b/src/src/app/components/trip/trip.component.html
index cbe4d8c..748f987 100644
--- a/src/src/app/components/trip/trip.component.html
+++ b/src/src/app/components/trip/trip.component.html
@@ -93,7 +93,7 @@
@if (tripitem.place) {
- ![]() {{
tripitem.place.name }}
@@ -146,7 +146,8 @@
@if (selectedItem.place) {
- ![]()
+ ![]()
}
@@ -224,10 +225,14 @@
{{ trip?.name }} places
-
+
-
+
+
@if (!selectedItem) {
@@ -259,7 +264,7 @@
@for (p of places; track p.id) {
- ![]()
+
{{ p.name }}
@@ -270,7 +275,7 @@
class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded flex gap-2 items-center truncate">{{ p.category.name }}
- @if (p.placeUsage) {
+ @if (isPlaceUsed(p.id)) {
} @else {
@@ -395,4 +400,15 @@
}
-
\ No newline at end of file
+
+
+@if (isMapFullscreen) {
+
+
+
+}
\ No newline at end of file
diff --git a/src/src/app/components/trip/trip.component.scss b/src/src/app/components/trip/trip.component.scss
index 7c6b484..f22b193 100644
--- a/src/src/app/components/trip/trip.component.scss
+++ b/src/src/app/components/trip/trip.component.scss
@@ -8,3 +8,13 @@
background-color: white !important;
}
}
+
+.fullscreen-map {
+ position: fixed !important;
+ top: 0 !important;
+ left: 0 !important;
+ width: 100vw !important;
+ height: 100vh !important;
+ border-radius: 0 !important;
+ box-shadow: none !important;
+}
diff --git a/src/src/app/components/trip/trip.component.ts b/src/src/app/components/trip/trip.component.ts
index 38cc16a..b2555f1 100644
--- a/src/src/app/components/trip/trip.component.ts
+++ b/src/src/app/components/trip/trip.component.ts
@@ -31,10 +31,6 @@ import { AsyncPipe } from "@angular/common";
import { MenuItem } from "primeng/api";
import { MenuModule } from "primeng/menu";
-interface PlaceWithUsage extends Place {
- placeUsage?: boolean;
-}
-
@Component({
selector: "app-trip",
standalone: true,
@@ -59,15 +55,17 @@ export class TripComponent implements AfterViewInit {
statuses: TripStatus[] = [];
hoveredElement: HTMLElement | undefined;
currency$: Observable ;
+ placesUsedInTable = new Set();
trip: Trip | undefined;
tripMapAntLayer: undefined;
tripMapAntLayerDayID: number | undefined;
+ isMapFullscreen: boolean = false;
totalPrice: number = 0;
dayStatsCache = new Map();
- places: PlaceWithUsage[] = [];
+ places: Place[] = [];
flattenedTripItems: FlattenedTripItem[] = [];
menuTripActionsItems: MenuItem[] = [];
@@ -176,7 +174,18 @@ export class TripComponent implements AfterViewInit {
this.updateTotalPrice();
- this.map = createMap();
+ let contentMenuItems = [
+ {
+ text: "Copy coordinates",
+ callback: (e: any) => {
+ const latlng = e.latlng;
+ navigator.clipboard.writeText(
+ `${parseFloat(latlng.lat).toFixed(5)}, ${parseFloat(latlng.lng).toFixed(5)}`,
+ );
+ },
+ },
+ ];
+ this.map = createMap(contentMenuItems);
this.markerClusterGroup = createClusterGroup().addTo(this.map);
this.setPlacesAndMarkers();
@@ -224,6 +233,10 @@ export class TripComponent implements AfterViewInit {
})) as (TripItem & { status: TripStatus })[];
}
+ isPlaceUsed(id: number): boolean {
+ return this.placesUsedInTable.has(id);
+ }
+
statusToTripStatus(status?: string): TripStatus | undefined {
if (!status) return undefined;
return this.statuses.find((s) => s.label == status) as TripStatus;
@@ -250,18 +263,21 @@ export class TripComponent implements AfterViewInit {
);
}
- setPlacesAndMarkers() {
- let usedPlaces = this.flattenedTripItems.map((i) => i.place?.id);
- this.places = (this.trip?.places || []).map((p) => {
- let ret: PlaceWithUsage = { ...p };
- if (usedPlaces.includes(p.id)) ret.placeUsage = true;
- return ret;
+ makePlacesUsedInTable() {
+ this.placesUsedInTable.clear();
+ this.flattenedTripItems.forEach((i) => {
+ if (i.place?.id) this.placesUsedInTable.add(i.place.id);
});
+ }
+
+ setPlacesAndMarkers() {
+ this.makePlacesUsedInTable();
+ this.places = this.trip?.places || [];
this.places.sort((a, b) => a.name.localeCompare(b.name));
this.markerClusterGroup?.clearLayers();
this.places.forEach((p) => {
- const marker = placeToMarker(p);
+ const marker = placeToMarker(p, false);
this.markerClusterGroup?.addLayer(marker);
});
}
@@ -274,6 +290,15 @@ export class TripComponent implements AfterViewInit {
);
}
+ toggleMapFullscreen() {
+ this.isMapFullscreen = !this.isMapFullscreen;
+
+ setTimeout(() => {
+ this.map.invalidateSize();
+ this.resetMapBounds();
+ }, 50);
+ }
+
updateTotalPrice(n?: number) {
if (n) this.totalPrice += n;
else
@@ -352,7 +377,7 @@ export class TripComponent implements AfterViewInit {
this.map.fitBounds(coords, { padding: [30, 30] });
const path = antPath(coords, {
- delay: 400,
+ delay: 600,
dashArray: [10, 20],
weight: 5,
color: "#0000FF",
@@ -607,6 +632,7 @@ export class TripComponent implements AfterViewInit {
this.trip?.days!,
);
this.dayStatsCache.delete(day.id);
+ this.makePlacesUsedInTable();
}
},
});
@@ -685,6 +711,7 @@ export class TripComponent implements AfterViewInit {
);
}
if (item.price) this.updateTotalPrice(item.price);
+ if (item.place?.id) this.placesUsedInTable.add(item.place.id);
},
});
},
@@ -718,6 +745,7 @@ export class TripComponent implements AfterViewInit {
modal.onClose.subscribe({
next: (it: TripItem | null) => {
if (!it) return;
+ if (item.place?.id) this.placesUsedInTable.delete(item.place.id);
this.apiService
.putTripDayItem(it, this.trip?.id!, item.day_id, item.id)
@@ -744,6 +772,7 @@ export class TripComponent implements AfterViewInit {
this.dayStatsCache.delete(item.day_id);
}
+ if (item.place?.id) this.placesUsedInTable.add(item.place.id);
const updatedPrice = -(item.price || 0) + (it.price || 0);
this.updateTotalPrice(updatedPrice);
@@ -786,6 +815,8 @@ export class TripComponent implements AfterViewInit {
this.flattenedTripItems = this.flattenTripDayItems(
this.trip?.days!,
);
+ if (item.place?.id)
+ this.placesUsedInTable.delete(item.place.id);
this.dayStatsCache.delete(item.day_id);
this.selectedItem = undefined;
this.resetPlaceHighlightMarker();
diff --git a/src/src/app/components/trips/trips.component.html b/src/src/app/components/trips/trips.component.html
index 77cbacb..625f058 100644
--- a/src/src/app/components/trips/trips.component.html
+++ b/src/src/app/components/trips/trips.component.html
@@ -15,7 +15,7 @@
![]()
+ [src]="trip.image || 'cover.webp'" />
{{ trip.name }}
diff --git a/src/src/app/modals/category-create-modal/category-create-modal.component.ts b/src/src/app/modals/category-create-modal/category-create-modal.component.ts
index 013746f..3bbd5ae 100644
--- a/src/src/app/modals/category-create-modal/category-create-modal.component.ts
+++ b/src/src/app/modals/category-create-modal/category-create-modal.component.ts
@@ -1,5 +1,10 @@
import { Component } from "@angular/core";
-import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from "@angular/forms";
+import {
+ FormBuilder,
+ FormGroup,
+ ReactiveFormsModule,
+ Validators,
+} from "@angular/forms";
import { ButtonModule } from "primeng/button";
import { DynamicDialogConfig, DynamicDialogRef } from "primeng/dynamicdialog";
import { FloatLabelModule } from "primeng/floatlabel";
@@ -8,7 +13,13 @@ import { FocusTrapModule } from "primeng/focustrap";
@Component({
selector: "app-category-create-modal",
- imports: [FloatLabelModule, InputTextModule, ButtonModule, ReactiveFormsModule, FocusTrapModule],
+ imports: [
+ FloatLabelModule,
+ InputTextModule,
+ ButtonModule,
+ ReactiveFormsModule,
+ FocusTrapModule,
+ ],
standalone: true,
templateUrl: "./category-create-modal.component.html",
styleUrl: "./category-create-modal.component.scss",
@@ -21,12 +32,12 @@ export class CategoryCreateModalComponent {
constructor(
private ref: DynamicDialogRef,
private fb: FormBuilder,
- private config: DynamicDialogConfig
+ private config: DynamicDialogConfig,
) {
this.categoryForm = this.fb.group({
id: -1,
name: ["", Validators.required],
- image: ["", Validators.required],
+ image: null,
});
if (this.config.data) {
diff --git a/src/src/app/modals/place-create-modal/place-create-modal.component.ts b/src/src/app/modals/place-create-modal/place-create-modal.component.ts
index 11d6270..f755338 100644
--- a/src/src/app/modals/place-create-modal/place-create-modal.component.ts
+++ b/src/src/app/modals/place-create-modal/place-create-modal.component.ts
@@ -99,7 +99,6 @@ export class PlaceCreateModalComponent {
if (this.config.data) {
let patchValue: Place = this.config.data.place;
- if (patchValue.imageDefault) delete patchValue["image"];
this.placeForm.patchValue(patchValue);
}
diff --git a/src/src/app/modals/trip-create-day-item-modal/trip-create-day-item-modal.component.html b/src/src/app/modals/trip-create-day-item-modal/trip-create-day-item-modal.component.html
index b9f640b..b72f826 100644
--- a/src/src/app/modals/trip-create-day-item-modal/trip-create-day-item-modal.component.html
+++ b/src/src/app/modals/trip-create-day-item-modal/trip-create-day-item-modal.component.html
@@ -31,7 +31,7 @@
- ![]()
+
{{ place.name }}
diff --git a/src/src/app/modals/trip-place-select-modal/trip-place-select-modal.component.html b/src/src/app/modals/trip-place-select-modal/trip-place-select-modal.component.html
index 1df0cba..e4f6163 100644
--- a/src/src/app/modals/trip-place-select-modal/trip-place-select-modal.component.html
+++ b/src/src/app/modals/trip-place-select-modal/trip-place-select-modal.component.html
@@ -24,7 +24,7 @@
@for (p of selectedPlaces; track p.id) {
- ![]()
+
{{ p.name }}
diff --git a/src/src/app/services/api.service.ts b/src/src/app/services/api.service.ts
index 6bf145f..1643a0c 100644
--- a/src/src/app/services/api.service.ts
+++ b/src/src/app/services/api.service.ts
@@ -4,7 +4,6 @@ import { Category, Place } from "../types/poi";
import {
BehaviorSubject,
distinctUntilChanged,
- map,
Observable,
shareReplay,
tap,
@@ -18,7 +17,6 @@ import { Trip, TripBase, TripDay, TripItem } from "../types/trip";
})
export class ApiService {
public apiBaseUrl: string = "/api";
- public assetsBaseUrl: string = "/api/assets";
private categoriesSubject = new BehaviorSubject (null);
public categories$: Observable =
@@ -33,23 +31,6 @@ export class ApiService {
return this.httpClient.get(this.apiBaseUrl + "/info");
}
- _normalizeTripImage(trip: Trip | TripBase): Trip | TripBase {
- if (trip.image) trip.image = `${this.assetsBaseUrl}/${trip.image}`;
- else trip.image = "cover.webp";
- return trip;
- }
-
- _normalizePlaceImage(place: Place): Place {
- if (place.image) {
- place.image = `${this.assetsBaseUrl}/${place.image}`;
- place.imageDefault = false;
- } else {
- place.image = `${this.assetsBaseUrl}/${(place.category as Category).image}`;
- place.imageDefault = true;
- }
- return place;
- }
-
_categoriesSubjectNext(categories: Category[]) {
this.categoriesSubject.next(
categories.sort((categoryA: Category, categoryB: Category) =>
@@ -63,11 +44,6 @@ export class ApiService {
return this.httpClient
.get(`${this.apiBaseUrl}/categories`)
.pipe(
- map((resp) => {
- return resp.map((c) => {
- return { ...c, image: `${this.assetsBaseUrl}/${c.image}` };
- });
- }),
tap((categories) => this._categoriesSubjectNext(categories)),
distinctUntilChanged(),
shareReplay(),
@@ -80,12 +56,6 @@ export class ApiService {
return this.httpClient
.post(this.apiBaseUrl + "/categories", c)
.pipe(
- map((category) => {
- return {
- ...category,
- image: `${this.assetsBaseUrl}/${category.image}`,
- };
- }),
tap((category) =>
this._categoriesSubjectNext([
...(this.categoriesSubject.value || []),
@@ -99,12 +69,6 @@ export class ApiService {
return this.httpClient
.put(this.apiBaseUrl + `/categories/${c_id}`, c)
.pipe(
- map((category) => {
- return {
- ...category,
- image: `${this.assetsBaseUrl}/${category.image}`,
- };
- }),
tap((category) => {
let categories = this.categoriesSubject.value || [];
let categoryIndex = categories?.findIndex((c) => c.id == c_id) || -1;
@@ -133,29 +97,27 @@ export class ApiService {
}
getPlaces(): Observable {
- return this.httpClient.get(`${this.apiBaseUrl}/places`).pipe(
- map((resp) => resp.map((p) => this._normalizePlaceImage(p))),
- distinctUntilChanged(),
- shareReplay(),
- );
+ return this.httpClient
+ .get(`${this.apiBaseUrl}/places`)
+ .pipe(distinctUntilChanged(), shareReplay());
}
postPlace(place: Place): Observable {
- return this.httpClient
- .post(`${this.apiBaseUrl}/places`, place)
- .pipe(map((p) => this._normalizePlaceImage(p)));
+ return this.httpClient.post(`${this.apiBaseUrl}/places`, place);
}
postPlaces(places: Partial): Observable {
- return this.httpClient
- .post(`${this.apiBaseUrl}/places/batch`, places)
- .pipe(map((resp) => resp.map((p) => this._normalizePlaceImage(p))));
+ return this.httpClient.post(
+ `${this.apiBaseUrl}/places/batch`,
+ places,
+ );
}
putPlace(place_id: number, place: Partial): Observable {
- return this.httpClient
- .put(`${this.apiBaseUrl}/places/${place_id}`, place)
- .pipe(map((p) => this._normalizePlaceImage(p)));
+ return this.httpClient.put(
+ `${this.apiBaseUrl}/places/${place_id}`,
+ place,
+ );
}
deletePlace(place_id: number): Observable {
@@ -165,50 +127,23 @@ export class ApiService {
}
getPlaceGPX(place_id: number): Observable {
- return this.httpClient
- .get(`${this.apiBaseUrl}/places/${place_id}`)
- .pipe(map((p) => this._normalizePlaceImage(p)));
+ return this.httpClient.get(`${this.apiBaseUrl}/places/${place_id}`);
}
getTrips(): Observable {
- return this.httpClient.get(`${this.apiBaseUrl}/trips`).pipe(
- map((resp) => {
- return resp.map((trip: TripBase) => {
- trip = this._normalizeTripImage(trip) as TripBase;
- return trip;
- });
- }),
- distinctUntilChanged(),
- shareReplay(),
- );
+ return this.httpClient
+ .get(`${this.apiBaseUrl}/trips`)
+ .pipe(distinctUntilChanged(), shareReplay());
}
getTrip(id: number): Observable {
- return this.httpClient.get(`${this.apiBaseUrl}/trips/${id}`).pipe(
- map((trip) => {
- trip = this._normalizeTripImage(trip) as Trip;
- trip.places = trip.places.map((p) => this._normalizePlaceImage(p));
- trip.days.map((day) => {
- day.items.forEach((item) => {
- if (item.place) this._normalizePlaceImage(item.place);
- });
- });
- return trip;
- }),
- distinctUntilChanged(),
- shareReplay(),
- );
+ return this.httpClient
+ .get(`${this.apiBaseUrl}/trips/${id}`)
+ .pipe(distinctUntilChanged(), shareReplay());
}
postTrip(trip: TripBase): Observable {
- return this.httpClient
- .post(`${this.apiBaseUrl}/trips`, trip)
- .pipe(
- map((trip) => {
- trip = this._normalizeTripImage(trip) as TripBase;
- return trip;
- }),
- );
+ return this.httpClient.post(`${this.apiBaseUrl}/trips`, trip);
}
deleteTrip(trip_id: number): Observable {
@@ -216,20 +151,10 @@ export class ApiService {
}
putTrip(trip: Partial, trip_id: number): Observable {
- return this.httpClient
- .put(`${this.apiBaseUrl}/trips/${trip_id}`, trip)
- .pipe(
- map((trip) => {
- trip = this._normalizeTripImage(trip) as Trip;
- trip.places = trip.places.map((p) => this._normalizePlaceImage(p));
- trip.days.map((day) => {
- day.items.forEach((item) => {
- if (item.place) this._normalizePlaceImage(item.place);
- });
- });
- return trip;
- }),
- );
+ return this.httpClient.put(
+ `${this.apiBaseUrl}/trips/${trip_id}`,
+ trip,
+ );
}
postTripDay(tripDay: TripDay, trip_id: number): Observable {
@@ -240,19 +165,10 @@ export class ApiService {
}
putTripDay(tripDay: Partial, trip_id: number): Observable {
- return this.httpClient
- .put(
- `${this.apiBaseUrl}/trips/${trip_id}/days/${tripDay.id}`,
- tripDay,
- )
- .pipe(
- map((td) => {
- td.items.forEach((item) => {
- if (item.place) this._normalizePlaceImage(item.place);
- });
- return td;
- }),
- );
+ return this.httpClient.put(
+ `${this.apiBaseUrl}/trips/${trip_id}/days/${tripDay.id}`,
+ tripDay,
+ );
}
deleteTripDay(trip_id: number, day_id: number): Observable {
@@ -266,17 +182,10 @@ export class ApiService {
trip_id: number,
day_id: number,
): Observable {
- return this.httpClient
- .post(
- `${this.apiBaseUrl}/trips/${trip_id}/days/${day_id}/items`,
- item,
- )
- .pipe(
- map((item) => {
- if (item.place) item.place = this._normalizePlaceImage(item.place);
- return item;
- }),
- );
+ return this.httpClient.post(
+ `${this.apiBaseUrl}/trips/${trip_id}/days/${day_id}/items`,
+ item,
+ );
}
putTripDayItem(
@@ -285,17 +194,10 @@ export class ApiService {
day_id: number,
item_id: number,
): Observable {
- return this.httpClient
- .put(
- `${this.apiBaseUrl}/trips/${trip_id}/days/${day_id}/items/${item_id}`,
- item,
- )
- .pipe(
- map((item) => {
- if (item.place) item.place = this._normalizePlaceImage(item.place);
- return item;
- }),
- );
+ return this.httpClient.put(
+ `${this.apiBaseUrl}/trips/${trip_id}/days/${day_id}/items/${item_id}`,
+ item,
+ );
}
deleteTripDayItem(
@@ -336,21 +238,10 @@ export class ApiService {
settingsUserImport(formdata: FormData): Observable {
const headers = { enctype: "multipart/form-data" };
- return this.httpClient
- .post<
- Place[]
- >(`${this.apiBaseUrl}/settings/import`, formdata, { headers: headers })
- .pipe(
- map((resp) => {
- return resp.map((c) => {
- if (c.image) c.image = `${this.assetsBaseUrl}/${c.image}`;
- else {
- c.image = `${this.assetsBaseUrl}/${(c.category as Category).image}`;
- c.imageDefault = true;
- }
- return c;
- });
- }),
- );
+ return this.httpClient.post(
+ `${this.apiBaseUrl}/settings/import`,
+ formdata,
+ { headers: headers },
+ );
}
}
diff --git a/src/src/app/services/utils.service.ts b/src/src/app/services/utils.service.ts
index 2bfade8..8afa3bd 100644
--- a/src/src/app/services/utils.service.ts
+++ b/src/src/app/services/utils.service.ts
@@ -4,19 +4,33 @@ import { TripStatus } from "../types/trip";
import { ApiService } from "./api.service";
import { map } from "rxjs";
+const DISABLE_LOWNET = "TRIP_DISABLE_LOWNET";
+
@Injectable({
providedIn: "root",
})
export class UtilsService {
private apiService = inject(ApiService);
currency$ = this.apiService.settings$.pipe(map((s) => s?.currency ?? "€"));
+ public isLowNet: boolean = true;
- constructor(private ngMessageService: MessageService) {}
+ constructor(private ngMessageService: MessageService) {
+ this.isLowNet = !localStorage.getItem(DISABLE_LOWNET);
+ }
toGithubTRIP() {
window.open("https://github.com/itskovacs/trip", "_blank");
}
+ toggleLowNet() {
+ if (this.isLowNet) {
+ localStorage.setItem(DISABLE_LOWNET, "1");
+ } else {
+ localStorage.removeItem(DISABLE_LOWNET);
+ }
+ this.isLowNet = !this.isLowNet;
+ }
+
get statuses(): TripStatus[] {
return [
{ label: "pending", color: "#3258A8" },
@@ -35,17 +49,6 @@ export class UtilsService {
});
}
- getObjectDiffFields(a: T, b: T): Partial {
- const diff: Partial = {};
-
- for (const key in b) {
- if (!Object.is(a[key], b[key]) && JSON.stringify(a[key]) !== JSON.stringify(b[key])) {
- diff[key] = b[key];
- }
- }
- return diff;
- }
-
parseGoogleMapsUrl(url: string): [string, string] {
const match = url.match(/place\/(.*)\/@([\d\-.]+,[\d\-.]+)/);
diff --git a/src/src/app/shared/map.ts b/src/src/app/shared/map.ts
index 946de93..8a71251 100644
--- a/src/src/app/shared/map.ts
+++ b/src/src/app/shared/map.ts
@@ -69,7 +69,10 @@ export function createClusterGroup(): L.MarkerClusterGroup {
});
}
-export function placeToMarker(place: Place): L.Marker {
+export function placeToMarker(
+ place: Place,
+ isLowNet: boolean = true,
+): L.Marker {
let marker: L.Marker;
let options: any = {
riseOnHover: true,
@@ -79,8 +82,13 @@ export function placeToMarker(place: Place): L.Marker {
};
marker = new L.Marker([+place.lat, +place.lng], options);
+
+ const markerImage = isLowNet
+ ? place.category.image
+ : (place.image ?? place.category.image);
+
marker.options.icon = L.icon({
- iconUrl: place.image!,
+ iconUrl: markerImage,
iconSize: [56, 56],
iconAnchor: [28, 28],
shadowSize: [0, 0],
diff --git a/src/src/app/shared/place-box/place-box.component.html b/src/src/app/shared/place-box/place-box.component.html
index 771cfcd..b56ce2b 100644
--- a/src/src/app/shared/place-box/place-box.component.html
+++ b/src/src/app/shared/place-box/place-box.component.html
@@ -2,9 +2,10 @@
-
- ![]()
-
+
+ ![]()
+
{{ selectedPlace.name }}
diff --git a/src/src/app/types/poi.ts b/src/src/app/types/poi.ts
index 135033b..0b7b776 100644
--- a/src/src/app/types/poi.ts
+++ b/src/src/app/types/poi.ts
@@ -22,5 +22,4 @@ export interface Place {
allowdog?: boolean;
visited?: boolean;
favorite?: boolean;
- imageDefault?: boolean; // Injected in service
}
|