forked from MapComplete/MapComplete
More small fixes to the refactoring
This commit is contained in:
parent
8ad9b816ac
commit
eec762b71f
7 changed files with 21 additions and 13 deletions
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
|
@ -27,8 +27,8 @@ export default class FullWelcomePaneWithTabs extends ScrollableFullScreen {
|
|||
"welcome" ,isShown
|
||||
)
|
||||
}
|
||||
|
||||
private static GenerateContents(layoutToUse: LayoutConfig, userDetails: UIEventSource<UserDetails>) {
|
||||
|
||||
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<UserDetails>) {
|
||||
|
||||
const tabs = FullWelcomePaneWithTabs.ConstructBaseTabs(layoutToUse)
|
||||
const tabsWithAboutMc = [...FullWelcomePaneWithTabs.ConstructBaseTabs(layoutToUse)]
|
||||
tabsWithAboutMc.push({
|
||||
header: Svg.help,
|
||||
content: new Combine([Translations.t.general.aboutMapcomplete.Clone(), "<br/>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)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -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;")
|
||||
}
|
||||
|
|
|
@ -43,11 +43,14 @@ export class DropDown<T> extends InputElement<T> {
|
|||
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")
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue