forked from MapComplete/MapComplete
		
	Better documentation
This commit is contained in:
		
							parent
							
								
									2f0f0847fb
								
							
						
					
					
						commit
						e55b299864
					
				
					 2 changed files with 33 additions and 28 deletions
				
			
		|  | @ -4,6 +4,8 @@ import Title from "./Base/Title"; | |||
| import List from "./Base/List"; | ||||
| import Translations from "./i18n/Translations"; | ||||
| import {QueryParameters} from "../Logic/Web/QueryParameters"; | ||||
| import FeatureSwitchState from "../Logic/State/FeatureSwitchState"; | ||||
| import LayoutConfig from "../Models/ThemeConfig/LayoutConfig"; | ||||
| 
 | ||||
| export default class QueryParameterDocumentation { | ||||
| 
 | ||||
|  | @ -24,6 +26,37 @@ export default class QueryParameterDocumentation { | |||
|         "Finally, the URL-hash is the part after the `#`. It is `node/1234` in this case." | ||||
|     ]) | ||||
| 
 | ||||
|     public static UrlParamDocs(): object{ | ||||
|         const dummyLayout = new LayoutConfig({ | ||||
|             id: ">theme<", | ||||
|             maintainer: "pietervdvn", | ||||
|             version: "0", | ||||
|             title: {en:"<theme>"}, | ||||
|             description: "A theme to generate docs with", | ||||
|             socialImage: "./assets/SocialImage.png", | ||||
|             startLat: 0, | ||||
|             startLon: 0, | ||||
|             startZoom: 0, | ||||
|             icon: undefined, | ||||
|             layers: [ | ||||
|                 { | ||||
|                     name: "<layer>", | ||||
|                     id: "<layer>", | ||||
|                     source: { | ||||
|                         osmTags: "id~*" | ||||
|                     }, | ||||
|                     mapRendering: null, | ||||
|                 } | ||||
|             ] | ||||
| 
 | ||||
|         }) | ||||
| 
 | ||||
|         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) { | ||||
|  |  | |||
|  | @ -128,34 +128,6 @@ Minimap.createMiniMap = _ => { | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| const dummyLayout = new LayoutConfig({ | ||||
|     id: ">theme<", | ||||
|     maintainer: "pietervdvn", | ||||
|     version: "0", | ||||
|     title: {en:"<theme>"}, | ||||
|     description: "A theme to generate docs with", | ||||
|     socialImage: "./assets/SocialImage.png", | ||||
|     startLat: 0, | ||||
|     startLon: 0, | ||||
|     startZoom: 0, | ||||
|     icon: undefined, | ||||
|     layers: [ | ||||
|         { | ||||
|             name: "<layer>", | ||||
|             id: "<layer>", | ||||
|             source: { | ||||
|                 osmTags: "id~*" | ||||
|             }, | ||||
|             mapRendering: null, | ||||
|         } | ||||
|     ] | ||||
| 
 | ||||
| }) | ||||
| 
 | ||||
| new FeatureSwitchState(dummyLayout) | ||||
| 
 | ||||
| QueryParameters.GetQueryParameter("layer-<layer-id>", "true", "Wether or not the layer with id <layer-id> is shown") | ||||
| 
 | ||||
| WriteFile("./Docs/URL_Parameters.md", QueryParameterDocumentation.GenerateQueryParameterDocs(), ["Logic/Web/QueryParameters.ts", "UI/QueryParameterDocumentation.ts"]) | ||||
| 
 | ||||
| console.log("Generated docs") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue