| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-12-01 15:23:28 +01:00
										 |  |  |   import Translations from "../i18n/Translations" | 
					
						
							|  |  |  |   import Tr from "../Base/Tr.svelte" | 
					
						
							|  |  |  |   import NextButton from "../Base/NextButton.svelte" | 
					
						
							|  |  |  |   import Geosearch from "./Geosearch.svelte" | 
					
						
							|  |  |  |   import ThemeViewState from "../../Models/ThemeViewState" | 
					
						
							| 
									
										
										
										
											2023-12-13 02:16:53 +01:00
										 |  |  |   import { Store, UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							| 
									
										
										
										
											2023-12-01 15:23:28 +01:00
										 |  |  |   import { SearchIcon } from "@rgossiaux/svelte-heroicons/solid" | 
					
						
							|  |  |  |   import { twJoin } from "tailwind-merge" | 
					
						
							|  |  |  |   import { Utils } from "../../Utils" | 
					
						
							|  |  |  |   import type { GeolocationPermissionState } from "../../Logic/State/GeoLocationState" | 
					
						
							|  |  |  |   import { GeoLocationState } from "../../Logic/State/GeoLocationState" | 
					
						
							|  |  |  |   import If from "../Base/If.svelte" | 
					
						
							|  |  |  |   import { ExclamationTriangleIcon } from "@babeard/svelte-heroicons/mini" | 
					
						
							|  |  |  |   import Location_refused from "../../assets/svg/Location_refused.svelte" | 
					
						
							| 
									
										
										
										
											2023-12-18 00:34:39 +01:00
										 |  |  |   import Location from "../../assets/svg/Location.svelte" | 
					
						
							| 
									
										
										
										
											2024-08-10 12:09:55 +02:00
										 |  |  |   import ChevronDoubleLeft from "@babeard/svelte-heroicons/solid/ChevronDoubleLeft" | 
					
						
							|  |  |  |   import GeolocationIndicator from "./GeolocationIndicator.svelte" | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-30 13:44:27 +01:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * The theme introduction panel | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   export let state: ThemeViewState | 
					
						
							|  |  |  |   let layout = state.layout | 
					
						
							|  |  |  |   let selectedElement = state.selectedElement | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-30 13:44:27 +01:00
										 |  |  |   let triggerSearch: UIEventSource<any> = new UIEventSource<any>(undefined) | 
					
						
							|  |  |  |   let searchEnabled = false | 
					
						
							| 
									
										
										
										
											2023-09-24 22:12:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-10 12:09:55 +02:00
										 |  |  |   let geolocation = state.geolocation.geolocationState | 
					
						
							|  |  |  |   let geopermission: Store<GeolocationPermissionState> = geolocation.permission | 
					
						
							|  |  |  |   let currentGPSLocation = geolocation.currentGPSLocation | 
					
						
							|  |  |  |   let gpsExplanation = geolocation.gpsStateExplanation | 
					
						
							|  |  |  |   let gpsAvailable = geolocation.gpsAvailable | 
					
						
							| 
									
										
										
										
											2023-09-24 22:12:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-30 13:44:27 +01: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-10-30 13:44:27 +01:00
										 |  |  |     if (glstate.permission.data !== "granted") { | 
					
						
							|  |  |  |       glstate.requestPermission() | 
					
						
							|  |  |  |       return | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-15 16:12:46 +02:00
										 |  |  | <div class="flex h-full flex-col justify-between"> | 
					
						
							|  |  |  |   <div> | 
					
						
							|  |  |  |     <!-- Intro, description, ... --> | 
					
						
							| 
									
										
										
										
											2024-05-08 21:46:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-15 16:12:46 +02:00
										 |  |  |     <Tr t={layout.description} /> | 
					
						
							| 
									
										
										
										
											2024-06-27 03:39:04 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     <If condition={state.featureSwitches.featureSwitchEnableLogin}> | 
					
						
							|  |  |  |       <Tr t={Translations.t.general.welcomeExplanation.general} /> | 
					
						
							|  |  |  |       {#if layout.layers.some((l) => l.presets?.length > 0)} | 
					
						
							|  |  |  |         <Tr t={Translations.t.general.welcomeExplanation.addNew} /> | 
					
						
							|  |  |  |       {/if} | 
					
						
							|  |  |  |     </If> | 
					
						
							| 
									
										
										
										
											2023-06-15 16:11:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-18 00:34:39 +01:00
										 |  |  |     <Tr t={layout.descriptionTail} /> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-15 16:12:46 +02:00
										 |  |  |     <!-- Buttons: open map, go to location, search --> | 
					
						
							|  |  |  |     <NextButton clss="primary w-full" on:click={() => state.guistate.themeIsOpened.setData(false)}> | 
					
						
							| 
									
										
										
										
											2024-07-09 13:42:08 +02:00
										 |  |  |       <div class="flex w-full flex-col items-center"> | 
					
						
							| 
									
										
										
										
											2024-06-27 17:37:34 +02:00
										 |  |  |         <div class="flex w-full justify-center text-2xl"> | 
					
						
							|  |  |  |           <Tr t={Translations.t.general.openTheMap} /> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |         <If condition={state.featureSwitches.featureSwitchEnableLogin}> | 
					
						
							|  |  |  |           <Tr t={Translations.t.general.openTheMapReason} /> | 
					
						
							|  |  |  |         </If> | 
					
						
							| 
									
										
										
										
											2023-06-15 16:12:46 +02:00
										 |  |  |       </div> | 
					
						
							|  |  |  |     </NextButton> | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-15 16:12:46 +02:00
										 |  |  |     <div class="flex w-full flex-wrap sm:flex-nowrap"> | 
					
						
							| 
									
										
										
										
											2023-10-11 01:41:42 +02:00
										 |  |  |       <If condition={state.featureSwitches.featureSwitchGeolocation}> | 
					
						
							| 
									
										
										
										
											2024-08-10 12:09:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         <button disabled={!$gpsAvailable} class:disabled={!$gpsAvailable} class="flex w-full items-center gap-x-2" on:click={jumpToCurrentLocation}> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           <GeolocationIndicator {state} /> | 
					
						
							|  |  |  |           <Tr t={$gpsExplanation} /> | 
					
						
							|  |  |  |         </button> | 
					
						
							| 
									
										
										
										
											2023-10-11 01:41:42 +02:00
										 |  |  |       </If> | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-11 01:41:42 +02:00
										 |  |  |       <If condition={state.featureSwitches.featureSwitchSearch}> | 
					
						
							| 
									
										
										
										
											2023-10-16 14:27:05 +02:00
										 |  |  |         <div | 
					
						
							| 
									
										
										
										
											2023-12-21 01:46:18 +01:00
										 |  |  |           class=".button low-interaction m-1 flex h-fit w-full flex-wrap items-center justify-end gap-x-2 gap-y-2 rounded border p-1" | 
					
						
							| 
									
										
										
										
											2023-10-16 14:27:05 +02:00
										 |  |  |         > | 
					
						
							| 
									
										
										
										
											2023-12-18 00:34:39 +01:00
										 |  |  |           <div style="min-width: 16rem; " class="grow"> | 
					
						
							| 
									
										
										
										
											2023-10-11 01:41:42 +02:00
										 |  |  |             <Geosearch | 
					
						
							|  |  |  |               bounds={state.mapProperties.bounds} | 
					
						
							|  |  |  |               on:searchCompleted={() => state.guistate.themeIsOpened.setData(false)} | 
					
						
							| 
									
										
										
										
											2023-12-13 02:16:53 +01:00
										 |  |  |               on:searchIsValid={(event) => { | 
					
						
							|  |  |  |                 searchEnabled = event.detail | 
					
						
							| 
									
										
										
										
											2023-10-16 14:27:05 +02:00
										 |  |  |               }} | 
					
						
							| 
									
										
										
										
											2023-10-11 01:41:42 +02:00
										 |  |  |               perLayer={state.perLayer} | 
					
						
							|  |  |  |               {selectedElement} | 
					
						
							|  |  |  |               {triggerSearch} | 
					
						
							| 
									
										
										
										
											2024-02-03 14:48:32 +01:00
										 |  |  |               geolocationState={state.geolocation.geolocationState} | 
					
						
							| 
									
										
										
										
											2023-10-11 01:41:42 +02:00
										 |  |  |             /> | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |           <button | 
					
						
							| 
									
										
										
										
											2023-10-16 14:27:05 +02:00
										 |  |  |             class={twJoin( | 
					
						
							| 
									
										
										
										
											2023-12-21 01:46:18 +01:00
										 |  |  |               "small flex w-fit shrink-0 items-center justify-between gap-x-2", | 
					
						
							| 
									
										
										
										
											2023-10-16 14:27:05 +02:00
										 |  |  |               !searchEnabled && "disabled" | 
					
						
							|  |  |  |             )} | 
					
						
							| 
									
										
										
										
											2023-10-11 01:41:42 +02:00
										 |  |  |             on:click={() => triggerSearch.ping()} | 
					
						
							|  |  |  |           > | 
					
						
							|  |  |  |             <Tr t={Translations.t.general.search.searchShort} /> | 
					
						
							|  |  |  |             <SearchIcon class="h-6 w-6" /> | 
					
						
							|  |  |  |           </button> | 
					
						
							| 
									
										
										
										
											2023-06-15 16:11:36 +02:00
										 |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2023-10-11 01:41:42 +02:00
										 |  |  |       </If> | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2023-10-20 22:21:36 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     {#if $currentGPSLocation === undefined && $geopermission === "requested" && GeoLocationState.isSafari()} | 
					
						
							| 
									
										
										
										
											2023-10-30 13:44:27 +01:00
										 |  |  |       <a | 
					
						
							|  |  |  |         href="https://support.apple.com/en-us/HT207092" | 
					
						
							|  |  |  |         class="button w-full" | 
					
						
							|  |  |  |         target="_blank" | 
					
						
							|  |  |  |         rel="noopener" | 
					
						
							|  |  |  |       > | 
					
						
							|  |  |  |         <div class="link-underline m-1 flex w-full"> | 
					
						
							| 
									
										
										
										
											2023-10-20 22:21:36 +02:00
										 |  |  |           <ExclamationTriangleIcon class="w-12 pr-2" /> | 
					
						
							|  |  |  |           <div class="flex w-full flex-col"> | 
					
						
							|  |  |  |             <Tr cls="font-normal" t={Translations.t.general.enableGeolocationForSafari} /> | 
					
						
							|  |  |  |             <Tr t={Translations.t.general.enableGeolocationForSafariLink} /> | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |       </a> | 
					
						
							|  |  |  |     {/if} | 
					
						
							| 
									
										
										
										
											2023-06-15 16:12:46 +02:00
										 |  |  |   </div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-23 02:54:53 +02:00
										 |  |  |   {#if Utils.isIframe} | 
					
						
							| 
									
										
										
										
											2024-06-24 13:11:35 +02:00
										 |  |  |     <div class="link-underline flex justify-end"> | 
					
						
							|  |  |  |       <a href="https://mapcomplete.org" target="_blank"> | 
					
						
							|  |  |  |         <Tr t={Translations.t.general.poweredByMapComplete} /> | 
					
						
							|  |  |  |       </a> | 
					
						
							| 
									
										
										
										
											2024-06-20 04:21:29 +02:00
										 |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2024-06-23 02:54:53 +02:00
										 |  |  |   {:else} | 
					
						
							|  |  |  |     <If condition={state.featureSwitches.featureSwitchBackToThemeOverview}> | 
					
						
							|  |  |  |       <div class="link-underline m-2 mx-4 flex w-full"> | 
					
						
							|  |  |  |         <a class="flex w-fit items-center justify-end" href={Utils.HomepageLink()}> | 
					
						
							|  |  |  |           <ChevronDoubleLeft class="h-4 w-4" /> | 
					
						
							|  |  |  |           <Tr t={Translations.t.general.backToIndex} /> | 
					
						
							|  |  |  |         </a> | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |     </If> | 
					
						
							|  |  |  |   {/if} | 
					
						
							| 
									
										
										
										
											2023-05-18 15:44:54 +02:00
										 |  |  | </div> |