mapcomplete/UI/Popup/SaveButton.ts

26 lines
814 B
TypeScript
Raw Normal View History

2020-10-14 10:15:09 +00:00
import {UIEventSource} from "../../Logic/UIEventSource";
import {UIElement} from "../UIElement";
import Translations from "../i18n/Translations";
2020-07-05 16:59:47 +00:00
export class SaveButton extends UIElement {
private _value: UIEventSource<any>;
constructor(value: UIEventSource<any>) {
super(value);
if(value === undefined){
throw "No event source for savebutton, something is wrong"
}
this._value = value;
}
2020-07-20 16:24:00 +00:00
InnerRender(): string {
2020-07-05 16:59:47 +00:00
if (this._value.data === undefined ||
this._value.data === null
|| this._value.data === ""
) {
return "<span class='save-non-active'>"+Translations.t.general.save.Render()+"</span>"
2020-07-05 16:59:47 +00:00
}
return "<span class='save'>"+Translations.t.general.save.Render()+"</span>";
2020-07-05 16:59:47 +00:00
}
}