forked from MapComplete/MapComplete
Themes: fix conversion for legacy themes
This commit is contained in:
parent
4634ca27ae
commit
21c35fc2c5
2 changed files with 11 additions and 10 deletions
|
@ -168,8 +168,18 @@ export class UpdateLegacyLayer extends DesugaringStep<
|
||||||
const pr = rendering
|
const pr = rendering
|
||||||
if (pr["icon"]) {
|
if (pr["icon"]) {
|
||||||
try {
|
try {
|
||||||
const icon = Utils.NoEmpty(pr["icon"].split(";"))
|
let iconConfig = pr["icon"]
|
||||||
|
if (
|
||||||
|
Object.keys(iconConfig).length === 1 &&
|
||||||
|
iconConfig["render"] !== undefined
|
||||||
|
) {
|
||||||
|
iconConfig = iconConfig.render
|
||||||
|
}
|
||||||
|
const icon = Utils.NoEmpty(iconConfig.split(";"))
|
||||||
pr.marker = icon.map((i) => {
|
pr.marker = icon.map((i) => {
|
||||||
|
if (i.startsWith("http")) {
|
||||||
|
return { icon: i }
|
||||||
|
}
|
||||||
const [iconPath, color] = i.split(":")
|
const [iconPath, color] = i.split(":")
|
||||||
return { icon: iconPath, color }
|
return { icon: iconPath, color }
|
||||||
})
|
})
|
||||||
|
@ -243,10 +253,6 @@ class UpdateLegacyTheme extends DesugaringStep<LayoutConfigJson> {
|
||||||
delete oldThemeConfig.socialImage
|
delete oldThemeConfig.socialImage
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldThemeConfig.defaultBackgroundId === "osm") {
|
|
||||||
console.log("Removing old background in", json.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof oldThemeConfig.credits === "string") {
|
if (typeof oldThemeConfig.credits === "string") {
|
||||||
oldThemeConfig.credits = [oldThemeConfig.credits]
|
oldThemeConfig.credits = [oldThemeConfig.credits]
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,11 +27,6 @@ export default class WithContextLoader {
|
||||||
`${translationContext ?? this._context}.${key}.default value`
|
`${translationContext ?? this._context}.${key}.default value`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (Object.keys(v).length === 1 && typeof v["render"] === "string") {
|
|
||||||
throw `At ${
|
|
||||||
translationContext ?? "<unknown>"
|
|
||||||
}: use the content directly instead of {${key}: ${JSON.stringify(v)}}`
|
|
||||||
}
|
|
||||||
|
|
||||||
return new TagRenderingConfig(
|
return new TagRenderingConfig(
|
||||||
<QuestionableTagRenderingConfigJson>v,
|
<QuestionableTagRenderingConfigJson>v,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue