diff --git a/UI/SpecialVisualizations.ts b/UI/SpecialVisualizations.ts index 0bf5f94ac..92292fb09 100644 --- a/UI/SpecialVisualizations.ts +++ b/UI/SpecialVisualizations.ts @@ -18,6 +18,9 @@ import State from "../State"; import {ImageSearcher} from "../Logic/Actors/ImageSearcher"; import BaseUIElement from "./BaseUIElement"; import LayerConfig from "../Customizations/JSON/LayerConfig"; +import List from "./Base/List"; +import Title from "./Base/Title"; +import Table from "./Base/Table"; export default class SpecialVisualizations { @@ -185,7 +188,11 @@ export default class SpecialVisualizations { const keys = Array.from(counts.keys()) keys.sort() - return "" + return new List(keys.map(key=> new Combine[ + new FixedUiElement(key).SetClass("font-bold"), + counts.get(key) + ])); + }catch{ return "Could not generate histogram" // TODO translate @@ -253,18 +260,12 @@ export default class SpecialVisualizations { const helpTexts = SpecialVisualizations.specialVisualizations.map(viz => new Combine( [ - `

${viz.funcName}

`, + new Title(viz.funcName, 3), viz.docs, - "
    ", - ...viz.args.map(arg => new Combine([ - "
  1. ", - "" + arg.name + ": ", - arg.doc, - arg.defaultValue === undefined ? "" : (" Default: " + arg.defaultValue + ""), - "
  2. " - ])), - "
", - "Example usage: ", + new Table( ["name","default","description"], + viz.args.map(arg => [arg.name, arg.defaultValue ?? "undefined", arg.doc]) + ), + new Title("Example usage", 4), new FixedUiElement( viz.example ?? "{" + viz.funcName + "(" + viz.args.map(arg => arg.defaultValue).join(",") + ")}" ).SetClass("literal-code"), @@ -274,7 +275,7 @@ export default class SpecialVisualizations { return new Combine([ - "

Special tag renderings

", + new Title("Special tag renderings",3), "In a tagrendering, some special values are substituted by an advanced UI-element. This allows advanced features and visualizations to be reused by custom themes or even to query third-party API's.", "General usage is {func_name()} or {func_name(arg, someotherarg)}. Note that you do not need to use quotes around your arguments, the comma is enough to seperate them. This also implies you cannot use a comma in your args", ...helpTexts