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 ThemeViewState from "../../Models/ThemeViewState"
|
2024-08-30 02:18:29 +02:00
|
|
|
import { Store } from "../../Logic/UIEventSource"
|
2023-12-01 15:23:28 +01:00
|
|
|
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"
|
2024-08-10 12:09:55 +02:00
|
|
|
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
|
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() {
|
2024-08-12 10:08:23 +02:00
|
|
|
state.geolocationControl.handleClick()
|
2023-10-30 13:44:27 +01:00
|
|
|
const glstate = state.geolocation.geolocationState
|
|
|
|
if (glstate.currentGPSLocation.data !== undefined) {
|
2024-08-30 02:18:29 +02:00
|
|
|
const c = glstate.currentGPSLocation.data
|
2024-08-29 02:46:51 +02:00
|
|
|
state.guistate.pageStates.about_theme.setData(false)
|
2023-10-30 13:44:27 +01:00
|
|
|
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 -->
|
2024-08-29 02:46:51 +02:00
|
|
|
<NextButton clss="primary w-full" on:click={() => state.guistate.pageStates.about_theme.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-14 13:53:56 +02:00
|
|
|
<button
|
|
|
|
disabled={!$gpsAvailable}
|
|
|
|
class:disabled={!$gpsAvailable}
|
|
|
|
class="flex w-full items-center gap-x-2"
|
|
|
|
on:click={jumpToCurrentLocation}
|
|
|
|
>
|
2024-08-10 12:09:55 +02:00
|
|
|
<GeolocationIndicator {state} />
|
|
|
|
<Tr t={$gpsExplanation} />
|
|
|
|
</button>
|
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-08-29 02:46:51 +02:00
|
|
|
<div class="link-underline flex justify-end text-sm mt-8">
|
|
|
|
<a href="https://mapcomplete.org" target="_blank">
|
|
|
|
<Tr t={Translations.t.general.poweredByMapComplete} />
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
|
2023-05-18 15:44:54 +02:00
|
|
|
</div>
|