Add a 'more quests'-screen
This commit is contained in:
parent
19f69b31a4
commit
f9e0735378
6 changed files with 113 additions and 56 deletions
|
@ -0,0 +1,58 @@
|
|||
import {UIElement} from "./UIElement";
|
||||
import {VerticalCombine} from "./Base/VerticalCombine";
|
||||
import Translations from "./i18n/Translations";
|
||||
import {AllKnownLayouts} from "../Customizations/AllKnownLayouts";
|
||||
import {FixedUiElement} from "./Base/FixedUiElement";
|
||||
import {Utils} from "../Utils";
|
||||
import {link} from "fs";
|
||||
import {UIEventSource} from "./UIEventSource";
|
||||
import {VariableUiElement} from "./Base/VariableUIElement";
|
||||
|
||||
|
||||
export class MoreScreen extends UIElement {
|
||||
private currentLocation: UIEventSource<{ zoom: number, lat: number, lon: number }>;
|
||||
|
||||
constructor(currentLocation: UIEventSource<{ zoom: number, lat: number, lon: number }>) {
|
||||
super(currentLocation);
|
||||
this.currentLocation = currentLocation;
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
const tr = Translations.t.general.morescreen;
|
||||
|
||||
const els: UIElement[] = []
|
||||
for (const k in AllKnownLayouts.allSets) {
|
||||
if (k === "all") {
|
||||
continue;
|
||||
}
|
||||
const layout = AllKnownLayouts.allSets[k]
|
||||
|
||||
const linkText =
|
||||
`https://pietervdvn.github.io/MapComplete/${layout.name}.html?z=${this.currentLocation.data.zoom}&lat=${this.currentLocation.data.lat}&lon=${this.currentLocation.data.lon}
|
||||
`
|
||||
const link = new FixedUiElement(
|
||||
`
|
||||
<span class="switch-layout">
|
||||
<a href="${linkText}" target="_blank">
|
||||
<img src='${layout.icon}'>
|
||||
<div><b>${Utils.Upper(layout.name)}</b><br/>
|
||||
${Translations.W(layout.description).Render()}</div>
|
||||
</a>
|
||||
</span>
|
||||
`
|
||||
);
|
||||
|
||||
els.push(link)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return new VerticalCombine([
|
||||
tr.intro,
|
||||
new VerticalCombine(els),
|
||||
tr.streetcomplete
|
||||
]).Render();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue