| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | import Combine from "../Base/Combine" | 
					
						
							|  |  |  | import LanguagePicker from "../LanguagePicker" | 
					
						
							|  |  |  | import Translations from "../i18n/Translations" | 
					
						
							|  |  |  | import Toggle from "../Input/Toggle" | 
					
						
							|  |  |  | import { SubtleButton } from "../Base/SubtleButton" | 
					
						
							| 
									
										
										
										
											2023-01-06 03:46:10 +01:00
										 |  |  | import { Store, UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | import { LoginToggle } from "../Popup/LoginButton" | 
					
						
							|  |  |  | import Svg from "../../Svg" | 
					
						
							|  |  |  | import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig" | 
					
						
							|  |  |  | import { OsmConnection } from "../../Logic/Osm/OsmConnection" | 
					
						
							|  |  |  | import FullWelcomePaneWithTabs from "./FullWelcomePaneWithTabs" | 
					
						
							| 
									
										
										
										
											2023-01-03 02:24:03 +01:00
										 |  |  | import LoggedInUserIndicator from "../LoggedInUserIndicator" | 
					
						
							| 
									
										
										
										
											2023-01-06 03:46:10 +01:00
										 |  |  | import { ActionButtons } from "./ActionButtons" | 
					
						
							|  |  |  | import { BBox } from "../../Logic/BBox" | 
					
						
							|  |  |  | import Loc from "../../Models/Loc" | 
					
						
							| 
									
										
										
										
											2020-07-31 01:45:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-28 18:00:44 +02:00
										 |  |  | export default class ThemeIntroductionPanel extends Combine { | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |     constructor( | 
					
						
							|  |  |  |         isShown: UIEventSource<boolean>, | 
					
						
							|  |  |  |         currentTab: UIEventSource<number>, | 
					
						
							|  |  |  |         state: { | 
					
						
							|  |  |  |             featureSwitchMoreQuests: UIEventSource<boolean> | 
					
						
							|  |  |  |             featureSwitchAddNew: UIEventSource<boolean> | 
					
						
							|  |  |  |             featureSwitchUserbadge: UIEventSource<boolean> | 
					
						
							|  |  |  |             layoutToUse: LayoutConfig | 
					
						
							|  |  |  |             osmConnection: OsmConnection | 
					
						
							| 
									
										
										
										
											2023-01-06 03:46:10 +01:00
										 |  |  |             currentBounds: Store<BBox> | 
					
						
							|  |  |  |             locationControl: UIEventSource<Loc> | 
					
						
							|  |  |  |             isTranslator: Store<boolean> | 
					
						
							| 
									
										
										
										
											2023-01-03 02:24:03 +01:00
										 |  |  |         }, | 
					
						
							|  |  |  |         guistate?: { userInfoIsOpened: UIEventSource<boolean> } | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |     ) { | 
					
						
							| 
									
										
										
										
											2022-01-12 02:31:51 +01:00
										 |  |  |         const t = Translations.t.general | 
					
						
							| 
									
										
										
										
											2022-06-22 18:52:50 +02:00
										 |  |  |         const layout = state.layoutToUse | 
					
						
							| 
									
										
										
										
											2021-06-12 02:58:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-03 00:30:11 +02:00
										 |  |  |         const languagePicker = new LanguagePicker(layout.language, t.pickLanguage.Clone()) | 
					
						
							| 
									
										
										
										
											2021-09-09 00:05:51 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-16 21:23:03 +02:00
										 |  |  |         const toTheMap = new SubtleButton( | 
					
						
							| 
									
										
										
										
											2021-06-18 01:25:13 +02:00
										 |  |  |             undefined, | 
					
						
							| 
									
										
										
										
											2022-01-12 02:31:51 +01:00
										 |  |  |             t.openTheMap.Clone().SetClass("text-xl font-bold w-full text-center") | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |         ) | 
					
						
							|  |  |  |             .onClick(() => { | 
					
						
							|  |  |  |                 isShown.setData(false) | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  |             .SetClass("only-on-mobile") | 
					
						
							| 
									
										
										
										
											2021-06-12 02:58:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-03 02:24:03 +01:00
										 |  |  |         const loggedInUserInfo = new LoggedInUserIndicator(state.osmConnection, { | 
					
						
							|  |  |  |             firstLine: Translations.t.general.welcomeBack.Clone(), | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |         if (guistate?.userInfoIsOpened) { | 
					
						
							|  |  |  |             loggedInUserInfo.onClick(() => { | 
					
						
							|  |  |  |                 guistate.userInfoIsOpened.setData(true) | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |         const loginStatus = new Toggle( | 
					
						
							|  |  |  |             new LoginToggle( | 
					
						
							| 
									
										
										
										
											2023-01-03 02:24:03 +01:00
										 |  |  |                 loggedInUserInfo, | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |                 new Combine([ | 
					
						
							|  |  |  |                     Translations.t.general.loginWithOpenStreetMap.SetClass("text-xl font-bold"), | 
					
						
							|  |  |  |                     Translations.t.general.loginOnlyNeededToEdit.Clone().SetClass("font-bold"), | 
					
						
							|  |  |  |                 ]).SetClass("flex flex-col"), | 
					
						
							|  |  |  |                 state | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             undefined, | 
					
						
							|  |  |  |             state.featureSwitchUserbadge | 
					
						
							|  |  |  |         ) | 
					
						
							| 
									
										
										
										
											2020-08-27 18:44:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |         const hasPresets = layout.layers.some((l) => l.presets?.length > 0) | 
					
						
							| 
									
										
										
										
											2021-09-28 18:00:44 +02:00
										 |  |  |         super([ | 
					
						
							| 
									
										
										
										
											2021-10-11 21:23:14 +02:00
										 |  |  |             layout.description.Clone().SetClass("blcok mb-4"), | 
					
						
							| 
									
										
										
										
											2022-06-22 18:52:50 +02:00
										 |  |  |             new Combine([ | 
					
						
							|  |  |  |                 t.welcomeExplanation.general, | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |                 hasPresets | 
					
						
							|  |  |  |                     ? Toggle.If(state.featureSwitchAddNew, () => t.welcomeExplanation.addNew) | 
					
						
							|  |  |  |                     : undefined, | 
					
						
							| 
									
										
										
										
											2022-06-22 18:52:50 +02:00
										 |  |  |             ]).SetClass("flex flex-col mt-2"), | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-16 21:23:03 +02:00
										 |  |  |             toTheMap, | 
					
						
							| 
									
										
										
										
											2023-01-03 02:24:03 +01:00
										 |  |  |             loginStatus.SetClass("block mt-6 pt-2 md:border-t-2 border-dotted border-gray-400"), | 
					
						
							| 
									
										
										
										
											2021-10-11 21:23:14 +02:00
										 |  |  |             layout.descriptionTail?.Clone().SetClass("block mt-4"), | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-06 03:46:10 +01:00
										 |  |  |             languagePicker?.SetClass("block mt-4 pb-8 border-b-2 border-dotted border-gray-400"), | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |             Toggle.If(state.featureSwitchMoreQuests, () => | 
					
						
							|  |  |  |                 new Combine([ | 
					
						
							| 
									
										
										
										
											2022-06-22 18:52:50 +02:00
										 |  |  |                     t.welcomeExplanation.browseOtherThemesIntro, | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |                     new SubtleButton( | 
					
						
							|  |  |  |                         Svg.add_ui().SetClass("h-6"), | 
					
						
							|  |  |  |                         t.welcomeExplanation.browseMoreMaps | 
					
						
							|  |  |  |                     ) | 
					
						
							|  |  |  |                         .onClick(() => | 
					
						
							|  |  |  |                             currentTab.setData(FullWelcomePaneWithTabs.MoreThemesTabIndex) | 
					
						
							|  |  |  |                         ) | 
					
						
							|  |  |  |                         .SetClass("h-12"), | 
					
						
							|  |  |  |                 ]).SetClass("flex flex-col mt-6") | 
					
						
							|  |  |  |             ), | 
					
						
							| 
									
										
										
										
											2023-01-06 03:46:10 +01:00
										 |  |  |             new ActionButtons(state), | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |             ...layout.CustomCodeSnippets(), | 
					
						
							| 
									
										
										
										
											2021-09-28 18:00:44 +02:00
										 |  |  |         ]) | 
					
						
							| 
									
										
										
										
											2020-07-31 01:45:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-12 02:58:32 +02:00
										 |  |  |         this.SetClass("link-underline") | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-11-24 14:36:43 +01:00
										 |  |  | } |