diff --git a/scripts/importCustomTheme.ts b/scripts/importCustomTheme.ts index 70de201c0..2ee03fd66 100644 --- a/scripts/importCustomTheme.ts +++ b/scripts/importCustomTheme.ts @@ -14,13 +14,20 @@ import { GenerateLicenseInfo } from "./generateLicenseInfo" class ImportCustomTheme extends Script { constructor() { - super("Given the path of a custom layer, will load the layer into mapcomplete as official") + super(["Given the path of a custom layer, will load the layer into mapcomplete as official","", + "Usage:", + "vite-node scripts/importCustomTheme.ts "].join("\n")) } async main(args: string[]) { + if(args.length === 0){ + this.printHelp() + return + } const path = args[0] - const layerconfig = JSON.parse(readFileSync(path, "utf-8")) + const layerconfig = JSON.parse( + readFileSync(path, "utf-8")) const id = layerconfig.id const dirPath = "./assets/layers/" + id if (!existsSync(dirPath)) { diff --git a/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts b/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts index 34f4831f8..b0aa9cecc 100644 --- a/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts +++ b/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts @@ -216,6 +216,12 @@ export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJs */ multiAnswer?: boolean + /** + * question: If one or more answers match (in case of a multiAnswer), what title/intro should be added? + * ifunset: don't show a title + */ + multiTitle?: Translatable + /** * Allow freeform text input from the user */ diff --git a/src/Models/ThemeConfig/Json/ThemeConfigJson.ts b/src/Models/ThemeConfig/Json/ThemeConfigJson.ts index 4644b1a8f..4177ea817 100644 --- a/src/Models/ThemeConfig/Json/ThemeConfigJson.ts +++ b/src/Models/ThemeConfig/Json/ThemeConfigJson.ts @@ -45,6 +45,7 @@ export interface ThemeConfigJson { * question: What is the title of this theme? * * The human-readable title, as shown in the welcome message and the index page + * ifunset: reuse 'name' from the only layer * group: basic */ title: Translatable diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index 25da44ccf..befa3ff70 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -92,6 +92,7 @@ export default class TagRenderingConfig { } public readonly multiAnswer: boolean + public readonly multiTitle?: Translation public mappings: Mapping[] public readonly editButtonAriaLabel?: Translation @@ -164,6 +165,7 @@ export default class TagRenderingConfig { this.questionHintIsMd = json["questionHintIsMd"] ?? false this.alwaysForceSaveButton = json["#force-save-button"] === "yes" this.description = Translations.T(json.description, translationKey + ".description") + this.multiTitle = Translations.T(json.multiTitle, translationKey + ".multiTitle") this._definedIn = json._definedIn if (json.onSoftDelete && !Array.isArray(json.onSoftDelete)) { throw context + ".onSoftDelete Not an array: " + typeof json.onSoftDelete diff --git a/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte b/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte index 3c0342586..e6efe22d3 100644 --- a/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte @@ -9,6 +9,7 @@ import { twMerge } from "tailwind-merge" import { onDestroy } from "svelte" import { Lists } from "../../../Utils/Lists" + import Tr from "../../Base/Tr.svelte" export let tags: UIEventSource | undefined> @@ -34,10 +35,12 @@ {#if config !== undefined && (config?.condition === undefined || config.condition.matchesProperties($tags))}