forked from MapComplete/MapComplete
		
	Fix title() element
This commit is contained in:
		
							parent
							
								
									f8847f9680
								
							
						
					
					
						commit
						6a76865312
					
				
					 1 changed files with 7 additions and 5 deletions
				
			
		| 
						 | 
					@ -45,6 +45,7 @@ import ImgurUploader from "../Logic/ImageProviders/ImgurUploader";
 | 
				
			||||||
import FileSelectorButton from "./Input/FileSelectorButton";
 | 
					import FileSelectorButton from "./Input/FileSelectorButton";
 | 
				
			||||||
import {LoginToggle} from "./Popup/LoginButton";
 | 
					import {LoginToggle} from "./Popup/LoginButton";
 | 
				
			||||||
import {start} from "repl";
 | 
					import {start} from "repl";
 | 
				
			||||||
 | 
					import {SubstitutedTranslation} from "./SubstitutedTranslation";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface SpecialVisualization {
 | 
					export interface SpecialVisualization {
 | 
				
			||||||
    funcName: string,
 | 
					    funcName: string,
 | 
				
			||||||
| 
						 | 
					@ -865,13 +866,14 @@ export default class SpecialVisualizations {
 | 
				
			||||||
                    args: [],
 | 
					                    args: [],
 | 
				
			||||||
                    docs:"Shows the title of the popup. Useful for some cases, e.g. 'What is phone number of {title()}?'",
 | 
					                    docs:"Shows the title of the popup. Useful for some cases, e.g. 'What is phone number of {title()}?'",
 | 
				
			||||||
                    example:"`What is the phone number of {title()}`, which might automatically become `What is the phone number of XYZ`.",
 | 
					                    example:"`What is the phone number of {title()}`, which might automatically become `What is the phone number of XYZ`.",
 | 
				
			||||||
                    constr: (state, tags, args, guistate) =>
 | 
					                    constr: (state, tagsSource, args, guistate) =>
 | 
				
			||||||
                        new VariableUiElement(tags.map(tags => {
 | 
					                        new VariableUiElement(tagsSource.map(tags => {
 | 
				
			||||||
                            const layer = state.layoutToUse.getMatchingLayer(tags)
 | 
					                            const layer = state.layoutToUse.getMatchingLayer(tags)
 | 
				
			||||||
                            console.log("Layer for tags", tags,"is", layer.id)
 | 
					 | 
				
			||||||
                            const title = layer?.title?.GetRenderValue(tags)
 | 
					                            const title = layer?.title?.GetRenderValue(tags)
 | 
				
			||||||
                            console.log("Title became: ", title)
 | 
					                            if(title === undefined){
 | 
				
			||||||
                            return title
 | 
					                                return undefined
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            return new SubstitutedTranslation(title, tagsSource, state)
 | 
				
			||||||
                        }))
 | 
					                        }))
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue