2022-01-08 14:08:04 +01:00
|
|
|
import {SubtleButton} from "../Base/SubtleButton";
|
|
|
|
import BaseUIElement from "../BaseUIElement";
|
|
|
|
import Svg from "../../Svg";
|
|
|
|
import {OsmConnection} from "../../Logic/Osm/OsmConnection";
|
|
|
|
import Toggle from "../Input/Toggle";
|
|
|
|
|
|
|
|
export default class LoginButton extends SubtleButton {
|
|
|
|
|
|
|
|
constructor(text: BaseUIElement | string, state: {
|
|
|
|
osmConnection: OsmConnection
|
|
|
|
}) {
|
2022-01-08 17:44:23 +01:00
|
|
|
super(Svg.osm_logo_ui(), text);
|
2022-01-08 14:08:04 +01:00
|
|
|
this.onClick(() => {
|
|
|
|
state.osmConnection.AttemptLogin()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class LoginToggle extends Toggle {
|
|
|
|
constructor(el, text: BaseUIElement | string, state: {
|
|
|
|
osmConnection: OsmConnection
|
|
|
|
}) {
|
|
|
|
super(el, new LoginButton(text, state), state.osmConnection.isLoggedIn)
|
|
|
|
}
|
|
|
|
}
|