💄 Sort displayed categories by name
This commit is contained in:
parent
ae5a6840a7
commit
4cea72ddc7
@ -175,6 +175,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
this.initMap();
|
this.initMap();
|
||||||
|
|
||||||
this.categories = categories;
|
this.categories = categories;
|
||||||
|
this.sortCategories();
|
||||||
this.activeCategories = new Set(categories.map((c) => c.name));
|
this.activeCategories = new Set(categories.map((c) => c.name));
|
||||||
|
|
||||||
this.isLowNet = !!settings.mode_low_network;
|
this.isLowNet = !!settings.mode_low_network;
|
||||||
@ -623,6 +624,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.categories = resp.categories;
|
this.categories = resp.categories;
|
||||||
|
this.sortCategories();
|
||||||
this.activeCategories = new Set(resp.categories.map((c) => c.name));
|
this.activeCategories = new Set(resp.categories.map((c) => c.name));
|
||||||
|
|
||||||
this.settings = resp.settings;
|
this.settings = resp.settings;
|
||||||
@ -707,6 +709,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
this.categories = this.categories.map((cat) =>
|
this.categories = this.categories.map((cat) =>
|
||||||
cat.id === updated.id ? updated : cat,
|
cat.id === updated.id ? updated : cat,
|
||||||
);
|
);
|
||||||
|
this.sortCategories();
|
||||||
|
|
||||||
this.activeCategories = new Set(
|
this.activeCategories = new Set(
|
||||||
this.categories.map((c) => c.name),
|
this.categories.map((c) => c.name),
|
||||||
@ -797,6 +800,13 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
|||||||
this.map?.flyTo([p.lat, p.lng]);
|
this.map?.flyTo([p.lat, p.lng]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sortCategories() {
|
||||||
|
this.categories = [...this.categories].sort(
|
||||||
|
(categoryA: Category, categoryB: Category) =>
|
||||||
|
categoryA.name.localeCompare(categoryB.name),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
gotoTrips() {
|
gotoTrips() {
|
||||||
this.router.navigateByUrl("/trips");
|
this.router.navigateByUrl("/trips");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user