| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   import Translations from "../i18n/Translations" | 
					
						
							|  |  |  |   import Svg from "../../Svg" | 
					
						
							|  |  |  |   import Tr from "../Base/Tr.svelte" | 
					
						
							|  |  |  |   import NextButton from "../Base/NextButton.svelte" | 
					
						
							|  |  |  |   import Geosearch from "./Geosearch.svelte" | 
					
						
							|  |  |  |   import IfNot from "../Base/IfNot.svelte" | 
					
						
							|  |  |  |   import ToSvelte from "../Base/ToSvelte.svelte" | 
					
						
							|  |  |  |   import ThemeViewState from "../../Models/ThemeViewState" | 
					
						
							|  |  |  |   import If from "../Base/If.svelte" | 
					
						
							|  |  |  |   import { UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							|  |  |  |   import { SearchIcon } from "@rgossiaux/svelte-heroicons/solid" | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * The theme introduction panel | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   export let state: ThemeViewState | 
					
						
							|  |  |  |   let layout = state.layout | 
					
						
							|  |  |  |   let selectedElement = state.selectedElement | 
					
						
							|  |  |  |   let selectedLayer = state.selectedLayer | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   let triggerSearch: UIEventSource<any> = new UIEventSource<any>(undefined) | 
					
						
							|  |  |  |   let searchEnabled = false | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   function jumpToCurrentLocation() { | 
					
						
							|  |  |  |     const glstate = state.geolocation.geolocationState | 
					
						
							|  |  |  |     if (glstate.currentGPSLocation.data !== undefined) { | 
					
						
							|  |  |  |       const c: GeolocationCoordinates = glstate.currentGPSLocation.data | 
					
						
							|  |  |  |       state.guistate.themeIsOpened.setData(false) | 
					
						
							|  |  |  |       const coor = { lon: c.longitude, lat: c.latitude } | 
					
						
							|  |  |  |       state.mapProperties.location.setData(coor) | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |     if (glstate.permission.data !== "granted") { | 
					
						
							|  |  |  |       glstate.requestPermission() | 
					
						
							|  |  |  |       return | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  | <Tr t={layout.description} /> | 
					
						
							|  |  |  | <Tr t={Translations.t.general.welcomeExplanation.general} /> | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | {#if layout.layers.some((l) => l.presets?.length > 0)} | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   <If condition={state.featureSwitches.featureSwitchAddNew}> | 
					
						
							|  |  |  |     <Tr t={Translations.t.general.welcomeExplanation.addNew} /> | 
					
						
							|  |  |  |   </If> | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | {/if} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!--toTheMap,
 | 
					
						
							|  |  |  | loginStatus.SetClass("block mt-6 pt-2 md:border-t-2 border-dotted border-gray-400"), | 
					
						
							|  |  |  | --> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  | <Tr t={layout.descriptionTail} /> | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | <NextButton clss="primary w-full" on:click={() => state.guistate.themeIsOpened.setData(false)}> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:44:01 +02:00
										 |  |  |   <div class="flex w-full justify-center text-2xl"> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |     <Tr t={Translations.t.general.openTheMap} /> | 
					
						
							|  |  |  |   </div> | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | </NextButton> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <div class="flex w-full flex-wrap sm:flex-nowrap"> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   <IfNot condition={state.geolocation.geolocationState.permission.map((p) => p === "denied")}> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:44:01 +02:00
										 |  |  |     <button class="flex w-full items-center gap-x-2" on:click={jumpToCurrentLocation}> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |       <ToSvelte construct={Svg.crosshair_svg().SetClass("w-8 h-8")} /> | 
					
						
							|  |  |  |       <Tr t={Translations.t.general.openTheMapAtGeolocation} /> | 
					
						
							|  |  |  |     </button> | 
					
						
							|  |  |  |   </IfNot> | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:44:01 +02:00
										 |  |  |   <div class=".button low-interaction m-1 flex w-full items-center gap-x-2 rounded border p-2"> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |     <div class="w-full"> | 
					
						
							|  |  |  |       <Geosearch | 
					
						
							|  |  |  |         bounds={state.mapProperties.bounds} | 
					
						
							|  |  |  |         on:searchCompleted={() => state.guistate.themeIsOpened.setData(false)} | 
					
						
							|  |  |  |         on:searchIsValid={(isValid) => { | 
					
						
							|  |  |  |           searchEnabled = isValid | 
					
						
							|  |  |  |         }} | 
					
						
							|  |  |  |         perLayer={state.perLayer} | 
					
						
							|  |  |  |         {selectedElement} | 
					
						
							|  |  |  |         {selectedLayer} | 
					
						
							|  |  |  |         {triggerSearch} | 
					
						
							|  |  |  |       /> | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |     <button | 
					
						
							| 
									
										
										
										
											2023-06-14 20:44:01 +02:00
										 |  |  |       class={"flex items-center justify-between gap-x-2 " + (searchEnabled ? "" : "disabled")} | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |       on:click={() => triggerSearch.ping()} | 
					
						
							|  |  |  |     > | 
					
						
							|  |  |  |       <Tr t={Translations.t.general.search.searchShort} /> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:44:01 +02:00
										 |  |  |       <SearchIcon class="h-6 w-6" /> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |     </button> | 
					
						
							|  |  |  |   </div> | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | </div> |