+ {/await}
+ {/if}
+
+
+
diff --git a/src/lib/scripts/getLocation.ts b/src/lib/scripts/getLocation.ts
index becc801..99ae984 100644
--- a/src/lib/scripts/getLocation.ts
+++ b/src/lib/scripts/getLocation.ts
@@ -1,4 +1,4 @@
-export function getCurrentLocation() {
+export function getCurrentLocation(): Promise {
return new Promise((resolve, reject) => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
@@ -17,3 +17,8 @@ export function getCurrentLocation() {
}
});
}
+
+export interface locationObj {
+ latitude: number
+ longitude: number
+}
diff --git a/src/lib/stores/location.ts b/src/lib/stores/location.ts
new file mode 100644
index 0000000..297d791
--- /dev/null
+++ b/src/lib/stores/location.ts
@@ -0,0 +1,26 @@
+// src/stores.js
+import { writable, type Writable } from 'svelte/store';
+import { browser } from '$app/environment';
+
+// Initialize the store with a boolean value from local storage
+export const location: Writable = writable(fromLocalStorage('location', false));
+toLocalStorage(location, 'location');
+
+function fromLocalStorage(storageKey: string, fallback: boolean): boolean {
+ if (browser) {
+ const storedValue = localStorage.getItem(storageKey);
+ if (storedValue !== null && storedValue !== 'undefined') {
+ return storedValue === 'true';
+ }
+ }
+ return fallback;
+}
+
+function toLocalStorage(store: Writable, storageKey: string) {
+ if (browser) {
+ store.subscribe((value: boolean) => {
+ localStorage.setItem(storageKey, String(value));
+ });
+ }
+}
+
diff --git a/src/lib/stores/version.ts b/src/lib/stores/version.ts
index 19df22d..05e1a49 100644
--- a/src/lib/stores/version.ts
+++ b/src/lib/stores/version.ts
@@ -1,3 +1,3 @@
-export const version: string = "2024.06.4";
+export const version: string = "2024.06.5";
export const versionTag: string = "";
export const showWelcome: boolean = false;
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 63a7929..c4321d7 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -9,6 +9,7 @@
import { featureDetect } from "$lib/scripts/featureDetect";
import { onMount } from "svelte";
import toast from "svelte-french-toast";
+ import NearToMeIsland from "$lib/islands/near-to-me-island.svelte";
const title = "OwlBoard";
const inputIslands = [
@@ -46,7 +47,7 @@
{#each inputIslands as variables}
{/each}
-
+
diff --git a/src/routes/more/privacy/+page.svelte b/src/routes/more/privacy/+page.svelte
index 312bc30..48ac327 100644
--- a/src/routes/more/privacy/+page.svelte
+++ b/src/routes/more/privacy/+page.svelte
@@ -28,6 +28,7 @@
The email server may store the address and message content as part of its regular operation, and your consent to this is implied when you sign up.
In addition to the host portion of your email address, a randomly generated UUID is stored for the purpose of authorizing access to the rail staff data.
+
If you enable location data, your location will be sent to the server when you navigate to the homepage to determine your closest stations. This data is never stored on the server after the nearest stations have been send to your device.
Reporting an Issue
When you report an issue, certain data is collected, including your browser's User Agent string and the size of the window in which you are viewing the website.
diff --git a/src/routes/more/settings/+page.svelte b/src/routes/more/settings/+page.svelte
index bbc3612..7f03206 100644
--- a/src/routes/more/settings/+page.svelte
+++ b/src/routes/more/settings/+page.svelte
@@ -2,11 +2,44 @@
import Header from "$lib/navigation/header.svelte";
import Nav from "$lib/navigation/nav.svelte";
import QlSet from "$lib/islands/quick-link-set-island.svelte";
+ import Island from "$lib/islands/island.svelte";
+ import { location } from "$lib/stores/location";
+ import { getCurrentLocation } from "$lib/scripts/getLocation";
const title = "Settings";
+
+ $: if ($location) {
+ getCurrentLocation()
+ }
+
+
Use your location to quickly check departure boards near you