| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  | import Combine from "../Base/Combine"; | 
					
						
							|  |  |  | import Toggle from "../Input/Toggle"; | 
					
						
							|  |  |  | import LanguagePicker from "../LanguagePicker"; | 
					
						
							|  |  |  | import UserRelatedState from "../../Logic/State/UserRelatedState"; | 
					
						
							|  |  |  | import BaseUIElement from "../BaseUIElement"; | 
					
						
							|  |  |  | import MinimapImplementation from "../Base/MinimapImplementation"; | 
					
						
							|  |  |  | import Translations from "../i18n/Translations"; | 
					
						
							| 
									
										
										
										
											2022-01-21 01:57:16 +01:00
										 |  |  | import {FlowPanelFactory} from "./FlowStep"; | 
					
						
							| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  | import {RequestFile} from "./RequestFile"; | 
					
						
							| 
									
										
										
										
											2022-01-22 02:56:35 +01:00
										 |  |  | import {PreviewPanel} from "./PreviewPanel"; | 
					
						
							| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  | import ConflationChecker from "./ConflationChecker"; | 
					
						
							| 
									
										
										
										
											2022-01-21 01:57:16 +01:00
										 |  |  | import {AskMetadata} from "./AskMetadata"; | 
					
						
							|  |  |  | import {ConfirmProcess} from "./ConfirmProcess"; | 
					
						
							|  |  |  | import {CreateNotes} from "./CreateNotes"; | 
					
						
							|  |  |  | import {FixedUiElement} from "../Base/FixedUiElement"; | 
					
						
							|  |  |  | import {VariableUiElement} from "../Base/VariableUIElement"; | 
					
						
							|  |  |  | import List from "../Base/List"; | 
					
						
							|  |  |  | import {CompareToAlreadyExistingNotes} from "./CompareToAlreadyExistingNotes"; | 
					
						
							| 
									
										
										
										
											2022-01-22 02:56:35 +01:00
										 |  |  | import Introdution from "./Introdution"; | 
					
						
							|  |  |  | import LoginToImport from "./LoginToImport"; | 
					
						
							|  |  |  | import {MapPreview} from "./MapPreview"; | 
					
						
							| 
									
										
										
										
											2022-01-24 03:09:21 +01:00
										 |  |  | import LeftIndex from "../Base/LeftIndex"; | 
					
						
							|  |  |  | import {SubtleButton} from "../Base/SubtleButton"; | 
					
						
							| 
									
										
										
										
											2022-03-24 03:11:29 +01:00
										 |  |  | import SelectTheme from "./SelectTheme"; | 
					
						
							| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-24 03:09:21 +01:00
										 |  |  | export default class ImportHelperGui extends LeftIndex { | 
					
						
							| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  |     constructor() { | 
					
						
							|  |  |  |         const state = new UserRelatedState(undefined) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-26 21:40:38 +01:00
										 |  |  |         const {flow, furthestStep, titles} = | 
					
						
							| 
									
										
										
										
											2022-01-21 01:57:16 +01:00
										 |  |  |             FlowPanelFactory | 
					
						
							| 
									
										
										
										
											2022-01-22 02:56:35 +01:00
										 |  |  |                 .start("Introduction", new Introdution()) | 
					
						
							|  |  |  |                 .then("Login", _ => new LoginToImport(state)) | 
					
						
							| 
									
										
										
										
											2022-03-24 03:11:29 +01:00
										 |  |  |                .then("Select file", _ => new RequestFile()) | 
					
						
							|  |  |  |                .then("Inspect attributes", geojson => new PreviewPanel(state, geojson)) | 
					
						
							|  |  |  |                .then("Inspect data", geojson => new MapPreview(state, geojson)) | 
					
						
							|  |  |  |                .then("Select theme", v => new SelectTheme(v)) | 
					
						
							|  |  |  |                .then("Compare with open notes", v => new CompareToAlreadyExistingNotes(state, v)) | 
					
						
							|  |  |  |                .then("Compare with existing data", v => new ConflationChecker(state, v)) | 
					
						
							| 
									
										
										
										
											2022-04-06 04:21:15 +02:00
										 |  |  |                .then("License and community check", v  => new ConfirmProcess(v)) | 
					
						
							|  |  |  |                .then("Metadata", (v) => new AskMetadata(v)) | 
					
						
							| 
									
										
										
										
											2022-03-24 03:11:29 +01:00
										 |  |  |                .finish("Note creation", v => new CreateNotes(state, v)); | 
					
						
							| 
									
										
										
										
											2022-01-26 21:40:38 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-21 01:57:16 +01:00
										 |  |  |         const toc = new List( | 
					
						
							|  |  |  |             titles.map((title, i) => new VariableUiElement(furthestStep.map(currentStep => { | 
					
						
							| 
									
										
										
										
											2022-01-26 21:40:38 +01:00
										 |  |  |                 if (i > currentStep) { | 
					
						
							| 
									
										
										
										
											2022-01-21 01:57:16 +01:00
										 |  |  |                     return new Combine([title]).SetClass("subtle"); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2022-01-26 21:40:38 +01:00
										 |  |  |                 if (i == currentStep) { | 
					
						
							| 
									
										
										
										
											2022-01-21 01:57:16 +01:00
										 |  |  |                     return new Combine([title]).SetClass("font-bold"); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2022-01-26 21:40:38 +01:00
										 |  |  |                 if (i < currentStep) { | 
					
						
							| 
									
										
										
										
											2022-01-21 01:57:16 +01:00
										 |  |  |                     return title | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2022-01-26 21:40:38 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-21 01:57:16 +01:00
										 |  |  |             }))) | 
					
						
							|  |  |  |             , true) | 
					
						
							| 
									
										
										
										
											2022-01-26 21:40:38 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  |         const leftContents: BaseUIElement[] = [ | 
					
						
							| 
									
										
										
										
											2022-01-26 21:40:38 +01:00
										 |  |  |             new SubtleButton(undefined, "Inspect your preview imports", { | 
					
						
							|  |  |  |                 url: "import_viewer.html" | 
					
						
							| 
									
										
										
										
											2022-01-24 03:09:21 +01:00
										 |  |  |             }), | 
					
						
							| 
									
										
										
										
											2022-01-21 01:57:16 +01:00
										 |  |  |             toc, | 
					
						
							|  |  |  |             new Toggle(new FixedUiElement("Testmode - won't actually import notes").SetClass("alert"), undefined, state.featureSwitchIsTesting), | 
					
						
							| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  |             LanguagePicker.CreateLanguagePicker(Translations.t.importHelper.title.SupportedLanguages())?.SetClass("mt-4 self-end flex-col"), | 
					
						
							|  |  |  |         ].map(el => el?.SetClass("pl-4")) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-24 03:09:21 +01:00
										 |  |  |         super( | 
					
						
							|  |  |  |             leftContents, | 
					
						
							|  |  |  |             flow) | 
					
						
							| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MinimapImplementation.initialize() | 
					
						
							|  |  |  | new ImportHelperGui().AttachTo("main") |