Port bird-hides to new JSON-format, various improvements

This commit is contained in:
Pieter Vander Vennet 2020-09-03 19:05:18 +02:00
parent 00a6611e1f
commit 9e4035befc
22 changed files with 460 additions and 378 deletions

View file

@ -22,7 +22,7 @@ export default class CustomGeneratorPanel extends UIElement {
private mainPanel: UIElement;
private loginButton: UIElement;
private connection: OsmConnection;
private readonly connection: OsmConnection;
constructor(connection: OsmConnection, layout: LayoutConfigJson) {
super(connection.userDetails);
@ -40,7 +40,7 @@ export default class CustomGeneratorPanel extends UIElement {
private InitMainPanel(layout: LayoutConfigJson, userDetails: UserDetails, connection: OsmConnection) {
const es = new UIEventSource(layout);
const encoded = es.map(config => btoa(JSON.stringify(config)));
encoded.addCallback(encoded => LocalStorageSource.Get("\"last-custom-theme\""))
encoded.addCallback(encoded => LocalStorageSource.Get("last-custom-theme"))
const liveUrl = encoded.map(encoded => `./index.html?userlayout=${es.data.id}#${encoded}`)
const iframe = liveUrl.map(url => `<iframe src='${url}' width='100%' height='99%' style="box-sizing: border-box" title='Theme Preview'></iframe>`);
const currentSetting = new UIEventSource<SingleSetting<any>>(undefined)

View file

@ -11,7 +11,7 @@ export class GenerateEmpty {
overpassTags: {and: [""]},
title: undefined,
description: {},
tagRenderings: []
tagRenderings: [],
}
}

View file

@ -41,7 +41,7 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
this.options = options ?? {};
const questionsNotUnlocked = userDetails.csCount < State.userJourney.themeGeneratorFullUnlock;
this.options.disableQuestions =
(this.options.disableQuestions ?? false) &&
(this.options.disableQuestions ?? false) ||
questionsNotUnlocked;
this.intro = new Combine(["<h3>", options?.title ?? "TagRendering", "</h3>", options?.description ?? ""])

View file

@ -85,7 +85,7 @@ export class ImageCarousel extends TagDependantUIElement {
this._deleteButton = new ConfirmDialog(showDeleteButton,
"<img src='assets/delete.svg' alt='Afbeelding verwijderen' class='delete-image'>",
"<img src='./assets/delete.svg' alt='Afbeelding verwijderen' class='delete-image'>",
"<span>Afbeelding verwijderen</span>",
"<span>Terug</span>",
deleteCurrent,
@ -149,6 +149,7 @@ export class ImageCarousel extends TagDependantUIElement {
Activate() {
super.Activate();
this.searcher.Activate();
return this;
}
}

View file

@ -53,6 +53,7 @@ class ImageCarouselWithUpload extends TagDependantUIElement {
super.Activate();
this._imageElement.Activate();
this._pictureUploader.Activate();
return this;
}
Update() {

View file

@ -16,7 +16,7 @@ export default class SingleTagInput extends InputElement<string> {
constructor(value: UIEventSource<string> = undefined) {
super(undefined);
this._value = value ?? new UIEventSource<string>(undefined);
this._value = value ?? new UIEventSource<string>("");
this.key = TextField.KeyInput();

View file

@ -86,6 +86,7 @@ export class SlideShow extends UIElement {
}
this._next.Update();
this._prev.Update();
return this;
}
}

View file

@ -47,7 +47,7 @@ export class UserBadge extends UIElement {
this._homeButton = new VariableUiElement(
this._userDetails.map((userinfo) => {
if (userinfo.home) {
return "<img id='home' src='./assets/home.svg' alt='home' class='small-userbadge-icon'> ";
return "<img src='./assets/home.svg' alt='home' class='small-userbadge-icon'> ";
}
return "";
})