From 95e45c8cb1fb768918266d4eb7998ebf5d23727a Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 2 Jul 2024 20:16:57 +0100 Subject: [PATCH] Format --- src/lib/islands/near-to-me-island.svelte | 25 ++++++++++++------------ src/lib/scripts/getLocation.ts | 10 +++++----- src/lib/stores/location.ts | 13 ++++++------ src/lib/themes.css | 1 + src/routes/more/privacy/+page.svelte | 5 ++++- src/routes/more/settings/+page.svelte | 8 ++++---- src/routes/more/versions/+page.svelte | 4 +--- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/lib/islands/near-to-me-island.svelte b/src/lib/islands/near-to-me-island.svelte index 47dfc38..6afd22c 100644 --- a/src/lib/islands/near-to-me-island.svelte +++ b/src/lib/islands/near-to-me-island.svelte @@ -12,18 +12,17 @@ function turnOnLocation() { location.set(true); - toast("To disable location, go to settings") + toast("To disable location, go to settings"); } async function getNearestStations() { const currLocation = await getCurrentLocation(); - console.debug(`Current Latitude: ${currLocation.latitude}, Current Longitude: ${currLocation.longitude}`) - const apiPath = `/api/v2/live/station/nearest/${currLocation.latitude}/${currLocation.longitude}` - const res = await apiGet(apiPath) - console.log(res) - return res as any[] + console.debug(`Current Latitude: ${currLocation.latitude}, Current Longitude: ${currLocation.longitude}`); + const apiPath = `/api/v2/live/station/nearest/${currLocation.latitude}/${currLocation.longitude}`; + const res = await apiGet(apiPath); + console.log(res); + return res as any[]; } - @@ -38,13 +37,13 @@

Fetching Location

{:then stations}
- {#each stations as station} - {station.NLCDESC} - {station.miles}mi - {/each} + {#each stations as station} + {station.NLCDESC} - {station.miles}mi + {/each}
{:catch err}

Error: {err.message}

- {/await} + {/await} {/if}
@@ -90,5 +89,5 @@ color: var(--island-link-color); box-shadow: var(--box-shadow); white-space: nowrap; - } - \ No newline at end of file + } + diff --git a/src/lib/scripts/getLocation.ts b/src/lib/scripts/getLocation.ts index 01af2f7..58f99b1 100644 --- a/src/lib/scripts/getLocation.ts +++ b/src/lib/scripts/getLocation.ts @@ -1,8 +1,8 @@ export async function getCurrentLocation(): Promise { console.debug("Fetching location"); - if (typeof window === 'undefined') { - console.error("Location fetch has run serverside - invalid method") + if (typeof window === "undefined") { + console.error("Location fetch has run serverside - invalid method"); } if (!navigator.geolocation) { @@ -29,11 +29,11 @@ export async function getCurrentLocation(): Promise { reject(error); } ); - options + options; }); } export interface locationObj { - latitude: number - longitude: number + latitude: number; + longitude: number; } diff --git a/src/lib/stores/location.ts b/src/lib/stores/location.ts index 297d791..9157430 100644 --- a/src/lib/stores/location.ts +++ b/src/lib/stores/location.ts @@ -1,16 +1,16 @@ // src/stores.js -import { writable, type Writable } from 'svelte/store'; -import { browser } from '$app/environment'; +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'); +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'; + if (storedValue !== null && storedValue !== "undefined") { + return storedValue === "true"; } } return fallback; @@ -23,4 +23,3 @@ function toLocalStorage(store: Writable, storageKey: string) { }); } } - diff --git a/src/lib/themes.css b/src/lib/themes.css index 2508064..ad9b6cb 100644 --- a/src/lib/themes.css +++ b/src/lib/themes.css @@ -34,6 +34,7 @@ --overlay-island-bg-color: #3c6f79; --box-shadow-color: rgba(0, 0, 0, 0.19); --box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.19); + --box-shadow-dark: 2px 2px 4px rgba(0, 0, 0, 0.392); --main-alert-color: #ed6d00; --second-alert-color: #e77f00; --main-warning-color: orange; diff --git a/src/routes/more/privacy/+page.svelte b/src/routes/more/privacy/+page.svelte index 48ac327..3822e40 100644 --- a/src/routes/more/privacy/+page.svelte +++ b/src/routes/more/privacy/+page.svelte @@ -28,7 +28,10 @@

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.

+

+ 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 6121238..c2190be 100644 --- a/src/routes/more/settings/+page.svelte +++ b/src/routes/more/settings/+page.svelte @@ -9,11 +9,11 @@ const title = "Settings"; $: if ($location) { - getCurrentLocation() + getCurrentLocation(); } function locationToast() { - toast("Settings updated") + toast("Settings updated"); } @@ -21,11 +21,11 @@ - +

Use your location to quickly check departure boards near you

- +
diff --git a/src/routes/more/versions/+page.svelte b/src/routes/more/versions/+page.svelte index de79f7f..fa372d1 100644 --- a/src/routes/more/versions/+page.svelte +++ b/src/routes/more/versions/+page.svelte @@ -51,9 +51,7 @@


- timetable-mgr
{data?.["mq-client"] || "Not installed"}
+ timetable-mgr
{data?.["mq-client"] || "Not installed"}

{:catch}