diff --git a/Logic/Osm/OsmConnection.ts b/Logic/Osm/OsmConnection.ts index 004cefa2a2..c085c5738d 100644 --- a/Logic/Osm/OsmConnection.ts +++ b/Logic/Osm/OsmConnection.ts @@ -67,7 +67,7 @@ export class OsmConnection { this.userDetails.data.dryRun = dryRun; const self =this; this.isLoggedIn = this.userDetails.map(user => user.loggedIn).addCallback(isLoggedIn => { - if(self.userDetails.data.loggedIn == false){ + if(self.userDetails.data.loggedIn == false && isLoggedIn == true){ // We have an inconsistency: the userdetails say we _didn't_ log in, but this actor says we do // This means someone attempted to toggle this; so we attempt to login! self.AttemptLogin() diff --git a/UI/BaseUIElement.ts b/UI/BaseUIElement.ts index 125d1ffc41..840814530e 100644 --- a/UI/BaseUIElement.ts +++ b/UI/BaseUIElement.ts @@ -43,7 +43,6 @@ export default abstract class BaseUIElement { throw "SEVERE: could not attach UIElement to " + divId; } - console.log("Attaching to ", element) while (element.firstChild) { //The list is LIVE so it will re-index each call element.removeChild(element.firstChild); diff --git a/UI/BigComponents/BackgroundSelector.ts b/UI/BigComponents/BackgroundSelector.ts index 8a92e359d9..3387ba0925 100644 --- a/UI/BigComponents/BackgroundSelector.ts +++ b/UI/BigComponents/BackgroundSelector.ts @@ -25,7 +25,7 @@ export default class BackgroundSelector extends VariableUiElement { if (baseLayers.length <= 1) { return undefined; } - return new DropDown(Translations.t.general.backgroundMap, baseLayers, State.state.backgroundLayer) + return new DropDown(Translations.t.general.backgroundMap.Clone(), baseLayers, State.state.backgroundLayer) } ) ) diff --git a/UI/BigComponents/FullWelcomePaneWithTabs.ts b/UI/BigComponents/FullWelcomePaneWithTabs.ts index 63f513488e..918df9cda4 100644 --- a/UI/BigComponents/FullWelcomePaneWithTabs.ts +++ b/UI/BigComponents/FullWelcomePaneWithTabs.ts @@ -27,8 +27,8 @@ export default class FullWelcomePaneWithTabs extends ScrollableFullScreen { "welcome" ,isShown ) } - - private static GenerateContents(layoutToUse: LayoutConfig, userDetails: UIEventSource) { + + private static ConstructBaseTabs(layoutToUse: LayoutConfig): { header: string | BaseUIElement; content: BaseUIElement }[]{ let welcome: BaseUIElement = new ThemeIntroductionPanel(); if (layoutToUse.id === personal.id) { @@ -55,8 +55,13 @@ export default class FullWelcomePaneWithTabs extends ScrollableFullScreen { }); } + return tabs; + } - const tabsWithAboutMc = [...tabs] + private static GenerateContents(layoutToUse: LayoutConfig, userDetails: UIEventSource) { + + const tabs = FullWelcomePaneWithTabs.ConstructBaseTabs(layoutToUse) + const tabsWithAboutMc = [...FullWelcomePaneWithTabs.ConstructBaseTabs(layoutToUse)] tabsWithAboutMc.push({ header: Svg.help, content: new Combine([Translations.t.general.aboutMapcomplete.Clone(), "
Version " + Constants.vNumber]) @@ -65,10 +70,11 @@ export default class FullWelcomePaneWithTabs extends ScrollableFullScreen { ); return new Toggle( - new TabbedComponent(tabsWithAboutMc, State.state.welcomeMessageOpenedTab), - new TabbedComponent(tabs, State.state.welcomeMessageOpenedTab), - userDetails.map(userdetails => - userdetails.csCount < Constants.userJourney.mapCompleteHelpUnlock) + new TabbedComponent(tabsWithAboutMc, State.state.welcomeMessageOpenedTab), + new TabbedComponent(tabs, State.state.welcomeMessageOpenedTab), + userDetails.map((userdetails: UserDetails) => + userdetails.loggedIn && + userdetails.csCount >= Constants.userJourney.mapCompleteHelpUnlock) ) } diff --git a/UI/BigComponents/LayerSelection.ts b/UI/BigComponents/LayerSelection.ts index 7810c7b10f..bb82a18a5c 100644 --- a/UI/BigComponents/LayerSelection.ts +++ b/UI/BigComponents/LayerSelection.ts @@ -43,7 +43,7 @@ export default class LayerSelection extends Combine { const zoomStatus = new VariableUiElement(State.state.locationControl.map(location => { if (location.zoom < layer.layerDef.minzoom) { - return Translations.t.general.layerSelection.zoomInToSeeThisLayer + return Translations.t.general.layerSelection.zoomInToSeeThisLayer.Clone() .SetClass("alert") .SetStyle("display: block ruby;width:min-content;") } diff --git a/UI/Input/DropDown.ts b/UI/Input/DropDown.ts index dffecae384..91f1d700e0 100644 --- a/UI/Input/DropDown.ts +++ b/UI/Input/DropDown.ts @@ -43,11 +43,14 @@ export class DropDown extends InputElement { el.appendChild(labelHtml) } } + + options = options ?? {} + options.select_class = options.select_class ?? 'bg-indigo-100 p-1 rounded hover:bg-indigo-200' { const select = document.createElement("select") - select.classList.add(...(options?.select_class?.split(" ") ?? [])) + select.classList.add(...(options.select_class.split(" ") ?? [])) for (let i = 0; i < values.length; i++) { const option = document.createElement("option") diff --git a/UI/LanguagePicker.ts b/UI/LanguagePicker.ts index 5616707dd4..0b30baf3ca 100644 --- a/UI/LanguagePicker.ts +++ b/UI/LanguagePicker.ts @@ -16,7 +16,7 @@ export default class LanguagePicker { return new DropDown(label, languages.map(lang => { return {value: lang, shown: lang} } - ), Locale.language, { select_class: 'bg-indigo-100 p-1 rounded hover:bg-indigo-200'}); + ), Locale.language); }