2020-06-27 03:06:51 +02:00
|
|
|
import {UIElement} from "./UIElement";
|
2020-07-21 02:55:28 +02:00
|
|
|
import Translations from "./i18n/Translations";
|
2020-10-02 19:00:24 +02:00
|
|
|
import State from "../State";
|
2020-09-03 16:44:48 +02:00
|
|
|
import Combine from "./Base/Combine";
|
2020-06-27 03:06:51 +02:00
|
|
|
|
2020-07-21 02:55:28 +02:00
|
|
|
/**
|
|
|
|
* Handles the full screen popup on mobile
|
|
|
|
*/
|
2020-09-03 16:44:48 +02:00
|
|
|
export class FullScreenMessageBox extends UIElement {
|
2020-07-31 01:45:54 +02:00
|
|
|
|
2020-09-12 23:15:17 +02:00
|
|
|
private readonly returnToTheMap: UIElement;
|
2020-11-15 14:56:20 +01:00
|
|
|
private _content: UIElement;
|
2020-06-27 03:06:51 +02:00
|
|
|
|
2020-07-31 01:45:54 +02:00
|
|
|
constructor(onClear: (() => void)) {
|
2020-11-16 01:59:30 +01:00
|
|
|
super(State.state.fullScreenMessage);
|
2020-09-03 16:44:48 +02:00
|
|
|
this.HideOnEmpty(true);
|
2020-06-29 03:12:44 +02:00
|
|
|
|
2020-09-12 23:15:17 +02:00
|
|
|
this.returnToTheMap =
|
|
|
|
new Combine([Translations.t.general.returnToTheMap.Clone().SetStyle("font-size:xx-large")])
|
2020-11-15 19:17:36 +01:00
|
|
|
.SetStyle("background:var(--catch-detail-color);" +
|
2020-11-15 00:27:55 +01:00
|
|
|
"position: fixed;" +
|
|
|
|
"z-index: 10000;" +
|
|
|
|
"bottom: 0;" +
|
|
|
|
"left: 0;" +
|
2020-11-16 01:59:30 +01:00
|
|
|
`height: var(--return-to-the-map-height);` +
|
2020-09-12 23:15:17 +02:00
|
|
|
"width: 100vw;" +
|
2020-11-15 19:17:36 +01:00
|
|
|
"color: var(--catch-detail-color-contrast);" +
|
2020-09-12 23:15:17 +02:00
|
|
|
"font-weight: bold;" +
|
|
|
|
"pointer-events: all;" +
|
|
|
|
"cursor: pointer;" +
|
|
|
|
"padding-top: 1.2em;" +
|
|
|
|
"text-align: center;" +
|
|
|
|
"padding-bottom: 1.2em;" +
|
|
|
|
"box-sizing:border-box")
|
2020-07-21 00:07:04 +02:00
|
|
|
.onClick(() => {
|
2020-09-03 16:44:48 +02:00
|
|
|
State.state.fullScreenMessage.setData(undefined);
|
2020-07-21 00:07:04 +02:00
|
|
|
onClear();
|
2020-09-03 16:44:48 +02:00
|
|
|
});
|
2020-06-29 03:12:44 +02:00
|
|
|
|
2020-06-27 03:06:51 +02:00
|
|
|
}
|
|
|
|
|
2020-06-29 03:12:44 +02:00
|
|
|
|
2020-09-03 16:44:48 +02:00
|
|
|
InnerRender(): string {
|
2020-09-12 23:15:17 +02:00
|
|
|
if (State.state.fullScreenMessage.data === undefined) {
|
2020-09-03 16:44:48 +02:00
|
|
|
return "";
|
2020-06-27 03:06:51 +02:00
|
|
|
}
|
2020-11-15 14:56:20 +01:00
|
|
|
this._content = State.state.fullScreenMessage.data;
|
|
|
|
const uielement = new Combine([this._content]).SetStyle(
|
2020-11-15 00:27:55 +01:00
|
|
|
"display:block;" +
|
|
|
|
"padding: 1em;" +
|
|
|
|
"padding-bottom:6em;" +
|
2020-11-16 01:59:30 +01:00
|
|
|
`margin-bottom: var(--return-to-the-map-height);` +
|
2020-11-15 00:27:55 +01:00
|
|
|
"box-sizing:border-box;" +
|
2020-11-16 01:59:30 +01:00
|
|
|
`height:calc(100vh - var(--return-to-the-map-height));` +
|
2020-11-15 00:27:55 +01:00
|
|
|
"overflow-y: auto;" +
|
|
|
|
"max-width:100vw;" +
|
|
|
|
"overflow-x:hidden;" +
|
|
|
|
"background:var(--background-color);" +
|
|
|
|
"color: var(--foreground-color);"
|
|
|
|
);
|
|
|
|
return new Combine([uielement, this.returnToTheMap])
|
2020-09-12 23:15:17 +02:00
|
|
|
.Render();
|
2020-06-27 03:06:51 +02:00
|
|
|
}
|
|
|
|
|
2020-09-03 16:44:48 +02:00
|
|
|
|
2020-06-27 03:06:51 +02:00
|
|
|
}
|