Small layout tweaks, fix #751

This commit is contained in:
Pieter Vander Vennet 2022-07-01 00:16:05 +02:00
parent 972d702315
commit e7e8a1a219
7 changed files with 57 additions and 51 deletions

View file

@ -55,11 +55,11 @@ export default class LayoutConfig {
public readonly usedImages: string[]
public readonly extraLink?: ExtraLinkConfig
public readonly definedAtUrl? : string;
public readonly definedAtUrl?: string;
public readonly definitionRaw?: string;
constructor(json: LayoutConfigJson, official = true,options?: {
constructor(json: LayoutConfigJson, official = true, options?: {
definedAtUrl?: string,
definitionRaw?: string
}) {
@ -75,7 +75,7 @@ export default class LayoutConfig {
throw "The id of a theme should match [a-z0-9-_]*: " + json.id
}
}
const context = this.id
const context = this.id
this.maintainer = json.maintainer;
this.credits = json.credits;
this.version = json.version;
@ -107,10 +107,10 @@ export default class LayoutConfig {
throw "Got undefined layers for " + json.id + " at " + context
}
}
this.title = new Translation(json.title, "themes:"+context + ".title");
this.description = new Translation(json.description, "themes:"+context + ".description");
this.shortDescription = json.shortDescription === undefined ? this.description.FirstSentence() : new Translation(json.shortDescription, "themes:"+context + ".shortdescription");
this.descriptionTail = json.descriptionTail === undefined ? undefined : new Translation(json.descriptionTail, "themes:"+context + ".descriptionTail");
this.title = new Translation(json.title, "themes:" + context + ".title");
this.description = new Translation(json.description, "themes:" + context + ".description");
this.shortDescription = json.shortDescription === undefined ? this.description.FirstSentence() : new Translation(json.shortDescription, "themes:" + context + ".shortdescription");
this.descriptionTail = json.descriptionTail === undefined ? undefined : new Translation(json.descriptionTail, "themes:" + context + ".descriptionTail");
this.icon = json.icon;
this.socialImage = json.socialImage ?? LayoutConfig.defaultSocialImage;
if (this.socialImage === "") {
@ -128,13 +128,13 @@ export default class LayoutConfig {
// At this point, layers should be expanded and validated either by the generateScript or the LegacyJsonConvert
this.layers = json.layers.map(lyrJson => new LayerConfig(<LayerConfigJson>lyrJson, json.id + ".layers." + lyrJson["id"], official));
this.extraLink = new ExtraLinkConfig(json.extraLink ?? {
this.extraLink = new ExtraLinkConfig(json.extraLink ?? {
icon: "./assets/svg/pop-out.svg",
href: "https://mapcomplete.osm.be/{theme}.html?lat={lat}&lon={lon}&z={zoom}&language={language}",
href: "https://{basepath}/{theme}.html?lat={lat}&lon={lon}&z={zoom}&language={language}",
newTab: true,
requirements: ["iframe","no-welcome-message"]
}, context+".extraLink")
requirements: ["iframe", "no-welcome-message"]
}, context + ".extraLink")
this.clustering = {
maxZoom: 16,
@ -211,5 +211,5 @@ export default class LayoutConfig {
}
return undefined
}
}