| 
									
										
										
										
											2022-09-08 21:40:48 +02: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" | 
					
						
							|  |  |  | import { FlowPanelFactory } from "./FlowStep" | 
					
						
							|  |  |  | import { RequestFile } from "./RequestFile" | 
					
						
							|  |  |  | import { PreviewAttributesPanel } from "./PreviewPanel" | 
					
						
							|  |  |  | import ConflationChecker from "./ConflationChecker" | 
					
						
							|  |  |  | import { AskMetadata } from "./AskMetadata" | 
					
						
							|  |  |  | import { ConfirmProcess } from "./ConfirmProcess" | 
					
						
							|  |  |  | import { CreateNotes } from "./CreateNotes" | 
					
						
							|  |  |  | import { VariableUiElement } from "../Base/VariableUIElement" | 
					
						
							|  |  |  | import List from "../Base/List" | 
					
						
							|  |  |  | import { CompareToAlreadyExistingNotes } from "./CompareToAlreadyExistingNotes" | 
					
						
							|  |  |  | import Introdution from "./Introdution" | 
					
						
							|  |  |  | import LoginToImport from "./LoginToImport" | 
					
						
							|  |  |  | import { MapPreview } from "./MapPreview" | 
					
						
							|  |  |  | import LeftIndex from "../Base/LeftIndex" | 
					
						
							|  |  |  | import { SubtleButton } from "../Base/SubtleButton" | 
					
						
							|  |  |  | 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-09-08 21:40:48 +02:00
										 |  |  |         const t = Translations.t.importHelper | 
					
						
							|  |  |  |         const { flow, furthestStep, titles } = FlowPanelFactory.start( | 
					
						
							|  |  |  |             t.introduction, | 
					
						
							|  |  |  |             new Introdution() | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |             .then(t.login, (_) => new LoginToImport(state)) | 
					
						
							|  |  |  |             .then(t.selectFile, (_) => new RequestFile()) | 
					
						
							|  |  |  |             .then(t.previewAttributes, (geojson) => new PreviewAttributesPanel(state, geojson)) | 
					
						
							|  |  |  |             .then(t.mapPreview, (geojson) => new MapPreview(state, geojson)) | 
					
						
							|  |  |  |             .then(t.selectTheme, (v) => new SelectTheme(v)) | 
					
						
							|  |  |  |             .then( | 
					
						
							|  |  |  |                 t.compareToAlreadyExistingNotes, | 
					
						
							|  |  |  |                 (v) => new CompareToAlreadyExistingNotes(state, v) | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  |             .then(t.conflationChecker, (v) => new ConflationChecker(state, v)) | 
					
						
							|  |  |  |             .then(t.confirmProcess, (v) => new ConfirmProcess(v)) | 
					
						
							|  |  |  |             .then(t.askMetadata, (v) => new AskMetadata(v)) | 
					
						
							|  |  |  |             .finish(t.createNotes.title, (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( | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |             titles.map( | 
					
						
							|  |  |  |                 (title, i) => | 
					
						
							|  |  |  |                     new VariableUiElement( | 
					
						
							|  |  |  |                         furthestStep.map((currentStep) => { | 
					
						
							|  |  |  |                             if (i > currentStep) { | 
					
						
							|  |  |  |                                 return new Combine([title]).SetClass("subtle") | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                             if (i == currentStep) { | 
					
						
							|  |  |  |                                 return new Combine([title]).SetClass("font-bold") | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                             if (i < currentStep) { | 
					
						
							|  |  |  |                                 return title | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                         }) | 
					
						
							|  |  |  |                     ) | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             true | 
					
						
							|  |  |  |         ) | 
					
						
							| 
									
										
										
										
											2022-01-26 21:40:38 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  |         const leftContents: BaseUIElement[] = [ | 
					
						
							| 
									
										
										
										
											2022-04-14 03:01:54 +02:00
										 |  |  |             new SubtleButton(undefined, t.gotoImportViewer, { | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |                 url: "import_viewer.html", | 
					
						
							| 
									
										
										
										
											2022-01-24 03:09:21 +01:00
										 |  |  |             }), | 
					
						
							| 
									
										
										
										
											2022-01-21 01:57:16 +01:00
										 |  |  |             toc, | 
					
						
							| 
									
										
										
										
											2022-04-14 03:01:54 +02:00
										 |  |  |             new Toggle(t.testMode.SetClass("block alert"), undefined, state.featureSwitchIsTesting), | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |             new LanguagePicker( | 
					
						
							|  |  |  |                 Translations.t.importHelper.title.SupportedLanguages(), | 
					
						
							|  |  |  |                 "" | 
					
						
							|  |  |  |             )?.SetClass("mt-4 self-end flex-col"), | 
					
						
							|  |  |  |         ].map((el) => el?.SetClass("pl-4")) | 
					
						
							| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |         super(leftContents, flow) | 
					
						
							| 
									
										
										
										
											2022-01-19 20:34:04 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MinimapImplementation.initialize() | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | new ImportHelperGui().AttachTo("main") |