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
|
@ -37,12 +37,13 @@ export default class FullWelcomePaneWithTabs extends ScrollableFullScreen {
|
|||
featurePipeline: FeaturePipeline
|
||||
backgroundLayer: UIEventSource<BaseLayer>
|
||||
filteredLayers: UIEventSource<FilteredLayer[]>
|
||||
} & UserRelatedState
|
||||
} & UserRelatedState,
|
||||
guistate?: { userInfoIsOpened: UIEventSource<boolean> }
|
||||
) {
|
||||
const layoutToUse = state.layoutToUse
|
||||
super(
|
||||
() => layoutToUse.title.Clone(),
|
||||
() => FullWelcomePaneWithTabs.GenerateContents(state, currentTab, isShown),
|
||||
() => FullWelcomePaneWithTabs.GenerateContents(state, currentTab, isShown, guistate),
|
||||
"welcome",
|
||||
isShown
|
||||
)
|
||||
|
@ -60,12 +61,13 @@ export default class FullWelcomePaneWithTabs extends ScrollableFullScreen {
|
|||
filteredLayers: UIEventSource<FilteredLayer[]>
|
||||
} & UserRelatedState,
|
||||
isShown: UIEventSource<boolean>,
|
||||
currentTab: UIEventSource<number>
|
||||
currentTab: UIEventSource<number>,
|
||||
guistate?: { userInfoIsOpened: UIEventSource<boolean> }
|
||||
): { header: string | BaseUIElement; content: BaseUIElement }[] {
|
||||
const tabs: { header: string | BaseUIElement; content: BaseUIElement }[] = [
|
||||
{
|
||||
header: `<img src='${state.layoutToUse.icon}'>`,
|
||||
content: new ThemeIntroductionPanel(isShown, currentTab, state),
|
||||
content: new ThemeIntroductionPanel(isShown, currentTab, state, guistate),
|
||||
},
|
||||
]
|
||||
|
||||
|
@ -113,11 +115,12 @@ export default class FullWelcomePaneWithTabs extends ScrollableFullScreen {
|
|||
filteredLayers: UIEventSource<FilteredLayer[]>
|
||||
} & UserRelatedState,
|
||||
currentTab: UIEventSource<number>,
|
||||
isShown: UIEventSource<boolean>
|
||||
isShown: UIEventSource<boolean>,
|
||||
guistate?: { userInfoIsOpened: UIEventSource<boolean> }
|
||||
) {
|
||||
const tabs = FullWelcomePaneWithTabs.ConstructBaseTabs(state, isShown, currentTab)
|
||||
const tabs = FullWelcomePaneWithTabs.ConstructBaseTabs(state, isShown, currentTab, guistate)
|
||||
const tabsWithAboutMc = [
|
||||
...FullWelcomePaneWithTabs.ConstructBaseTabs(state, isShown, currentTab),
|
||||
...FullWelcomePaneWithTabs.ConstructBaseTabs(state, isShown, currentTab, guistate),
|
||||
]
|
||||
|
||||
tabsWithAboutMc.push({
|
||||
|
|
|
@ -9,6 +9,7 @@ import Svg from "../../Svg"
|
|||
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
|
||||
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
||||
import FullWelcomePaneWithTabs from "./FullWelcomePaneWithTabs"
|
||||
import LoggedInUserIndicator from "../LoggedInUserIndicator"
|
||||
|
||||
export default class ThemeIntroductionPanel extends Combine {
|
||||
constructor(
|
||||
|
@ -20,7 +21,8 @@ export default class ThemeIntroductionPanel extends Combine {
|
|||
featureSwitchUserbadge: UIEventSource<boolean>
|
||||
layoutToUse: LayoutConfig
|
||||
osmConnection: OsmConnection
|
||||
}
|
||||
},
|
||||
guistate?: { userInfoIsOpened: UIEventSource<boolean> }
|
||||
) {
|
||||
const t = Translations.t.general
|
||||
const layout = state.layoutToUse
|
||||
|
@ -36,9 +38,18 @@ export default class ThemeIntroductionPanel extends Combine {
|
|||
})
|
||||
.SetClass("only-on-mobile")
|
||||
|
||||
const loggedInUserInfo = new LoggedInUserIndicator(state.osmConnection, {
|
||||
firstLine: Translations.t.general.welcomeBack.Clone(),
|
||||
})
|
||||
if (guistate?.userInfoIsOpened) {
|
||||
loggedInUserInfo.onClick(() => {
|
||||
guistate.userInfoIsOpened.setData(true)
|
||||
})
|
||||
}
|
||||
|
||||
const loginStatus = new Toggle(
|
||||
new LoginToggle(
|
||||
undefined,
|
||||
loggedInUserInfo,
|
||||
new Combine([
|
||||
Translations.t.general.loginWithOpenStreetMap.SetClass("text-xl font-bold"),
|
||||
Translations.t.general.loginOnlyNeededToEdit.Clone().SetClass("font-bold"),
|
||||
|
@ -60,7 +71,7 @@ export default class ThemeIntroductionPanel extends Combine {
|
|||
]).SetClass("flex flex-col mt-2"),
|
||||
|
||||
toTheMap,
|
||||
loginStatus.SetClass("block"),
|
||||
loginStatus.SetClass("block mt-6 pt-2 md:border-t-2 border-dotted border-gray-400"),
|
||||
layout.descriptionTail?.Clone().SetClass("block mt-4"),
|
||||
|
||||
languagePicker?.SetClass("block mt-4"),
|
||||
|
|
|
@ -140,12 +140,17 @@ class UserInformationMainPanel extends Combine {
|
|||
}
|
||||
|
||||
export default class UserInformationPanel extends ScrollableFullScreen {
|
||||
constructor(state: {
|
||||
layoutToUse: LayoutConfig
|
||||
osmConnection: OsmConnection
|
||||
locationControl: UIEventSource<Loc>
|
||||
}) {
|
||||
const isOpened = new UIEventSource<boolean>(false)
|
||||
constructor(
|
||||
state: {
|
||||
layoutToUse: LayoutConfig
|
||||
osmConnection: OsmConnection
|
||||
locationControl: UIEventSource<Loc>
|
||||
},
|
||||
options?: {
|
||||
isOpened?: UIEventSource<boolean>
|
||||
}
|
||||
) {
|
||||
const isOpened = options?.isOpened ?? new UIEventSource<boolean>(false)
|
||||
super(
|
||||
() => {
|
||||
return new VariableUiElement(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue