forked from MapComplete/MapComplete
Studio: theme editing
This commit is contained in:
parent
6e7eccf9de
commit
3aa9a21dea
34 changed files with 975 additions and 350 deletions
|
@ -129,7 +129,7 @@ export class DoesImageExist extends DesugaringStep<string> {
|
|||
}
|
||||
}
|
||||
|
||||
class ValidateTheme extends DesugaringStep<LayoutConfigJson> {
|
||||
export class ValidateTheme extends DesugaringStep<LayoutConfigJson> {
|
||||
/**
|
||||
* The paths where this layer is originally saved. Triggers some extra checks
|
||||
* @private
|
||||
|
@ -176,6 +176,9 @@ class ValidateTheme extends DesugaringStep<LayoutConfigJson> {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!json.title) {
|
||||
context.enter("title").err(`The theme ${json.id} does not have a title defined.`)
|
||||
}
|
||||
if (this._isBuiltin && this._extractImages !== undefined) {
|
||||
// Check images: are they local, are the licenses there, is the theme icon square, ...
|
||||
const images = this._extractImages.convert(json, context.inOperation("ValidateTheme"))
|
||||
|
@ -249,6 +252,20 @@ class ValidateTheme extends DesugaringStep<LayoutConfigJson> {
|
|||
new DetectDuplicatePresets().convert(theme, context)
|
||||
}
|
||||
|
||||
if (!theme.title) {
|
||||
context.enter("title").err("A theme must have a title")
|
||||
}
|
||||
|
||||
if (!theme.description) {
|
||||
context.enter("description").err("A theme must have a description")
|
||||
}
|
||||
|
||||
if (theme.overpassUrl && typeof theme.overpassUrl === "string") {
|
||||
context
|
||||
.enter("overpassUrl")
|
||||
.err("The overpassURL is a string, use a list of strings instead. Wrap it with [ ]")
|
||||
}
|
||||
|
||||
return json
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue