Format
This commit is contained in:
parent
d09b24655a
commit
95e45c8cb1
@ -12,18 +12,17 @@
|
|||||||
|
|
||||||
function turnOnLocation() {
|
function turnOnLocation() {
|
||||||
location.set(true);
|
location.set(true);
|
||||||
toast("To disable location, go to settings")
|
toast("To disable location, go to settings");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getNearestStations() {
|
async function getNearestStations() {
|
||||||
const currLocation = await getCurrentLocation();
|
const currLocation = await getCurrentLocation();
|
||||||
console.debug(`Current Latitude: ${currLocation.latitude}, Current Longitude: ${currLocation.longitude}`)
|
console.debug(`Current Latitude: ${currLocation.latitude}, Current Longitude: ${currLocation.longitude}`);
|
||||||
const apiPath = `/api/v2/live/station/nearest/${currLocation.latitude}/${currLocation.longitude}`
|
const apiPath = `/api/v2/live/station/nearest/${currLocation.latitude}/${currLocation.longitude}`;
|
||||||
const res = await apiGet(apiPath)
|
const res = await apiGet(apiPath);
|
||||||
console.log(res)
|
console.log(res);
|
||||||
return res as any[]
|
return res as any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Island {variables}>
|
<Island {variables}>
|
||||||
@ -39,7 +38,7 @@
|
|||||||
{:then stations}
|
{:then stations}
|
||||||
<div id="buttons">
|
<div id="buttons">
|
||||||
{#each stations as station}
|
{#each stations as station}
|
||||||
<a class="link" href="/ldb?station={station["3ALPHA"]}">{station.NLCDESC} - {station.miles}mi</a>
|
<a class="link" href="/ldb?station={station['3ALPHA']}">{station.NLCDESC} - {station.miles}mi</a>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{:catch err}
|
{:catch err}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
export async function getCurrentLocation(): Promise<locationObj> {
|
export async function getCurrentLocation(): Promise<locationObj> {
|
||||||
console.debug("Fetching location");
|
console.debug("Fetching location");
|
||||||
|
|
||||||
if (typeof window === 'undefined') {
|
if (typeof window === "undefined") {
|
||||||
console.error("Location fetch has run serverside - invalid method")
|
console.error("Location fetch has run serverside - invalid method");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!navigator.geolocation) {
|
if (!navigator.geolocation) {
|
||||||
@ -29,11 +29,11 @@ export async function getCurrentLocation(): Promise<locationObj> {
|
|||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
options
|
options;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface locationObj {
|
export interface locationObj {
|
||||||
latitude: number
|
latitude: number;
|
||||||
longitude: number
|
longitude: number;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
// src/stores.js
|
// src/stores.js
|
||||||
import { writable, type Writable } from 'svelte/store';
|
import { writable, type Writable } from "svelte/store";
|
||||||
import { browser } from '$app/environment';
|
import { browser } from "$app/environment";
|
||||||
|
|
||||||
// Initialize the store with a boolean value from local storage
|
// Initialize the store with a boolean value from local storage
|
||||||
export const location: Writable<boolean> = writable(fromLocalStorage('location', false));
|
export const location: Writable<boolean> = writable(fromLocalStorage("location", false));
|
||||||
toLocalStorage(location, 'location');
|
toLocalStorage(location, "location");
|
||||||
|
|
||||||
function fromLocalStorage(storageKey: string, fallback: boolean): boolean {
|
function fromLocalStorage(storageKey: string, fallback: boolean): boolean {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
const storedValue = localStorage.getItem(storageKey);
|
const storedValue = localStorage.getItem(storageKey);
|
||||||
if (storedValue !== null && storedValue !== 'undefined') {
|
if (storedValue !== null && storedValue !== "undefined") {
|
||||||
return storedValue === 'true';
|
return storedValue === "true";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
@ -23,4 +23,3 @@ function toLocalStorage(store: Writable<boolean>, storageKey: string) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
--overlay-island-bg-color: #3c6f79;
|
--overlay-island-bg-color: #3c6f79;
|
||||||
--box-shadow-color: rgba(0, 0, 0, 0.19);
|
--box-shadow-color: rgba(0, 0, 0, 0.19);
|
||||||
--box-shadow: 2px 2px 4px 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;
|
--main-alert-color: #ed6d00;
|
||||||
--second-alert-color: #e77f00;
|
--second-alert-color: #e77f00;
|
||||||
--main-warning-color: orange;
|
--main-warning-color: orange;
|
||||||
|
@ -28,7 +28,10 @@
|
|||||||
</p>
|
</p>
|
||||||
<p>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.</p>
|
<p>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.</p>
|
||||||
<p>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.</p>
|
<p>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.</p>
|
||||||
<p>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.</p>
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
<h2>Reporting an Issue</h2>
|
<h2>Reporting an Issue</h2>
|
||||||
<p>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.</p>
|
<p>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.</p>
|
||||||
<p>
|
<p>
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
const title = "Settings";
|
const title = "Settings";
|
||||||
|
|
||||||
$: if ($location) {
|
$: if ($location) {
|
||||||
getCurrentLocation()
|
getCurrentLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
function locationToast() {
|
function locationToast() {
|
||||||
toast("Settings updated")
|
toast("Settings updated");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -21,11 +21,11 @@
|
|||||||
|
|
||||||
<QlSet />
|
<QlSet />
|
||||||
|
|
||||||
<Island variables={{title: "Location"}}>
|
<Island variables={{ title: "Location" }}>
|
||||||
<p>Use your location to quickly check departure boards near you</p>
|
<p>Use your location to quickly check departure boards near you</p>
|
||||||
<div class="checkbox-container">
|
<div class="checkbox-container">
|
||||||
<label for="location_enable">Enabled</label>
|
<label for="location_enable">Enabled</label>
|
||||||
<input id="location_enable" type="checkbox" bind:checked={$location} on:click={locationToast}>
|
<input id="location_enable" type="checkbox" bind:checked={$location} on:click={locationToast} />
|
||||||
</div>
|
</div>
|
||||||
</Island>
|
</Island>
|
||||||
|
|
||||||
|
@ -51,9 +51,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<Tooltip text="Go"><IconBrandGolang /></Tooltip>
|
<Tooltip text="Go"><IconBrandGolang /></Tooltip>
|
||||||
<br />
|
<br />
|
||||||
<a class="data" href="https://git.fjla.uk/owlboard/mq-client" target="_blank"
|
<a class="data" href="https://git.fjla.uk/owlboard/mq-client" target="_blank">timetable-mgr<br /><span class="data">{data?.["mq-client"] || "Not installed"}</span></a>
|
||||||
>timetable-mgr<br /><span class="data">{data?.["mq-client"] || "Not installed"}</span></a
|
|
||||||
>
|
|
||||||
</p>
|
</p>
|
||||||
</Island>
|
</Island>
|
||||||
{:catch}
|
{:catch}
|
||||||
|
Loading…
Reference in New Issue
Block a user