import {UIElement} from "./UIElement"; import {UIEventSource} from "./UIEventSource"; import {Tag} from "../Logic/TagsFilter"; import {FilteredLayer} from "../Logic/FilteredLayer"; import {FixedUiElement} from "./Base/FixedUiElement"; import {Button} from "./Base/Button"; import Translations from "./i18n/Translations"; import Combine from "./Base/Combine"; import {SubtleButton} from "./Base/SubtleButton"; import {VerticalCombine} from "./Base/VerticalCombine"; import Locale from "./i18n/Locale"; import {Changes} from "../Logic/Osm/Changes"; import {UserDetails} from "../Logic/Osm/OsmConnection"; import {State} from "../State"; export interface Preset { description: string | UIElement, name: string | UIElement, icon: string, tags: Tag[], layerToAddTo: FilteredLayer } /** * Asks to add a feature at the last clicked location, at least if zoom is sufficient */ export class SimpleAddUI extends UIElement { private _addButtons: UIElement[]; private _dataIsLoading: UIEventSource; private _confirmPreset: UIEventSource = new UIEventSource(undefined); private confirmButton: UIElement = undefined; private cancelButton: UIElement; private goToInboxButton: UIElement = new SubtleButton("./assets/envelope.svg", Translations.t.general.goToInbox, {url:"https://www.openstreetmap.org/messages/inbox", newTab: false}); constructor( dataIsLoading: UIEventSource, addButtons: { description: string | UIElement, name: string | UIElement; icon: string; tags: Tag[]; layerToAddTo: FilteredLayer }[], ) { super(State.state.locationControl); this.ListenTo(Locale.language); this.ListenTo(State.state.osmConnection.userDetails); this._dataIsLoading = dataIsLoading; this.ListenTo(dataIsLoading); this._addButtons = []; this.ListenTo(this._confirmPreset); this.clss = "add-ui" const self = this; for (const option of addButtons) { //