forked from MapComplete/MapComplete
Change type of query-parameter-documention to Map instead of an object
This commit is contained in:
parent
53e760437c
commit
8b59f1208e
3 changed files with 13 additions and 10 deletions
|
@ -6,6 +6,7 @@ import Translations from "./i18n/Translations";
|
|||
import {QueryParameters} from "../Logic/Web/QueryParameters";
|
||||
import FeatureSwitchState from "../Logic/State/FeatureSwitchState";
|
||||
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig";
|
||||
import {DefaultGuiState} from "./DefaultGuiState";
|
||||
|
||||
export default class QueryParameterDocumentation {
|
||||
|
||||
|
@ -26,12 +27,12 @@ export default class QueryParameterDocumentation {
|
|||
"Finally, the URL-hash is the part after the `#`. It is `node/1234` in this case."
|
||||
])
|
||||
|
||||
public static UrlParamDocs(): object{
|
||||
public static UrlParamDocs(): Map<string, string> {
|
||||
const dummyLayout = new LayoutConfig({
|
||||
id: ">theme<",
|
||||
maintainer: "pietervdvn",
|
||||
version: "0",
|
||||
title: {en:"<theme>"},
|
||||
title: {en: "<theme>"},
|
||||
description: "A theme to generate docs with",
|
||||
socialImage: "./assets/SocialImage.png",
|
||||
startLat: 0,
|
||||
|
@ -50,24 +51,26 @@ export default class QueryParameterDocumentation {
|
|||
]
|
||||
|
||||
})
|
||||
|
||||
new DefaultGuiState(); // Init a featureSwitchState to init all the parameters
|
||||
new FeatureSwitchState(dummyLayout)
|
||||
|
||||
QueryParameters.GetQueryParameter("layer-<layer-id>", "true", "Wether or not the layer with id <layer-id> is shown")
|
||||
return QueryParameters.documentation
|
||||
}
|
||||
|
||||
|
||||
public static GenerateQueryParameterDocs(): BaseUIElement {
|
||||
|
||||
|
||||
const docs: (string | BaseUIElement)[] = [...QueryParameterDocumentation.QueryParamDocsIntro];
|
||||
for (const key in QueryParameters.documentation) {
|
||||
this.UrlParamDocs().forEach((value, key) => {
|
||||
const c = new Combine([
|
||||
new Title(key, 2),
|
||||
QueryParameters.documentation[key],
|
||||
value,
|
||||
QueryParameters.defaults[key] === undefined ? "No default value set" : `The default value is _${QueryParameters.defaults[key]}_`
|
||||
|
||||
])
|
||||
docs.push(c)
|
||||
}
|
||||
})
|
||||
return new Combine(docs).SetClass("flex flex-col")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue