forked from MapComplete/MapComplete
		
	User flow improvements for the theme introduction panel
This commit is contained in:
		
							parent
							
								
									b4f739e506
								
							
						
					
					
						commit
						98866b4a57
					
				
					 10 changed files with 156 additions and 62 deletions
				
			
		
							
								
								
									
										42
									
								
								UI/LoggedInUserIndicator.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								UI/LoggedInUserIndicator.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| import { VariableUiElement } from "./Base/VariableUIElement" | ||||
| import { OsmConnection } from "../Logic/Osm/OsmConnection" | ||||
| import Svg from "../Svg" | ||||
| import Img from "./Base/Img" | ||||
| import Combine from "./Base/Combine" | ||||
| import { FixedUiElement } from "./Base/FixedUiElement" | ||||
| import BaseUIElement from "./BaseUIElement" | ||||
| 
 | ||||
| export default class LoggedInUserIndicator extends VariableUiElement { | ||||
|     constructor( | ||||
|         osmConnection: OsmConnection, | ||||
|         options?: { | ||||
|             size?: "small" | "medium" | "large" | ||||
|             firstLine?: BaseUIElement | ||||
|         } | ||||
|     ) { | ||||
|         options = options ?? {} | ||||
|         let size = "w-8 h-8 mr-2" | ||||
|         if (options.size == "medium") { | ||||
|             size = "w-16 h-16 mr-4" | ||||
|         } else if (options.size == "large") { | ||||
|             size = "w-32 h-32 mr-6" | ||||
|         } | ||||
|         super( | ||||
|             osmConnection.userDetails.mapD((ud) => { | ||||
|                 let img = Svg.person_svg().SetClass( | ||||
|                     "rounded-full border border-black overflow-hidden" | ||||
|                 ) | ||||
|                 if (ud.img) { | ||||
|                     img = new Img(ud.img) | ||||
|                 } | ||||
|                 let contents: BaseUIElement = new FixedUiElement(ud.name).SetClass("font-bold") | ||||
|                 if (options?.firstLine) { | ||||
|                     contents = new Combine([options.firstLine, contents]).SetClass("flex flex-col") | ||||
|                 } | ||||
|                 return new Combine([img.SetClass("rounded-full " + size), contents]).SetClass( | ||||
|                     "flex items-center" | ||||
|                 ) | ||||
|             }) | ||||
|         ) | ||||
|     } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue