From f837d60756bc255aa2490457cb6cf1dbf06c5ff8 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Thu, 27 May 2021 18:56:02 +0200 Subject: [PATCH] Fixes to contribution panel --- Customizations/JSON/LayoutConfig.ts | 4 ++-- UI/BigComponents/AttributionPanel.ts | 6 +++++- assets/themes/speelplekken/speelplekken.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Customizations/JSON/LayoutConfig.ts b/Customizations/JSON/LayoutConfig.ts index ba1032cf59..00764d490f 100644 --- a/Customizations/JSON/LayoutConfig.ts +++ b/Customizations/JSON/LayoutConfig.ts @@ -32,7 +32,7 @@ export default class LayoutConfig { }; public readonly hideFromOverview: boolean; - public readonly lockLocation: boolean | [[number, number], [number, number]]; + public lockLocation: boolean | [[number, number], [number, number]]; public readonly enableUserBadge: boolean; public readonly enableShareScreen: boolean; public readonly enableMoreQuests: boolean; @@ -174,7 +174,7 @@ export default class LayoutConfig { if (json.hideInOverview) { throw "The json for " + this.id + " contains a 'hideInOverview'. Did you mean hideFromOverview instead?" } - this.lockLocation = json.lockLocation ?? false; + this.lockLocation = json.lockLocation ?? undefined; this.enableUserBadge = json.enableUserBadge ?? true; this.enableShareScreen = json.enableShareScreen ?? true; this.enableMoreQuests = json.enableMoreQuests ?? true; diff --git a/UI/BigComponents/AttributionPanel.ts b/UI/BigComponents/AttributionPanel.ts index 294689c030..2ab3fe2f32 100644 --- a/UI/BigComponents/AttributionPanel.ts +++ b/UI/BigComponents/AttributionPanel.ts @@ -30,7 +30,7 @@ export default class AttributionPanel extends Combine { "
", new VariableUiElement(contributions.map(contributions => { - const sorted = Array.from(contributions, ([name, value]) => ({name, value})); + const sorted = Array.from(contributions, ([name, value]) => ({name, value})).filter(x => x.name !== undefined && x.name !== "undefined"); if (sorted.length === 0) { return ""; } @@ -77,6 +77,10 @@ export default class AttributionPanel extends Combine { let contribsStr = filtered.map(c => c.contributor) .join(", ") + if(contribsStr === ""){ + // Hmm, something went wrong loading the contributors list. Lets show nothing + return undefined; + } return Translations.t.general.attribution.codeContributionsBy.Subs({ contributors: contribsStr, diff --git a/assets/themes/speelplekken/speelplekken.json b/assets/themes/speelplekken/speelplekken.json index 26f8218cd1..5476339b07 100644 --- a/assets/themes/speelplekken/speelplekken.json +++ b/assets/themes/speelplekken/speelplekken.json @@ -39,7 +39,7 @@ "builtin": "play_forest", "override": { "source": { - "geoJson": "https://pietervdvn.github.io/speelplekken_cache/speelplekken_{z}_{x}_{y}.geojson", + "geoJson": "https://pietervdvn.github.io/speelplekken_cache/speelplekken_{layer}_{z}_{x}_{y}.geojson", "geoJsonZoomLevel": 14, "isOsmCache": true },