forked from MapComplete/MapComplete
		
	Fix login button, close on 'move to home location'
This commit is contained in:
		
							parent
							
								
									8498754e10
								
							
						
					
					
						commit
						cfd47ec30c
					
				
					 1 changed files with 10 additions and 6 deletions
				
			
		| 
						 | 
					@ -40,7 +40,8 @@ class UserInformationMainPanel extends Combine {
 | 
				
			||||||
    constructor(
 | 
					    constructor(
 | 
				
			||||||
        osmConnection: OsmConnection,
 | 
					        osmConnection: OsmConnection,
 | 
				
			||||||
        locationControl: UIEventSource<Loc>,
 | 
					        locationControl: UIEventSource<Loc>,
 | 
				
			||||||
        layout: LayoutConfig
 | 
					        layout: LayoutConfig,
 | 
				
			||||||
 | 
					        isOpened: UIEventSource<boolean>
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
        const t = Translations.t.userinfo
 | 
					        const t = Translations.t.userinfo
 | 
				
			||||||
        const imgSize = "h-6 w-6"
 | 
					        const imgSize = "h-6 w-6"
 | 
				
			||||||
| 
						 | 
					@ -50,8 +51,8 @@ class UserInformationMainPanel extends Combine {
 | 
				
			||||||
                ud.map((ud) => {
 | 
					                ud.map((ud) => {
 | 
				
			||||||
                    if (!ud?.loggedIn) {
 | 
					                    if (!ud?.loggedIn) {
 | 
				
			||||||
                        // Not logged in
 | 
					                        // Not logged in
 | 
				
			||||||
                        return new SubtleButton(Svg.login_svg(), "Login", { imgSize }).onClick(
 | 
					                        return new SubtleButton(Svg.login_svg(), "Login", { imgSize }).onClick(() =>
 | 
				
			||||||
                            osmConnection.AttemptLogin
 | 
					                            osmConnection.AttemptLogin()
 | 
				
			||||||
                        )
 | 
					                        )
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,6 +97,7 @@ class UserInformationMainPanel extends Combine {
 | 
				
			||||||
                                return
 | 
					                                return
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            locationControl.setData({ ...home, zoom: 16 })
 | 
					                            locationControl.setData({ ...home, zoom: 16 })
 | 
				
			||||||
 | 
					                            isOpened.setData(false)
 | 
				
			||||||
                        })
 | 
					                        })
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -143,7 +145,7 @@ export default class UserInformationPanel extends ScrollableFullScreen {
 | 
				
			||||||
        osmConnection: OsmConnection
 | 
					        osmConnection: OsmConnection
 | 
				
			||||||
        locationControl: UIEventSource<Loc>
 | 
					        locationControl: UIEventSource<Loc>
 | 
				
			||||||
    }) {
 | 
					    }) {
 | 
				
			||||||
        const t = Translations.t.general
 | 
					        const isOpened = new UIEventSource<boolean>(false)
 | 
				
			||||||
        super(
 | 
					        super(
 | 
				
			||||||
            () => {
 | 
					            () => {
 | 
				
			||||||
                return new VariableUiElement(
 | 
					                return new VariableUiElement(
 | 
				
			||||||
| 
						 | 
					@ -154,10 +156,12 @@ export default class UserInformationPanel extends ScrollableFullScreen {
 | 
				
			||||||
                return new UserInformationMainPanel(
 | 
					                return new UserInformationMainPanel(
 | 
				
			||||||
                    state.osmConnection,
 | 
					                    state.osmConnection,
 | 
				
			||||||
                    state.locationControl,
 | 
					                    state.locationControl,
 | 
				
			||||||
                    state.layoutToUse
 | 
					                    state.layoutToUse,
 | 
				
			||||||
 | 
					                    isOpened
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "userinfo"
 | 
					            "userinfo",
 | 
				
			||||||
 | 
					            isOpened
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue