| 
									
										
										
										
											2022-12-16 13:45:07 +01:00
										 |  |  | import Translations from "../i18n/Translations" | 
					
						
							|  |  |  | import { OsmConnection } from "../../Logic/Osm/OsmConnection" | 
					
						
							|  |  |  | import Combine from "../Base/Combine" | 
					
						
							|  |  |  | import { SubtleButton } from "../Base/SubtleButton" | 
					
						
							|  |  |  | import Svg from "../../Svg" | 
					
						
							|  |  |  | import { VariableUiElement } from "../Base/VariableUIElement" | 
					
						
							|  |  |  | import Img from "../Base/Img" | 
					
						
							|  |  |  | import { FixedUiElement } from "../Base/FixedUiElement" | 
					
						
							|  |  |  | import Link from "../Base/Link" | 
					
						
							| 
									
										
										
										
											2023-04-07 02:13:57 +02:00
										 |  |  | import { UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							| 
									
										
										
										
											2022-12-16 13:45:07 +01:00
										 |  |  | import Loc from "../../Models/Loc" | 
					
						
							|  |  |  | import BaseUIElement from "../BaseUIElement" | 
					
						
							| 
									
										
										
										
											2022-12-13 03:46:53 +01:00
										 |  |  | import Showdown from "showdown" | 
					
						
							| 
									
										
										
										
											2022-12-16 13:45:07 +01:00
										 |  |  | import LanguagePicker from "../LanguagePicker" | 
					
						
							|  |  |  | import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig" | 
					
						
							|  |  |  | import Constants from "../../Models/Constants" | 
					
						
							| 
									
										
										
										
											2023-01-14 04:19:10 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-16 01:08:07 +01:00
										 |  |  | export class ImportViewerLinks extends VariableUiElement { | 
					
						
							|  |  |  |     constructor(osmConnection: OsmConnection) { | 
					
						
							|  |  |  |         super( | 
					
						
							|  |  |  |             osmConnection.userDetails.map((ud) => { | 
					
						
							|  |  |  |                 if (ud.csCount < Constants.userJourney.importHelperUnlock) { | 
					
						
							|  |  |  |                     return undefined | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 return new Combine([ | 
					
						
							|  |  |  |                     new SubtleButton(undefined, Translations.t.importHelper.title, { | 
					
						
							|  |  |  |                         url: "import_helper.html", | 
					
						
							|  |  |  |                     }), | 
					
						
							|  |  |  |                     new SubtleButton(Svg.note_svg(), Translations.t.importInspector.title, { | 
					
						
							|  |  |  |                         url: "import_viewer.html", | 
					
						
							|  |  |  |                     }), | 
					
						
							|  |  |  |                 ]) | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-12-13 03:46:53 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-11 03:53:58 +01:00
										 |  |  | class UserInformationMainPanel extends VariableUiElement { | 
					
						
							| 
									
										
										
										
											2023-01-13 14:31:28 +01:00
										 |  |  |     private readonly settings: UIEventSource<Record<string, BaseUIElement>> | 
					
						
							|  |  |  |     private readonly userInfoFocusedQuestion?: UIEventSource<string> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-16 13:45:07 +01:00
										 |  |  |     constructor( | 
					
						
							|  |  |  |         osmConnection: OsmConnection, | 
					
						
							|  |  |  |         locationControl: UIEventSource<Loc>, | 
					
						
							| 
									
										
										
										
											2022-12-21 01:39:16 +01:00
										 |  |  |         layout: LayoutConfig, | 
					
						
							| 
									
										
										
										
											2023-01-13 02:48:48 +01:00
										 |  |  |         isOpened: UIEventSource<boolean>, | 
					
						
							|  |  |  |         userInfoFocusedQuestion?: UIEventSource<string> | 
					
						
							| 
									
										
										
										
											2022-12-16 13:45:07 +01:00
										 |  |  |     ) { | 
					
						
							| 
									
										
										
										
											2023-01-13 14:31:28 +01:00
										 |  |  |         const settings = new UIEventSource<Record<string, BaseUIElement>>({}) | 
					
						
							| 
									
										
										
										
											2023-01-13 02:48:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-07 02:13:57 +02:00
										 |  |  |         super() | 
					
						
							| 
									
										
										
										
											2023-01-13 14:31:28 +01:00
										 |  |  |         this.settings = settings | 
					
						
							|  |  |  |         this.userInfoFocusedQuestion = userInfoFocusedQuestion | 
					
						
							|  |  |  |         const self = this | 
					
						
							|  |  |  |         userInfoFocusedQuestion.addCallbackD((_) => { | 
					
						
							|  |  |  |             self.focusOnSelectedQuestion() | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public focusOnSelectedQuestion() { | 
					
						
							|  |  |  |         const focusedId = this.userInfoFocusedQuestion.data | 
					
						
							|  |  |  |         console.log("Focusing on", focusedId, this.settings.data[focusedId]) | 
					
						
							|  |  |  |         if (focusedId === undefined) { | 
					
						
							|  |  |  |             return | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         this.settings.data[focusedId]?.ScrollIntoView() | 
					
						
							| 
									
										
										
										
											2022-12-13 03:46:53 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } |