From edb5b06f123eca4a5a2ed774245d47631aee204f Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Fri, 8 Apr 2022 01:55:42 +0200 Subject: [PATCH] Improve layer docs generation --- Models/ThemeConfig/TagRenderingConfig.ts | 12 +++++++++++- UI/Base/FixedUiElement.ts | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Models/ThemeConfig/TagRenderingConfig.ts b/Models/ThemeConfig/TagRenderingConfig.ts index b1fcc78aa..6af7592cd 100644 --- a/Models/ThemeConfig/TagRenderingConfig.ts +++ b/Models/ThemeConfig/TagRenderingConfig.ts @@ -12,6 +12,7 @@ import Title from "../../UI/Base/Title"; import Link from "../../UI/Base/Link"; import List from "../../UI/Base/List"; import {QuestionableTagRenderingConfigJson} from "./Json/QuestionableTagRenderingConfigJson"; +import {FixedUiElement} from "../../UI/Base/FixedUiElement"; /*** * The parsed version of TagRenderingConfigJSON @@ -533,12 +534,21 @@ export default class TagRenderingConfig { ) ) } + + let condition : BaseUIElement = undefined + if(this.condition !== undefined && !this.condition?.matchesProperties({})){ + condition = new Combine(["Only visible if", + new FixedUiElement( this.condition.asHumanString(false, false, {}) + ).SetClass("code") + , "is shown"]) + } return new Combine([ new Title(this.id, 3), this.question !== undefined ? "The question is **" + this.question.txt + "**" : "_This tagrendering has no question and is thus read-only_", new Combine(withRender), - mappings + mappings, + condition ]).SetClass("flex-col"); } } \ No newline at end of file diff --git a/UI/Base/FixedUiElement.ts b/UI/Base/FixedUiElement.ts index 4600d26ff..1b2c7c4d3 100644 --- a/UI/Base/FixedUiElement.ts +++ b/UI/Base/FixedUiElement.ts @@ -13,6 +13,9 @@ export class FixedUiElement extends BaseUIElement { } AsMarkdown(): string { + if(this.HasClass("code")){ + return "`"+this.content+"`" + } return this.content; }