forked from MapComplete/MapComplete
Changesets are now kept open and reused to avoid tons of changesets to be created
This commit is contained in:
parent
0051c37494
commit
82f3525907
16 changed files with 162 additions and 270 deletions
|
@ -1,38 +0,0 @@
|
|||
import {UIElement} from "./UIElement";
|
||||
import {State} from "../State";
|
||||
import {UIEventSource} from "../Logic/UIEventSource";
|
||||
|
||||
export class PendingChanges extends UIElement {
|
||||
private _pendingChangesCount: UIEventSource<number>;
|
||||
private _isSaving: UIEventSource<boolean>;
|
||||
|
||||
constructor() {
|
||||
super(State.state.changes.pendingChangesES);
|
||||
this.ListenTo(State.state.changes.isSaving);
|
||||
this.ListenTo(State.state.secondsTillChangesAreSaved);
|
||||
this._pendingChangesCount = State.state.changes.pendingChangesES;
|
||||
this._isSaving = State.state.changes.isSaving;
|
||||
|
||||
this.onClick(() => {
|
||||
State.state.changes.uploadAll();
|
||||
})
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
if (this._isSaving.data) {
|
||||
return "<span class='alert'>Saving</span>";
|
||||
}
|
||||
if (this._pendingChangesCount.data == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
var restingSeconds =State.state.secondsTillChangesAreSaved.data / 1000;
|
||||
var dots = "";
|
||||
while (restingSeconds > 0) {
|
||||
dots += ".";
|
||||
restingSeconds = restingSeconds - 1;
|
||||
}
|
||||
return "Saving "+this._pendingChangesCount.data;
|
||||
}
|
||||
|
||||
}
|
|
@ -55,8 +55,8 @@ export class SimpleAddUI extends UIElement {
|
|||
if (preset.icon !== undefined) {
|
||||
|
||||
if (typeof (preset.icon) !== "string") {
|
||||
icon = preset.icon.GetContent(Utils.MergeTags(preset.tags, {id:"node/-1"}));
|
||||
console.log("Preset icon is:", preset.icon, "--> ",icon);
|
||||
const tags = Utils.MergeTags(TagUtils.KVtoProperties(preset.tags), {id:"node/-1"});
|
||||
icon = preset.icon.GetContent(tags);
|
||||
} else {
|
||||
icon = preset.icon;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
import {UIElement} from "./UIElement";
|
||||
import {UIEventSource} from "./UIEventSource";
|
||||
import L from "leaflet";
|
||||
import {FixedUiElement} from "./Base/FixedUiElement";
|
||||
import {VariableUiElement} from "./Base/VariableUIElement";
|
||||
import Translations from "./i18n/Translations";
|
||||
import {UserDetails} from "../Logic/Osm/OsmConnection";
|
||||
import {State} from "../State";
|
||||
import {PendingChanges} from "./PendingChanges";
|
||||
import {Utils} from "../Utils";
|
||||
// @ts-ignore
|
||||
import {UIEventSource} from "../Logic/UIEventSource";
|
||||
|
||||
/**
|
||||
|
@ -16,7 +13,6 @@ import {UIEventSource} from "../Logic/UIEventSource";
|
|||
*/
|
||||
export class UserBadge extends UIElement {
|
||||
private _userDetails: UIEventSource<UserDetails>;
|
||||
private _pendingChanges: UIElement;
|
||||
private _logout: UIElement;
|
||||
private _homeButton: UIElement;
|
||||
private _languagePicker: UIElement;
|
||||
|
@ -26,7 +22,6 @@ export class UserBadge extends UIElement {
|
|||
constructor() {
|
||||
super(State.state.osmConnection.userDetails);
|
||||
this._userDetails = State.state.osmConnection.userDetails;
|
||||
this._pendingChanges = new PendingChanges();
|
||||
this._languagePicker = Utils.CreateLanguagePicker();
|
||||
this._loginButton = Translations.t.general.loginWithOpenStreetMap.Clone().onClick(() => State.state.osmConnection.AttemptLogin());
|
||||
this._logout = new FixedUiElement("<img src='assets/logout.svg' class='small-userbadge-icon' alt='logout'>")
|
||||
|
@ -116,7 +111,6 @@ export class UserBadge extends UIElement {
|
|||
messageSpan +
|
||||
csCount +
|
||||
this._logout.Render() +
|
||||
this._pendingChanges.Render() +
|
||||
this._languagePicker.Render() +
|
||||
"</div>";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue