2020-06-27 01:06:51 +00:00
|
|
|
import {UIElement} from "./UIElement";
|
2020-07-21 00:55:28 +00:00
|
|
|
import Translations from "./i18n/Translations";
|
2020-10-02 17:00:24 +00:00
|
|
|
import State from "../State";
|
2020-09-03 14:44:48 +00:00
|
|
|
import Combine from "./Base/Combine";
|
2020-06-27 01:06:51 +00:00
|
|
|
|
2020-07-21 00:55:28 +00:00
|
|
|
/**
|
|
|
|
* Handles the full screen popup on mobile
|
|
|
|
*/
|
2020-09-03 14:44:48 +00:00
|
|
|
export class FullScreenMessageBox extends UIElement {
|
2020-07-30 23:45:54 +00:00
|
|
|
|
2020-09-12 21:15:17 +00:00
|
|
|
private readonly returnToTheMap: UIElement;
|
2020-11-15 13:56:20 +00:00
|
|
|
private _content: UIElement;
|
2020-06-27 01:06:51 +00:00
|
|
|
|
2020-07-30 23:45:54 +00:00
|
|
|
constructor(onClear: (() => void)) {
|
2020-11-16 00:59:30 +00:00
|
|
|
super(State.state.fullScreenMessage);
|
2020-09-03 14:44:48 +00:00
|
|
|
this.HideOnEmpty(true);
|
2020-06-29 01:12:44 +00:00
|
|
|
|
2020-09-12 21:15:17 +00:00
|
|
|
this.returnToTheMap =
|
2020-11-23 01:55:18 +00:00
|
|
|
new Combine([
|
|
|
|
// Wrapped another time to prevent the value of 'em' to fluctuate
|
|
|
|
Translations.t.general.returnToTheMap.Clone()
|
|
|
|
])
|
|
|
|
.onClick(() => {
|
|
|
|
State.state.fullScreenMessage.setData(undefined);
|
|
|
|
onClear();
|
|
|
|
})
|
|
|
|
.SetClass("to-the-map")
|
2020-06-29 01:12:44 +00:00
|
|
|
|
2020-06-27 01:06:51 +00:00
|
|
|
}
|
|
|
|
|
2020-06-29 01:12:44 +00:00
|
|
|
|
2020-09-03 14:44:48 +00:00
|
|
|
InnerRender(): string {
|
2020-09-12 21:15:17 +00:00
|
|
|
if (State.state.fullScreenMessage.data === undefined) {
|
2020-09-03 14:44:48 +00:00
|
|
|
return "";
|
2020-06-27 01:06:51 +00:00
|
|
|
}
|
2020-11-15 13:56:20 +00:00
|
|
|
this._content = State.state.fullScreenMessage.data;
|
2020-11-23 01:55:18 +00:00
|
|
|
const innerWrap = new Combine([this._content]).SetClass("fullscreenmessage-content")
|
|
|
|
|
|
|
|
return new Combine([innerWrap, this.returnToTheMap])
|
|
|
|
.SetStyle("display:block; height: 100%;")
|
2020-09-12 21:15:17 +00:00
|
|
|
.Render();
|
2020-06-27 01:06:51 +00:00
|
|
|
}
|
|
|
|
|
2020-11-23 01:55:18 +00:00
|
|
|
protected InnerUpdate(htmlElement: HTMLElement) {
|
|
|
|
super.InnerUpdate(htmlElement);
|
|
|
|
const height = htmlElement.getElementsByClassName("featureinfobox-titlebar")[0]?.clientHeight ?? 0;
|
|
|
|
htmlElement.style.setProperty("--variable-title-height", height+"px")
|
|
|
|
}
|
|
|
|
|
2020-09-03 14:44:48 +00:00
|
|
|
|
2020-06-27 01:06:51 +00:00
|
|
|
}
|