Bicycle and foot route profiles (Valhalla bicycle/pedestrian costing); hiking trail colours in the elevation profile; power, splits and best efforts in the profile; TCX import; FIT course export
This commit is contained in:
1 parent
4c704045c5
commit
f8755ea65a
21 files changed
+634
-40
No files matched your search
+8
-1
@@ -488,7 +488,8 @@ export class RoutePanelControl {
|
||||
const select = this._panel.querySelector(".route-panel__vehicle-select");
|
||||
const editButton = this._panel.querySelector('[data-action="vehicle-edit"]');
|
||||
const fieldset = this._panel.querySelector(".route-panel__vehicle");
|
||||
const inputs = [...fieldset.querySelectorAll("input")];
|
||||
const inputs = [...fieldset.querySelectorAll("input, select")];
|
||||
const avoidRow = this._panel.querySelector(".route-panel__avoid");
|
||||
try {
|
||||
this._vehicles = await (await fetch(VEHICLES_URL)).json();
|
||||
} catch {
|
||||
@@ -500,6 +501,11 @@ export class RoutePanelControl {
|
||||
this._vehicle = current();
|
||||
this._vehicleId = select.value = this._vehicle.id;
|
||||
inputs.forEach((input) => (input.value = this._vehicle[input.name] ?? ""));
|
||||
// No type: a car (profiles saved before bicycle/foot existed).
|
||||
const type = (fieldset.querySelector('[name="type"]').value = this._vehicle.type || "car");
|
||||
if (type === "bicycle" && !this._vehicle.bicycle_type) fieldset.querySelector('[name="bicycle_type"]').value = "Hybrid";
|
||||
fieldset.querySelectorAll("[data-for]").forEach((el) => (el.hidden = !el.dataset.for.split(" ").includes(type)));
|
||||
avoidRow.hidden = type !== "car"; // tolls/motorways: a car's choice
|
||||
};
|
||||
this._selectVehicle = (id) => {
|
||||
this._vehicleId = id;
|
||||
@@ -537,6 +543,7 @@ export class RoutePanelControl {
|
||||
const value = input.value.trim();
|
||||
if (input.name === "name") current().name = value;
|
||||
else if (value === "") delete current()[input.name];
|
||||
else if (input.name === "type" || input.name === "bicycle_type") current()[input.name] = value;
|
||||
else current()[input.name] = value;
|
||||
save();
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user