⬆️ Migration, 🐛 fix places panel search
This commit is contained in:
parent
2084e5840f
commit
165066576e
@ -42,6 +42,7 @@ import { CategoryCreateModalComponent } from "../../modals/category-create-modal
|
|||||||
import { AuthService } from "../../services/auth.service";
|
import { AuthService } from "../../services/auth.service";
|
||||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||||
import { PlaceGPXComponent } from "../../shared/place-gpx/place-gpx.component";
|
import { PlaceGPXComponent } from "../../shared/place-gpx/place-gpx.component";
|
||||||
|
import { CommonModule } from "@angular/common";
|
||||||
|
|
||||||
export interface ContextMenuItem {
|
export interface ContextMenuItem {
|
||||||
text: string;
|
text: string;
|
||||||
@ -75,6 +76,7 @@ export interface MarkerOptions extends L.MarkerOptions {
|
|||||||
SelectModule,
|
SelectModule,
|
||||||
TabsModule,
|
TabsModule,
|
||||||
ButtonModule,
|
ButtonModule,
|
||||||
|
CommonModule,
|
||||||
],
|
],
|
||||||
templateUrl: "./dashboard.component.html",
|
templateUrl: "./dashboard.component.html",
|
||||||
styleUrls: ["./dashboard.component.scss"],
|
styleUrls: ["./dashboard.component.scss"],
|
||||||
@ -227,7 +229,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
const searchValue = this.searchInput.value?.toLowerCase() ?? "";
|
const searchValue = this.searchInput.value?.toLowerCase() ?? "";
|
||||||
if (searchValue)
|
if (searchValue)
|
||||||
this.visiblePlaces.filter(
|
this.visiblePlaces = this.visiblePlaces.filter(
|
||||||
(p) =>
|
(p) =>
|
||||||
p.name.toLowerCase().includes(searchValue) ||
|
p.name.toLowerCase().includes(searchValue) ||
|
||||||
p.description?.toLowerCase().includes(searchValue),
|
p.description?.toLowerCase().includes(searchValue),
|
||||||
@ -316,7 +318,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
},
|
},
|
||||||
...opts,
|
...opts,
|
||||||
},
|
},
|
||||||
);
|
)!;
|
||||||
|
|
||||||
modal.onClose.pipe(take(1)).subscribe({
|
modal.onClose.pipe(take(1)).subscribe({
|
||||||
next: (place: Place | null) => {
|
next: (place: Place | null) => {
|
||||||
@ -354,7 +356,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
"1260px": "90vw",
|
"1260px": "90vw",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
)!;
|
||||||
|
|
||||||
modal.onClose.pipe(take(1)).subscribe({
|
modal.onClose.pipe(take(1)).subscribe({
|
||||||
next: (places: string | null) => {
|
next: (places: string | null) => {
|
||||||
@ -386,7 +388,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
resetHoverPlace() {
|
resetHoverPlace() {
|
||||||
if (!this.hoveredElement) return;
|
if (!this.hoveredElement) return;
|
||||||
this.hoveredElement.classList.remove("listHover");
|
this.hoveredElement.classList.remove("list-hover");
|
||||||
this.hoveredElement = undefined;
|
this.hoveredElement = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +405,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
if (markerElement) {
|
if (markerElement) {
|
||||||
// marker, not clustered
|
// marker, not clustered
|
||||||
markerElement.classList.add("listHover");
|
markerElement.classList.add("list-hover");
|
||||||
this.hoveredElement = markerElement;
|
this.hoveredElement = markerElement;
|
||||||
} else {
|
} else {
|
||||||
// marker is clustered
|
// marker is clustered
|
||||||
@ -413,7 +415,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
if (parentCluster) {
|
if (parentCluster) {
|
||||||
const clusterEl = parentCluster.getElement();
|
const clusterEl = parentCluster.getElement();
|
||||||
if (clusterEl) {
|
if (clusterEl) {
|
||||||
clusterEl.classList.add("listHover");
|
clusterEl.classList.add("list-hover");
|
||||||
this.hoveredElement = clusterEl;
|
this.hoveredElement = clusterEl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -472,7 +474,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
"640px": "90vw",
|
"640px": "90vw",
|
||||||
},
|
},
|
||||||
data: `Delete ${this.selectedPlace.name} ?`,
|
data: `Delete ${this.selectedPlace.name} ?`,
|
||||||
});
|
})!;
|
||||||
|
|
||||||
modal.onClose.subscribe({
|
modal.onClose.subscribe({
|
||||||
next: (bool) => {
|
next: (bool) => {
|
||||||
@ -494,8 +496,10 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
editPlace() {
|
editPlace(p?: Place) {
|
||||||
if (!this.selectedPlace) return;
|
if (!this.selectedPlace && !p) return;
|
||||||
|
const _placeToEdit: Place = { ...(this.selectedPlace ?? p)! };
|
||||||
|
|
||||||
const modal: DynamicDialogRef = this.dialogService.open(
|
const modal: DynamicDialogRef = this.dialogService.open(
|
||||||
PlaceCreateModalComponent,
|
PlaceCreateModalComponent,
|
||||||
{
|
{
|
||||||
@ -511,12 +515,12 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
place: {
|
place: {
|
||||||
...this.selectedPlace,
|
..._placeToEdit,
|
||||||
category: this.selectedPlace.category.id,
|
category: _placeToEdit.category.id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
)!;
|
||||||
|
|
||||||
modal.onClose.pipe(take(1)).subscribe({
|
modal.onClose.pipe(take(1)).subscribe({
|
||||||
next: (place: Place | null) => {
|
next: (place: Place | null) => {
|
||||||
@ -534,7 +538,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
a.name < b.name ? -1 : a.name > b.name ? 1 : 0,
|
a.name < b.name ? -1 : a.name > b.name ? 1 : 0,
|
||||||
);
|
);
|
||||||
this.places = places;
|
this.places = places;
|
||||||
this.selectedPlace = { ...place };
|
if (this.selectedPlace) this.selectedPlace = { ...place };
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updateMarkersAndClusters();
|
this.updateMarkersAndClusters();
|
||||||
}, 10);
|
}, 10);
|
||||||
@ -710,7 +714,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
"640px": "90vw",
|
"640px": "90vw",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
)!;
|
||||||
|
|
||||||
modal.onClose.pipe(take(1)).subscribe({
|
modal.onClose.pipe(take(1)).subscribe({
|
||||||
next: (category: Category | null) => {
|
next: (category: Category | null) => {
|
||||||
@ -758,7 +762,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
"640px": "90vw",
|
"640px": "90vw",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
)!;
|
||||||
|
|
||||||
modal.onClose.pipe(take(1)).subscribe({
|
modal.onClose.pipe(take(1)).subscribe({
|
||||||
next: (category: Category | null) => {
|
next: (category: Category | null) => {
|
||||||
@ -790,7 +794,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
"640px": "90vw",
|
"640px": "90vw",
|
||||||
},
|
},
|
||||||
data: "Delete this category ?",
|
data: "Delete this category ?",
|
||||||
});
|
})!;
|
||||||
|
|
||||||
modal.onClose.pipe(take(1)).subscribe({
|
modal.onClose.pipe(take(1)).subscribe({
|
||||||
next: (bool) => {
|
next: (bool) => {
|
||||||
@ -811,8 +815,12 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
gotoPlace(p: Place) {
|
togglePlaceSelection(p: Place) {
|
||||||
this.map?.flyTo([p.lat, p.lng]);
|
if (this.selectedPlace && this.selectedPlace.id === p.id) {
|
||||||
|
this.selectedPlace = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.selectedPlace = { ...p };
|
||||||
}
|
}
|
||||||
|
|
||||||
sortCategories() {
|
sortCategories() {
|
||||||
@ -821,7 +829,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
gotoTrips() {
|
navigateToTrips() {
|
||||||
this.router.navigateByUrl("/trips");
|
this.router.navigateByUrl("/trips");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user