Add standalone bicycle library theme, search now opens the popup of the found object

This commit is contained in:
Pieter Vander Vennet 2021-01-06 02:09:04 +01:00
parent a35b80afbb
commit c359d43b15
15 changed files with 260 additions and 43 deletions

View file

@ -8,6 +8,7 @@ import State from "../../State";
import {TextField} from "../Input/TextField";
import {Geocoding} from "../../Logic/Osm/Geocoding";
import Translations from "../i18n/Translations";
import Hash from "../../Logic/Web/Hash";
export default class SearchAndGo extends UIElement {
@ -61,11 +62,14 @@ export default class SearchAndGo extends UIElement {
return;
}
const bb = result[0].boundingbox;
const poi = result[0];
const bb = poi.boundingbox;
const bounds: [[number, number], [number, number]] = [
[bb[0], bb[2]],
[bb[1], bb[3]]
]
State.state.selectedElement. setData(undefined);
Hash.hash.setData(poi.osm_type+"_"+poi.osm_id);
State.state.leafletMap.data.fitBounds(bounds);
self._placeholder.setData(Translations.t.general.search.search);
},

View file

@ -13,6 +13,7 @@ import {OH} from "./OpeningHours";
import {InputElement} from "../Input/InputElement";
import PublicHolidayInput from "./PublicHolidayInput";
import Translations from "../i18n/Translations";
import {Utils} from "../../Utils";
export default class OpeningHoursInput extends InputElement<string> {
@ -63,15 +64,13 @@ export default class OpeningHoursInput extends InputElement<string> {
this._phSelector = new PublicHolidayInput(ph);
function update() {
let rules = OH.ToString(rulesFromOhPicker.data);
if (leftoverRules.data.length != 0) {
rules += ";" + leftoverRules.data.join(";")
}
const phData = ph.data;
if (phData !== undefined && phData !== "") {
rules += ";" + phData;
}
value.setData(rules);
const regular = OH.ToString(rulesFromOhPicker.data);
const rules : string[] = [
regular,
...leftoverRules.data,
ph.data
]
value.setData(Utils.NoEmpty(rules).join(";"));
}
rulesFromOhPicker.addCallback(update);

View file

@ -68,6 +68,12 @@ export default class ShowDataLayer {
action();
}
});
Hash.hash.addCallback(id => {
const action = self._onSelectedTrigger[id];
if(action){
action();
}
})
}
@ -139,9 +145,9 @@ export default class ShowDataLayer {
leafletLayer.openPopup();
uiElement.Activate();
}
this._onSelectedTrigger[feature.properties.id.replace("/","_")] = this._onSelectedTrigger[id];
if (feature.properties.id.replace(/\//g, "_") === Hash.Get().data) {
if (feature.properties.id.replace(/\//g, "_") === Hash.hash.data) {
// This element is in the URL, so this is a share link
// We already open it
uiElement.Activate();