| 
									
										
										
										
											2020-07-29 15:48:21 +02:00
										 |  |  | import {UIElement} from "./UIElement"; | 
					
						
							|  |  |  | import {VerticalCombine} from "./Base/VerticalCombine"; | 
					
						
							|  |  |  | import Translations from "./i18n/Translations"; | 
					
						
							|  |  |  | import {AllKnownLayouts} from "../Customizations/AllKnownLayouts"; | 
					
						
							|  |  |  | import {FixedUiElement} from "./Base/FixedUiElement"; | 
					
						
							|  |  |  | import {Utils} from "../Utils"; | 
					
						
							|  |  |  | import {link} from "fs"; | 
					
						
							|  |  |  | import {UIEventSource} from "./UIEventSource"; | 
					
						
							|  |  |  | import {VariableUiElement} from "./Base/VariableUIElement"; | 
					
						
							| 
									
										
										
										
											2020-07-29 16:46:45 +02:00
										 |  |  | import Combine from "./Base/Combine"; | 
					
						
							|  |  |  | import {SubtleButton} from "./Base/SubtleButton"; | 
					
						
							| 
									
										
										
										
											2020-07-31 01:45:54 +02:00
										 |  |  | import {State} from "../State"; | 
					
						
							| 
									
										
										
										
											2020-07-31 16:17:16 +02:00
										 |  |  | import {CustomLayout} from "../Logic/CustomLayers"; | 
					
						
							| 
									
										
										
										
											2020-07-29 15:48:21 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class MoreScreen extends UIElement { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-31 01:45:54 +02:00
										 |  |  |     constructor() { | 
					
						
							|  |  |  |         super(State.state.locationControl); | 
					
						
							| 
									
										
										
										
											2020-07-31 16:17:16 +02:00
										 |  |  |         this.ListenTo(State.state.osmConnection.userDetails); | 
					
						
							| 
									
										
										
										
											2020-07-29 15:48:21 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     InnerRender(): string { | 
					
						
							|  |  |  |         const tr = Translations.t.general.morescreen; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const els: UIElement[] = [] | 
					
						
							|  |  |  |         for (const k in AllKnownLayouts.allSets) { | 
					
						
							|  |  |  |             const layout = AllKnownLayouts.allSets[k] | 
					
						
							| 
									
										
										
										
											2020-07-31 16:17:16 +02:00
										 |  |  |             if (layout.hideFromOverview && State.state.osmConnection.userDetails.data.name !== "Pieter Vander Vennet") { | 
					
						
							| 
									
										
										
										
											2020-07-29 16:46:45 +02:00
										 |  |  |                 continue | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2020-07-31 01:45:54 +02:00
										 |  |  |             if (layout.name === State.state.layoutToUse.data.name) { | 
					
						
							| 
									
										
										
										
											2020-07-29 20:09:25 +02:00
										 |  |  |                 continue; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2020-07-31 16:17:16 +02:00
										 |  |  |             if (layout.name === CustomLayout.NAME) { | 
					
						
							|  |  |  |                 if (!State.state.osmConnection.userDetails.data.loggedIn) { | 
					
						
							|  |  |  |                     continue; | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2020-08-07 16:58:00 +02:00
										 |  |  |                 if (State.state.osmConnection.userDetails.data.csCount < 50) { | 
					
						
							| 
									
										
										
										
											2020-07-31 16:17:16 +02:00
										 |  |  |                     continue; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2020-07-29 15:48:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-31 01:45:54 +02:00
										 |  |  |             const currentLocation = State.state.locationControl.data; | 
					
						
							| 
									
										
										
										
											2020-07-29 15:48:21 +02:00
										 |  |  |             const linkText = | 
					
						
							| 
									
										
										
										
											2020-07-31 01:45:54 +02:00
										 |  |  |                 `https://pietervdvn.github.io/MapComplete/${layout.name}.html?z=${currentLocation.zoom}&lat=${currentLocation.lat}&lon=${currentLocation.lon}` | 
					
						
							| 
									
										
										
										
											2020-07-29 16:46:45 +02:00
										 |  |  |             const link = | 
					
						
							|  |  |  |                 new SubtleButton(layout.icon, | 
					
						
							|  |  |  |                     new Combine([ | 
					
						
							|  |  |  |                         "<b>", | 
					
						
							|  |  |  |                         Translations.W(layout.title), | 
					
						
							|  |  |  |                         "</b>", | 
					
						
							|  |  |  |                         "<br/>", | 
					
						
							|  |  |  |                         Translations.W(layout.description), | 
					
						
							| 
									
										
										
										
											2020-07-29 21:32:51 +02:00
										 |  |  |                     ]), {url: linkText, newTab: false}); | 
					
						
							| 
									
										
										
										
											2020-07-29 15:48:21 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |             els.push(link) | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return new VerticalCombine([ | 
					
						
							|  |  |  |             tr.intro, | 
					
						
							| 
									
										
										
										
											2020-07-30 16:34:06 +02:00
										 |  |  |             tr.requestATheme, | 
					
						
							| 
									
										
										
										
											2020-07-29 15:48:21 +02:00
										 |  |  |             new VerticalCombine(els), | 
					
						
							| 
									
										
										
										
											2020-08-06 23:49:35 +02:00
										 |  |  |             tr.streetcomplete, | 
					
						
							|  |  |  |             new FixedUiElement(State.vNumber) | 
					
						
							| 
									
										
										
										
											2020-07-29 15:48:21 +02:00
										 |  |  |         ]).Render(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |