Update prettier settings
This commit is contained in:
parent
1484a9068e
commit
af58e923de
@ -1,12 +1,12 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:svelte/recommended', 'prettier'],
|
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:svelte/recommended", "prettier"],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: "@typescript-eslint/parser",
|
||||||
plugins: ['@typescript-eslint'],
|
plugins: ["@typescript-eslint"],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
sourceType: 'module',
|
sourceType: "module",
|
||||||
ecmaVersion: 2020,
|
ecmaVersion: 2020,
|
||||||
extraFileExtensions: ['.svelte']
|
extraFileExtensions: [".svelte"]
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
@ -15,10 +15,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: ['*.svelte'],
|
files: ["*.svelte"],
|
||||||
parser: 'svelte-eslint-parser',
|
parser: "svelte-eslint-parser",
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: '@typescript-eslint/parser'
|
parser: "@typescript-eslint/parser"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"useTabs": false,
|
"useTabs": false,
|
||||||
"tabWidth": 2,
|
"tabWidth": 4,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"singleQuote": true,
|
"singleQuote": false,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"printWidth": 180,
|
"printWidth": 180,
|
||||||
"plugins": ["prettier-plugin-svelte"],
|
"plugins": ["prettier-plugin-svelte"],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, onDestroy } from 'svelte';
|
import { onMount, onDestroy } from "svelte";
|
||||||
export let text: string;
|
export let text: string;
|
||||||
|
|
||||||
let isVisible: boolean = false;
|
let isVisible: boolean = false;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from "$lib/islands/island.svelte";
|
||||||
export let variables = {
|
export let variables = {
|
||||||
title: 'Uninitialised',
|
title: "Uninitialised",
|
||||||
action: '/',
|
action: "/",
|
||||||
placeholder: 'Uninitialised',
|
placeholder: "Uninitialised",
|
||||||
queryName: 'uninitiailsed'
|
queryName: "uninitiailsed"
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -25,7 +25,7 @@
|
|||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
border: none;
|
border: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
box-shadow: var(--box-shadow);
|
box-shadow: var(--box-shadow);
|
||||||
@ -37,7 +37,7 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
background-color: var(--island-button-color);
|
background-color: var(--island-button-color);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from "svelte/transition";
|
||||||
|
|
||||||
export let variables = { title: '' };
|
export let variables = { title: "" };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div in:fade={{ duration: 250 }}>
|
<div in:fade={{ duration: 250 }}>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
span {
|
span {
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
color: var(--island-header-color);
|
color: var(--island-header-color);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from "svelte/transition";
|
||||||
|
|
||||||
export let variables = { title: '' };
|
export let variables = { title: "" };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div in:fade={{ duration: 150 }} out:fade={{ duration: 150 }}>
|
<div in:fade={{ duration: 150 }} out:fade={{ duration: 150 }}>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
span {
|
span {
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
|
||||||
color: var(--island-header-color);
|
color: var(--island-header-color);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from "$lib/islands/island.svelte";
|
||||||
import { ql } from '$lib/stores/quick-links';
|
import { ql } from "$lib/stores/quick-links";
|
||||||
export let variables = {
|
export let variables = {
|
||||||
title: 'Quick Links'
|
title: "Quick Links"
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -43,7 +43,7 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from "$lib/islands/island.svelte";
|
||||||
import { ql } from '$lib/stores/quick-links';
|
import { ql } from "$lib/stores/quick-links";
|
||||||
export let variables = {
|
export let variables = {
|
||||||
title: 'Quick Links'
|
title: "Quick Links"
|
||||||
};
|
};
|
||||||
|
|
||||||
let qlData: string[] = [];
|
let qlData: string[] = [];
|
||||||
@ -11,7 +11,7 @@
|
|||||||
console.log(qlData);
|
console.log(qlData);
|
||||||
}
|
}
|
||||||
|
|
||||||
let saveButton = 'Save';
|
let saveButton = "Save";
|
||||||
|
|
||||||
async function timeout(ms: number): Promise<any> {
|
async function timeout(ms: number): Promise<any> {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
@ -19,36 +19,36 @@
|
|||||||
|
|
||||||
async function saveQl() {
|
async function saveQl() {
|
||||||
// Fetch the content of all text entries within the island then run ql.set([ARRAY OF INPUT CONTENT])
|
// Fetch the content of all text entries within the island then run ql.set([ARRAY OF INPUT CONTENT])
|
||||||
const inputs = document.getElementsByClassName('qlInput');
|
const inputs = document.getElementsByClassName("qlInput");
|
||||||
let inputLinks: string[] = [];
|
let inputLinks: string[] = [];
|
||||||
for (let item of inputs) {
|
for (let item of inputs) {
|
||||||
let text = (<HTMLInputElement>item)?.value;
|
let text = (<HTMLInputElement>item)?.value;
|
||||||
if (text !== '') {
|
if (text !== "") {
|
||||||
inputLinks.push(text);
|
inputLinks.push(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(inputLinks);
|
console.log(inputLinks);
|
||||||
ql.set(inputLinks);
|
ql.set(inputLinks);
|
||||||
saveButton = '✔';
|
saveButton = "✔";
|
||||||
await timeout(3000);
|
await timeout(3000);
|
||||||
saveButton = 'Saved';
|
saveButton = "Saved";
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearQl() {
|
function clearQl() {
|
||||||
ql.set([]);
|
ql.set([]);
|
||||||
saveButton = 'Saved';
|
saveButton = "Saved";
|
||||||
}
|
}
|
||||||
|
|
||||||
function addQlBox() {
|
function addQlBox() {
|
||||||
saveButton = 'Save';
|
saveButton = "Save";
|
||||||
const updatedQl = [...$ql, ''];
|
const updatedQl = [...$ql, ""];
|
||||||
$ql = updatedQl;
|
$ql = updatedQl;
|
||||||
ql.set(updatedQl);
|
ql.set(updatedQl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleClick(event: any) {
|
function handleClick(event: any) {
|
||||||
// Handle the click event here
|
// Handle the click event here
|
||||||
console.log('Island Clicked');
|
console.log("Island Clicked");
|
||||||
// You can access the `variables` passed to the Island component here if needed
|
// You can access the `variables` passed to the Island component here if needed
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -92,7 +92,7 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@ -107,7 +107,7 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
background-color: var(--island-button-color);
|
background-color: var(--island-button-color);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from "$lib/islands/island.svelte";
|
||||||
|
|
||||||
interface resultObj {
|
interface resultObj {
|
||||||
results: boolean;
|
results: boolean;
|
||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
export let resultObject: resultObj = {
|
export let resultObject: resultObj = {
|
||||||
results: true,
|
results: true,
|
||||||
title: '',
|
title: "",
|
||||||
resultLines: []
|
resultLines: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { fly } from 'svelte/transition';
|
import { fly } from "svelte/transition";
|
||||||
|
|
||||||
export let alerts = [];
|
export let alerts = [];
|
||||||
$: uniqueAlerts = [...new Set(alerts)];
|
$: uniqueAlerts = [...new Set(alerts)];
|
||||||
@ -11,7 +11,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function numberAsWord(number) {
|
function numberAsWord(number) {
|
||||||
const words = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
|
const words = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
|
||||||
let word = words[number];
|
let word = words[number];
|
||||||
if (word) {
|
if (word) {
|
||||||
return word;
|
return word;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
export let station = '';
|
export let station = "";
|
||||||
export let title = 'Loading...';
|
export let title = "Loading...";
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from "svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import OverlayIsland from '$lib/islands/overlay-island.svelte';
|
import OverlayIsland from "$lib/islands/overlay-island.svelte";
|
||||||
import AlertBar from '$lib/ldb/nrcc/alert-bar.svelte';
|
import AlertBar from "$lib/ldb/nrcc/alert-bar.svelte";
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from "$lib/islands/island.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
|
|
||||||
let requestedStation;
|
let requestedStation;
|
||||||
$: requestedStation = station;
|
$: requestedStation = station;
|
||||||
@ -59,9 +59,9 @@
|
|||||||
const data = await fetch(`${getApiUrl()}/api/v2/live/station/${requestedStation}/public`);
|
const data = await fetch(`${getApiUrl()}/api/v2/live/station/${requestedStation}/public`);
|
||||||
jsonData = await data.json();
|
jsonData = await data.json();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching data:', error);
|
console.error("Error fetching data:", error);
|
||||||
dataExists = false;
|
dataExists = false;
|
||||||
title = 'Not Found';
|
title = "Not Found";
|
||||||
} finally {
|
} finally {
|
||||||
isLoading = false; // Clear loading state
|
isLoading = false; // Clear loading state
|
||||||
}
|
}
|
||||||
@ -72,38 +72,38 @@
|
|||||||
let output;
|
let output;
|
||||||
let change;
|
let change;
|
||||||
switch (string) {
|
switch (string) {
|
||||||
case 'Delayed':
|
case "Delayed":
|
||||||
output = 'LATE';
|
output = "LATE";
|
||||||
change = 'changed';
|
change = "changed";
|
||||||
break;
|
break;
|
||||||
case 'Cancelled':
|
case "Cancelled":
|
||||||
output = 'CANC';
|
output = "CANC";
|
||||||
change = 'cancelled';
|
change = "cancelled";
|
||||||
break;
|
break;
|
||||||
case 'On Time':
|
case "On Time":
|
||||||
case 'On time':
|
case "On time":
|
||||||
output = 'RT';
|
output = "RT";
|
||||||
change = '';
|
change = "";
|
||||||
break;
|
break;
|
||||||
case '':
|
case "":
|
||||||
output = '-';
|
output = "-";
|
||||||
change = '';
|
change = "";
|
||||||
break;
|
break;
|
||||||
case undefined:
|
case undefined:
|
||||||
output = '-';
|
output = "-";
|
||||||
change = '';
|
change = "";
|
||||||
break;
|
break;
|
||||||
case 'No report':
|
case "No report":
|
||||||
output = '-';
|
output = "-";
|
||||||
change = '';
|
change = "";
|
||||||
break;
|
break;
|
||||||
case 'undefined':
|
case "undefined":
|
||||||
output = false;
|
output = false;
|
||||||
change = '';
|
change = "";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
output = string;
|
output = string;
|
||||||
change = 'changed';
|
change = "changed";
|
||||||
}
|
}
|
||||||
return { data: output, changed: change };
|
return { data: output, changed: change };
|
||||||
}
|
}
|
||||||
@ -170,19 +170,19 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="origdest from" on:click={loadService(service.serviceID)} on:keypress={loadService(service.serviceID)}>
|
<td class="origdest from" on:click={loadService(service.serviceID)} on:keypress={loadService(service.serviceID)}>
|
||||||
{#if Array.isArray(service.origin?.location)}
|
{#if Array.isArray(service.origin?.location)}
|
||||||
{service.origin.location[0]['locationName'] + ' & ' + service.origin.location[1]['locationName']}
|
{service.origin.location[0]["locationName"] + " & " + service.origin.location[1]["locationName"]}
|
||||||
{:else}
|
{:else}
|
||||||
{service.origin?.location?.locationName || ''}
|
{service.origin?.location?.locationName || ""}
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td class="origdest to" on:click={loadService(service.serviceID)} on:keypress={loadService(service.serviceID)}>
|
<td class="origdest to" on:click={loadService(service.serviceID)} on:keypress={loadService(service.serviceID)}>
|
||||||
{#if Array.isArray(service.destination?.location)}
|
{#if Array.isArray(service.destination?.location)}
|
||||||
{service.destination.location[0]['locationName'] + ' & ' + service.destination.location[0]['locationName']}
|
{service.destination.location[0]["locationName"] + " & " + service.destination.location[0]["locationName"]}
|
||||||
{:else}
|
{:else}
|
||||||
{service.destination?.location?.locationName || ''}
|
{service.destination?.location?.locationName || ""}
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td class="plat">{service.platform || '-'}</td>
|
<td class="plat">{service.platform || "-"}</td>
|
||||||
<td class="time">{parseTime(service.sta).data}</td>
|
<td class="time">{parseTime(service.sta).data}</td>
|
||||||
<td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td>
|
<td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td>
|
||||||
<td class="time">{parseTime(service.std).data}</td>
|
<td class="time">{parseTime(service.std).data}</td>
|
||||||
@ -192,9 +192,9 @@
|
|||||||
<tr
|
<tr
|
||||||
><td colspan="7">
|
><td colspan="7">
|
||||||
<p class="service-detail">
|
<p class="service-detail">
|
||||||
A {service.operator || 'Unknown'} service
|
A {service.operator || "Unknown"} service
|
||||||
{#if service['length']}
|
{#if service["length"]}
|
||||||
with {service['length'] || 'some'} coaches
|
with {service["length"] || "some"} coaches
|
||||||
{/if}
|
{/if}
|
||||||
</p>
|
</p>
|
||||||
{#if service.delayReason}
|
{#if service.delayReason}
|
||||||
@ -225,9 +225,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{#each busServices as service}
|
{#each busServices as service}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="origdest from" on:click={loadBusService(service.serviceID)} on:keypress={loadBusService(service.serviceID)}>{service.origin?.location?.locationName || ''}</td>
|
<td class="origdest from" on:click={loadBusService(service.serviceID)} on:keypress={loadBusService(service.serviceID)}
|
||||||
|
>{service.origin?.location?.locationName || ""}</td
|
||||||
|
>
|
||||||
<td class="origdest to" on:click={loadBusService(service.serviceID)} on:keypress={loadBusService(service.serviceID)}
|
<td class="origdest to" on:click={loadBusService(service.serviceID)} on:keypress={loadBusService(service.serviceID)}
|
||||||
>{service.destination?.location?.locationName || ''}</td
|
>{service.destination?.location?.locationName || ""}</td
|
||||||
>
|
>
|
||||||
<td class="time">{parseTime(service.sta).data}</td>
|
<td class="time">{parseTime(service.sta).data}</td>
|
||||||
<td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td>
|
<td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td>
|
||||||
@ -238,7 +240,7 @@
|
|||||||
<tr
|
<tr
|
||||||
><td colspan="7">
|
><td colspan="7">
|
||||||
<p class="service-detail">
|
<p class="service-detail">
|
||||||
A {service.operator || 'Unknown'} service
|
A {service.operator || "Unknown"} service
|
||||||
</p>
|
</p>
|
||||||
{#if service.delayReason}
|
{#if service.delayReason}
|
||||||
<p class="service-detail">{service.delayReason}</p>
|
<p class="service-detail">{service.delayReason}</p>
|
||||||
@ -266,8 +268,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{#each ferryServices as service}
|
{#each ferryServices as service}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="origdest from">{service.origin?.location?.locationName || ''}</td>
|
<td class="origdest from">{service.origin?.location?.locationName || ""}</td>
|
||||||
<td class="origdest to">{service.destination?.location?.locationName || ''}</td>
|
<td class="origdest to">{service.destination?.location?.locationName || ""}</td>
|
||||||
<td class="time">{parseTime(service.sta).data}</td>
|
<td class="time">{parseTime(service.sta).data}</td>
|
||||||
<td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td>
|
<td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td>
|
||||||
<td class="time">{parseTime(service.std).data}</td>
|
<td class="time">{parseTime(service.std).data}</td>
|
||||||
@ -318,9 +320,12 @@
|
|||||||
<td>{serviceDetail.previousCallingPoints.callingPointList.callingPoint.locationName}</td>
|
<td>{serviceDetail.previousCallingPoints.callingPointList.callingPoint.locationName}</td>
|
||||||
<td>{serviceDetail.previousCallingPoints.callingPointList.callingPoint.st}</td>
|
<td>{serviceDetail.previousCallingPoints.callingPointList.callingPoint.st}</td>
|
||||||
<td
|
<td
|
||||||
class="time {parseTime(serviceDetail.previousCallingPoints.callingPointList.callingPoint.at || serviceDetail.previousCallingPoints.callingPointList.callingPoint.et)
|
class="time {parseTime(
|
||||||
.changed}"
|
serviceDetail.previousCallingPoints.callingPointList.callingPoint.at || serviceDetail.previousCallingPoints.callingPointList.callingPoint.et
|
||||||
>{parseTime(serviceDetail.previousCallingPoints.callingPointList.callingPoint.at || serviceDetail.previousCallingPoints.callingPointList.callingPoint.et).data}</td
|
).changed}"
|
||||||
|
>{parseTime(
|
||||||
|
serviceDetail.previousCallingPoints.callingPointList.callingPoint.at || serviceDetail.previousCallingPoints.callingPointList.callingPoint.et
|
||||||
|
).data}</td
|
||||||
>
|
>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
// Fetches StaffLDB Data, correctly formats DATE fields and returns the data
|
// Fetches StaffLDB Data, correctly formats DATE fields and returns the data
|
||||||
|
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
import { uuid } from '$lib/stores/uuid';
|
import { uuid } from "$lib/stores/uuid";
|
||||||
import type { ApiResponse, StaffLdb } from '@owlboard/ts-types';
|
import type { ApiResponse, StaffLdb } from "@owlboard/ts-types";
|
||||||
|
|
||||||
// Fetch StaffLDB Data, and returns the data after hydration (convert date types etc.)
|
// Fetch StaffLDB Data, and returns the data after hydration (convert date types etc.)
|
||||||
export async function fetchStaffLdb(station: string): Promise<ApiResponse<StaffLdb>> {
|
export async function fetchStaffLdb(station: string): Promise<ApiResponse<StaffLdb>> {
|
||||||
const url = `${getApiUrl()}/api/v2/live/station/${station}/staff`;
|
const url = `${getApiUrl()}/api/v2/live/station/${station}/staff`;
|
||||||
|
|
||||||
let uuid_value: string = '';
|
let uuid_value: string = "";
|
||||||
const unsubscribe = uuid.subscribe((value) => {
|
const unsubscribe = uuid.subscribe((value) => {
|
||||||
uuid_value = value;
|
uuid_value = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchOpts = {
|
const fetchOpts = {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
uuid: uuid_value
|
uuid: uuid_value
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ export async function fetchStaffLdb(station: string): Promise<ApiResponse<StaffL
|
|||||||
// Parse dates within the JSON response
|
// Parse dates within the JSON response
|
||||||
function parseFormat(jsonString: any): ApiResponse<StaffLdb> {
|
function parseFormat(jsonString: any): ApiResponse<StaffLdb> {
|
||||||
return JSON.parse(jsonString, (key, value) => {
|
return JSON.parse(jsonString, (key, value) => {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === "string") {
|
||||||
const dateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/;
|
const dateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/;
|
||||||
if (dateRegex.test(value)) {
|
if (dateRegex.test(value)) {
|
||||||
return new Date(value);
|
return new Date(value);
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import TableGenerator from './table/table-generator.svelte';
|
import TableGenerator from "./table/table-generator.svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import type { ApiResponse, StaffLdb } from '@owlboard/ts-types';
|
import type { ApiResponse, StaffLdb } from "@owlboard/ts-types";
|
||||||
import { detailInit, defineDetail } from './train-detail';
|
import { detailInit, defineDetail } from "./train-detail";
|
||||||
import TrainDetail from './train-detail.svelte';
|
import TrainDetail from "./train-detail.svelte";
|
||||||
import { fetchStaffLdb } from './fetch';
|
import { fetchStaffLdb } from "./fetch";
|
||||||
import AlertBar from '../nrcc/alert-bar.svelte';
|
import AlertBar from "../nrcc/alert-bar.svelte";
|
||||||
|
|
||||||
export let station: string;
|
export let station: string;
|
||||||
export let title: string | undefined = 'Loading...';
|
export let title: string | undefined = "Loading...";
|
||||||
|
|
||||||
let errorDetail = {
|
let errorDetail = {
|
||||||
code: '',
|
code: "",
|
||||||
message: ''
|
message: ""
|
||||||
};
|
};
|
||||||
let nrcc: string[] = [];
|
let nrcc: string[] = [];
|
||||||
|
|
||||||
@ -37,9 +37,9 @@
|
|||||||
}
|
}
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
errorDetail.code = data.obStatus.toString() || 'UNKNOWN';
|
errorDetail.code = data.obStatus.toString() || "UNKNOWN";
|
||||||
errorDetail.message = data.obMsg || 'An unknown error occoured';
|
errorDetail.message = data.obMsg || "An unknown error occoured";
|
||||||
throw new Error('Unable to Fetch Data');
|
throw new Error("Unable to Fetch Data");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Reason from '$lib/raw-fetchers/reason.svelte';
|
import Reason from "$lib/raw-fetchers/reason.svelte";
|
||||||
import { tocs as tocMap } from '$lib/stores/tocMap';
|
import { tocs as tocMap } from "$lib/stores/tocMap";
|
||||||
|
|
||||||
import type { TrainServices, ServiceLocation } from '@owlboard/ts-types';
|
import type { TrainServices, ServiceLocation } from "@owlboard/ts-types";
|
||||||
|
|
||||||
export let services: TrainServices[];
|
export let services: TrainServices[];
|
||||||
export let click: Function;
|
export let click: Function;
|
||||||
@ -17,7 +17,7 @@
|
|||||||
for (const location of locations) {
|
for (const location of locations) {
|
||||||
tiplocs.push(location.tiploc);
|
tiplocs.push(location.tiploc);
|
||||||
}
|
}
|
||||||
return tiplocs.join(' & ');
|
return tiplocs.join(" & ");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function classGenerator(service: TrainServices) {
|
async function classGenerator(service: TrainServices) {
|
||||||
@ -28,21 +28,21 @@
|
|||||||
let platArr: string[] = [];
|
let platArr: string[] = [];
|
||||||
|
|
||||||
if (service.isCancelled) {
|
if (service.isCancelled) {
|
||||||
otherArr.push('canc');
|
otherArr.push("canc");
|
||||||
}
|
}
|
||||||
if (service.serviceIsSupressed) {
|
if (service.serviceIsSupressed) {
|
||||||
otherArr.push('nonPass');
|
otherArr.push("nonPass");
|
||||||
}
|
}
|
||||||
if (service.platformIsHidden) {
|
if (service.platformIsHidden) {
|
||||||
platArr.push('nonPass');
|
platArr.push("nonPass");
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkLateEarly(originalTime: Date | undefined, comparedTime: Date | undefined, arr: string[]) {
|
function checkLateEarly(originalTime: Date | undefined, comparedTime: Date | undefined, arr: string[]) {
|
||||||
if (originalTime !== undefined && comparedTime instanceof Date) {
|
if (originalTime !== undefined && comparedTime instanceof Date) {
|
||||||
if (originalTime < comparedTime) {
|
if (originalTime < comparedTime) {
|
||||||
arr.push('late');
|
arr.push("late");
|
||||||
} else if (originalTime > comparedTime) {
|
} else if (originalTime > comparedTime) {
|
||||||
arr.push('early');
|
arr.push("early");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,18 +53,18 @@
|
|||||||
checkLateEarly(service.std, service.atd, depArr);
|
checkLateEarly(service.std, service.atd, depArr);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
other: otherArr.join(' '),
|
other: otherArr.join(" "),
|
||||||
arr: arrArr.join(' '),
|
arr: arrArr.join(" "),
|
||||||
dep: depArr.join(' '),
|
dep: depArr.join(" "),
|
||||||
plat: platArr.join(' ')
|
plat: platArr.join(" ")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function fmtTime(date: Date | string | undefined): string | false {
|
function fmtTime(date: Date | string | undefined): string | false {
|
||||||
if (typeof date === 'string') return date;
|
if (typeof date === "string") return date;
|
||||||
if (date instanceof Date) {
|
if (date instanceof Date) {
|
||||||
const hours = date.getHours().toString().padStart(2, '0');
|
const hours = date.getHours().toString().padStart(2, "0");
|
||||||
const minutes = date.getMinutes().toString().padStart(2, '0');
|
const minutes = date.getMinutes().toString().padStart(2, "0");
|
||||||
return `${hours}:${minutes}`;
|
return `${hours}:${minutes}`;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -104,15 +104,15 @@
|
|||||||
<!-- DESTINATION -->
|
<!-- DESTINATION -->
|
||||||
<td class="loc to {classes.other}">{#await formatLocations(service.destination) then dest}<span class="locName">{dest}</span>{/await}</td>
|
<td class="loc to {classes.other}">{#await formatLocations(service.destination) then dest}<span class="locName">{dest}</span>{/await}</td>
|
||||||
<!-- PLATFORM -->
|
<!-- PLATFORM -->
|
||||||
<td class="plat {classes.other} {classes.plat}">{service.platform || '-'}</td>
|
<td class="plat {classes.other} {classes.plat}">{service.platform || "-"}</td>
|
||||||
<!-- SCHEDULED ARR -->
|
<!-- SCHEDULED ARR -->
|
||||||
<td class="time schTime {classes.other}">{fmtTime(service?.sta) || '-'}</td>
|
<td class="time schTime {classes.other}">{fmtTime(service?.sta) || "-"}</td>
|
||||||
<!-- EXPECTED/ACTUAL ARR -->
|
<!-- EXPECTED/ACTUAL ARR -->
|
||||||
<td class="time {classes.other} {classes.arr}">{fmtTime(service.eta) || fmtTime(service.ata) || '-'}</td>
|
<td class="time {classes.other} {classes.arr}">{fmtTime(service.eta) || fmtTime(service.ata) || "-"}</td>
|
||||||
<!-- SCHEDULED DEP -->
|
<!-- SCHEDULED DEP -->
|
||||||
<td class="time schTime {classes.other}">{fmtTime(service.std) || '-'}</td>
|
<td class="time schTime {classes.other}">{fmtTime(service.std) || "-"}</td>
|
||||||
<!-- EXPECTED/ACTUAL DEP -->
|
<!-- EXPECTED/ACTUAL DEP -->
|
||||||
<td class="time {classes.other} {classes.dep}">{fmtTime(service.etd) || fmtTime(service.atd) || '-'}</td>
|
<td class="time {classes.other} {classes.dep}">{fmtTime(service.etd) || fmtTime(service.atd) || "-"}</td>
|
||||||
{/await}
|
{/await}
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -124,13 +124,13 @@
|
|||||||
{#if service.delayReason}
|
{#if service.delayReason}
|
||||||
<br />
|
<br />
|
||||||
<span class="delayTxt">
|
<span class="delayTxt">
|
||||||
<Reason type={'delay'} code={service.delayReason} />
|
<Reason type={"delay"} code={service.delayReason} />
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
{#if service.cancelReason}
|
{#if service.cancelReason}
|
||||||
<br />
|
<br />
|
||||||
<span class="cancTxt">
|
<span class="cancTxt">
|
||||||
<Reason type={'cancel'} code={service.cancelReason} />
|
<Reason type={"cancel"} code={service.cancelReason} />
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import OverlayIsland from '$lib/islands/overlay-island.svelte';
|
import OverlayIsland from "$lib/islands/overlay-island.svelte";
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from "svelte/transition";
|
||||||
import Reason from '$lib/raw-fetchers/reason.svelte';
|
import Reason from "$lib/raw-fetchers/reason.svelte";
|
||||||
import { uuid } from '$lib/stores/uuid';
|
import { uuid } from "$lib/stores/uuid";
|
||||||
import StylesToc from '$lib/train/styles-toc.svelte';
|
import StylesToc from "$lib/train/styles-toc.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
export let detail = {
|
export let detail = {
|
||||||
uid: '',
|
uid: "",
|
||||||
rid: '',
|
rid: "",
|
||||||
headcode: '',
|
headcode: "",
|
||||||
show: true
|
show: true
|
||||||
};
|
};
|
||||||
export let close;
|
export let close;
|
||||||
@ -22,7 +22,7 @@
|
|||||||
console.log(`Requested Station: ${rid}`);
|
console.log(`Requested Station: ${rid}`);
|
||||||
const url = `${getApiUrl()}/api/v2/live/train/rid/${rid}`;
|
const url = `${getApiUrl()}/api/v2/live/train/rid/${rid}`;
|
||||||
const opt = {
|
const opt = {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
uuid: $uuid
|
uuid: $uuid
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@
|
|||||||
const data = await fetch(url, opt);
|
const data = await fetch(url, opt);
|
||||||
return await data.json();
|
return await data.json();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching data:', error);
|
console.error("Error fetching data:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,19 +40,19 @@
|
|||||||
try {
|
try {
|
||||||
const result = Math.floor(location.lateness / 60);
|
const result = Math.floor(location.lateness / 60);
|
||||||
if (result === 0) {
|
if (result === 0) {
|
||||||
(string = 'RT'), (state = '');
|
(string = "RT"), (state = "");
|
||||||
} else if (result < 0) {
|
} else if (result < 0) {
|
||||||
(string = -result + 'E'), (state = 'early');
|
(string = -result + "E"), (state = "early");
|
||||||
} else if (result > 0) {
|
} else if (result > 0) {
|
||||||
(string = result + 'L'), (state = 'late');
|
(string = result + "L"), (state = "late");
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
(string = ''), (state = '');
|
(string = ""), (state = "");
|
||||||
}
|
}
|
||||||
} else if (location.arrivalType === 'Delayed') {
|
} else if (location.arrivalType === "Delayed") {
|
||||||
(string = ''), (state = 'late');
|
(string = ""), (state = "late");
|
||||||
} else {
|
} else {
|
||||||
(string = ''), (state = 'noreport');
|
(string = ""), (state = "noreport");
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
string: string,
|
string: string,
|
||||||
@ -61,8 +61,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseTime(date) {
|
function parseTime(date) {
|
||||||
const parsedTime = date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
const parsedTime = date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
||||||
return parsedTime !== 'Invalid Date' ? parsedTime : null;
|
return parsedTime !== "Invalid Date" ? parsedTime : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseTimes(service) {
|
function parseTimes(service) {
|
||||||
@ -79,19 +79,19 @@
|
|||||||
parsedEtd = parseTime(etd),
|
parsedEtd = parseTime(etd),
|
||||||
parsedAtd = parseTime(atd);
|
parsedAtd = parseTime(atd);
|
||||||
if (service.isCancelled) {
|
if (service.isCancelled) {
|
||||||
(parsedEta = 'CANC'), (parsedEtd = 'CANC');
|
(parsedEta = "CANC"), (parsedEtd = "CANC");
|
||||||
}
|
}
|
||||||
let times = {
|
let times = {
|
||||||
sta: parsedSta || '-',
|
sta: parsedSta || "-",
|
||||||
eata: parsedEta || parsedAta || '-',
|
eata: parsedEta || parsedAta || "-",
|
||||||
aEst: parsedEta ? 'estimate' : '',
|
aEst: parsedEta ? "estimate" : "",
|
||||||
std: parsedStd || '-',
|
std: parsedStd || "-",
|
||||||
eatd: parsedEtd || parsedAtd || '-',
|
eatd: parsedEtd || parsedAtd || "-",
|
||||||
dEst: parsedEtd ? 'estimate' : ''
|
dEst: parsedEtd ? "estimate" : ""
|
||||||
};
|
};
|
||||||
if (service.isCancelled) {
|
if (service.isCancelled) {
|
||||||
(parsedEta = 'CANC'), (parsedEtd = 'CANC');
|
(parsedEta = "CANC"), (parsedEtd = "CANC");
|
||||||
(times.aEst = 'canc'), (times.dEst = 'canc');
|
(times.aEst = "canc"), (times.dEst = "canc");
|
||||||
}
|
}
|
||||||
return times;
|
return times;
|
||||||
}
|
}
|
||||||
@ -139,16 +139,16 @@
|
|||||||
{#each train.GetServiceDetailsResult.locations.location as location}
|
{#each train.GetServiceDetailsResult.locations.location as location}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="location {location?.isPass === 'true' ? 'pass' : ''}">{location.tiploc}</td>
|
<td class="location {location?.isPass === 'true' ? 'pass' : ''}">{location.tiploc}</td>
|
||||||
<td class={location?.isPass === 'true' ? 'pass' : ''}>{location.platform || ''}</td>
|
<td class={location?.isPass === "true" ? "pass" : ""}>{location.platform || ""}</td>
|
||||||
{#await parseTimes(location)}
|
{#await parseTimes(location)}
|
||||||
<td />
|
<td />
|
||||||
<td />
|
<td />
|
||||||
<td />
|
<td />
|
||||||
<td />
|
<td />
|
||||||
{:then times}
|
{:then times}
|
||||||
<td class={location?.isPass === 'true' ? 'pass' : ''}>{times.sta}</td>
|
<td class={location?.isPass === "true" ? "pass" : ""}>{times.sta}</td>
|
||||||
<td class="{location?.isPass === 'true' ? 'pass' : ''} {times.aEst}">{times.eata}</td>
|
<td class="{location?.isPass === 'true' ? 'pass' : ''} {times.aEst}">{times.eata}</td>
|
||||||
<td class={location?.isPass === 'true' ? 'pass' : ''}>{times.std}</td>
|
<td class={location?.isPass === "true" ? "pass" : ""}>{times.std}</td>
|
||||||
<td class="{location?.isPass === 'true' ? 'pass' : ''} {times.dEst}">{times.eatd}</td>
|
<td class="{location?.isPass === 'true' ? 'pass' : ''} {times.dEst}">{times.eatd}</td>
|
||||||
{/await}
|
{/await}
|
||||||
{#await parseDelay(location)}
|
{#await parseDelay(location)}
|
||||||
|
@ -10,9 +10,9 @@ export interface Detail {
|
|||||||
export function detailInit(): Detail {
|
export function detailInit(): Detail {
|
||||||
const detail: Detail = {
|
const detail: Detail = {
|
||||||
show: false,
|
show: false,
|
||||||
headcode: '',
|
headcode: "",
|
||||||
rid: '',
|
rid: "",
|
||||||
uid: ''
|
uid: ""
|
||||||
};
|
};
|
||||||
return detail;
|
return detail;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { getApiUrl } from './scripts/upstream';
|
import { getApiUrl } from "./scripts/upstream";
|
||||||
import { uuid } from './stores/uuid';
|
import { uuid } from "./stores/uuid";
|
||||||
|
|
||||||
export interface libauthResponse {
|
export interface libauthResponse {
|
||||||
uuidPresent?: boolean;
|
uuidPresent?: boolean;
|
||||||
@ -19,7 +19,7 @@ export async function checkAuth(): Promise<libauthResponse> {
|
|||||||
result.uuidPresent = uuidCheck?.uuidPresent;
|
result.uuidPresent = uuidCheck?.uuidPresent;
|
||||||
result.uuidValue = uuidCheck?.uuidValue;
|
result.uuidValue = uuidCheck?.uuidValue;
|
||||||
|
|
||||||
const serverCheck = await checkServerAuth(result.uuidValue || '');
|
const serverCheck = await checkServerAuth(result.uuidValue || "");
|
||||||
result.serverAuthCheck = serverCheck.authOk;
|
result.serverAuthCheck = serverCheck.authOk;
|
||||||
result.serverAuthCheckResponseCode = serverCheck.status;
|
result.serverAuthCheckResponseCode = serverCheck.status;
|
||||||
|
|
||||||
@ -27,15 +27,15 @@ export async function checkAuth(): Promise<libauthResponse> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function checkUuid(): Promise<uuidCheckRes> {
|
async function checkUuid(): Promise<uuidCheckRes> {
|
||||||
let uuid_value: string = '';
|
let uuid_value: string = "";
|
||||||
const unsubscribe = uuid.subscribe((value) => {
|
const unsubscribe = uuid.subscribe((value) => {
|
||||||
uuid_value = value;
|
uuid_value = value;
|
||||||
});
|
});
|
||||||
let res: uuidCheckRes = {
|
let res: uuidCheckRes = {
|
||||||
uuidValue: uuid_value
|
uuidValue: uuid_value
|
||||||
};
|
};
|
||||||
console.log('uuid-value is: ', uuid_value);
|
console.log("uuid-value is: ", uuid_value);
|
||||||
if (uuid_value && uuid_value != 'null') {
|
if (uuid_value && uuid_value != "null") {
|
||||||
res = {
|
res = {
|
||||||
uuidPresent: true,
|
uuidPresent: true,
|
||||||
uuidValue: uuid_value
|
uuidValue: uuid_value
|
||||||
@ -53,7 +53,7 @@ async function checkUuid(): Promise<uuidCheckRes> {
|
|||||||
async function checkServerAuth(uuidString: string) {
|
async function checkServerAuth(uuidString: string) {
|
||||||
const url = `${getApiUrl()}/api/v2/user/checkAuth`;
|
const url = `${getApiUrl()}/api/v2/user/checkAuth`;
|
||||||
const options = {
|
const options = {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
uuid: uuidString
|
uuid: uuidString
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
/* FONTS */
|
/* FONTS */
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'firamono';
|
font-family: "firamono";
|
||||||
src: url('/font/firamono/firamono-regular.woff2') format('woff2'), url('/font/firamono/firamono-regular.woff') format('woff'),
|
src: url("/font/firamono/firamono-regular.woff2") format("woff2"), url("/font/firamono/firamono-regular.woff") format("woff"),
|
||||||
url('/font/firamono/firamono-regular.ttf') format('truetype');
|
url("/font/firamono/firamono-regular.ttf") format("truetype");
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'firamono';
|
font-family: "firamono";
|
||||||
src: url('/font/firamono/firamono-500.woff2') format('woff2'), url('/font/firamono/firamono-500.woff') format('woff'), url('/font/firamono/firamono-500.ttf') format('truetype');
|
src: url("/font/firamono/firamono-500.woff2") format("woff2"), url("/font/firamono/firamono-500.woff") format("woff"), url("/font/firamono/firamono-500.ttf") format("truetype");
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'urwgothic';
|
font-family: "urwgothic";
|
||||||
src: url('/font/urwgothic/urwgothic.woff2') format('woff2'), url('/font/urwgothic/urwgothic.woff') format('woff'), url('/font/urwgothic/urwgothic.ttf') format('truetype');
|
src: url("/font/urwgothic/urwgothic.woff2") format("woff2"), url("/font/urwgothic/urwgothic.woff") format("woff"), url("/font/urwgothic/urwgothic.ttf") format("truetype");
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'urwgothic';
|
font-family: "urwgothic";
|
||||||
src: url('/font/urwgothic/urwgothicDemi.woff2') format('woff2'), url('/font/urwgothic/urwgothicDemi.woff') format('woff'),
|
src: url("/font/urwgothic/urwgothicDemi.woff2") format("woff2"), url("/font/urwgothic/urwgothicDemi.woff") format("woff"),
|
||||||
url('/font/urwgothic/urwgothicDemi.ttf') format('truetype');
|
url("/font/urwgothic/urwgothicDemi.ttf") format("truetype");
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'ubuntu';
|
font-family: "ubuntu";
|
||||||
src: url('/font/ubuntumono/ubuntumono-regular.woff2') format('woff2'), url('/font/ubuntumono/ubuntumono-regular.woff') format('woff'),
|
src: url("/font/ubuntumono/ubuntumono-regular.woff2") format("woff2"), url("/font/ubuntumono/ubuntumono-regular.woff") format("woff"),
|
||||||
url('/font/ubuntumono/ubuntumono-regular.ttf') format('truetype');
|
url("/font/ubuntumono/ubuntumono-regular.ttf") format("truetype");
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { logout } from '$lib/libauth';
|
import { logout } from "$lib/libauth";
|
||||||
|
|
||||||
async function logoutAction() {
|
async function logoutAction() {
|
||||||
await logout();
|
await logout();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
export let title = 'title';
|
export let title = "title";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="headerBar">
|
<div class="headerBar">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from "svelte/transition";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="container" in:fade={{ delay: 150, duration: 250 }} out:fade={{ duration: 250 }}>
|
<div id="container" in:fade={{ delay: 150, duration: 250 }} out:fade={{ duration: 250 }}>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
border: solid 5px var(--overlay-island-bg-color);
|
border: solid 5px var(--overlay-island-bg-color);
|
||||||
border-bottom-color: white;
|
border-bottom-color: white;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
content: '';
|
content: "";
|
||||||
height: 40px;
|
height: 40px;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<script>
|
<script>
|
||||||
const links = [
|
const links = [
|
||||||
{
|
{
|
||||||
title: 'Home',
|
title: "Home",
|
||||||
path: '/',
|
path: "/",
|
||||||
icon: IconHome
|
icon: IconHome
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
import { page } from '$app/stores';
|
import { page } from "$app/stores";
|
||||||
import { IconHome } from '@tabler/icons-svelte';
|
import { IconHome } from "@tabler/icons-svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
<script>
|
<script>
|
||||||
const links = [
|
const links = [
|
||||||
{
|
{
|
||||||
title: 'Home',
|
title: "Home",
|
||||||
path: '/',
|
path: "/",
|
||||||
icon: IconHome
|
icon: IconHome
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'PIS Finder',
|
title: "PIS Finder",
|
||||||
path: '/pis/',
|
path: "/pis/",
|
||||||
icon: IconDialpad
|
icon: IconDialpad
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Menu',
|
title: "Menu",
|
||||||
path: '/more/',
|
path: "/more/",
|
||||||
icon: IconMenu2
|
icon: IconMenu2
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
import { page } from '$app/stores';
|
import { page } from "$app/stores";
|
||||||
import { IconHome, IconMenu2, IconDialpad } from '@tabler/icons-svelte';
|
import { IconHome, IconMenu2, IconDialpad } from "@tabler/icons-svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
{#each links as item}
|
{#each links as item}
|
||||||
<a href={item.path} class:active={$page.url.pathname == item.path || $page.url.pathname == item.path + '/'}>
|
<a href={item.path} class:active={$page.url.pathname == item.path || $page.url.pathname == item.path + "/"}>
|
||||||
<svelte:component this={item.icon} />
|
<svelte:component this={item.icon} />
|
||||||
<br />
|
<br />
|
||||||
<span>{item.title}</span>
|
<span>{item.title}</span>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { welcome } from '$lib/stores/welcome';
|
import { welcome } from "$lib/stores/welcome";
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from "svelte/transition";
|
||||||
import { version } from '$lib/stores/version';
|
import { version } from "$lib/stores/version";
|
||||||
|
|
||||||
let pageNum: number = 0;
|
let pageNum: number = 0;
|
||||||
|
|
||||||
@ -20,14 +20,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pageText: string[] = [
|
const pageText: string[] = [
|
||||||
'<h3>PIS Codes</h3>' +
|
"<h3>PIS Codes</h3>" +
|
||||||
'<p>An effort has been made to support PIS codes accross the GWR network</p>' +
|
"<p>An effort has been made to support PIS codes accross the GWR network</p>" +
|
||||||
'<p>The vast majority of codes across West, LTV, HEx and Sleeper services are now available.</p>' +
|
"<p>The vast majority of codes across West, LTV, HEx and Sleeper services are now available.</p>" +
|
||||||
'<p>The easiest way to find a PIS code is to type your headcode into the homepage, then select your service</p>',
|
"<p>The easiest way to find a PIS code is to type your headcode into the homepage, then select your service</p>",
|
||||||
'<h3>Resgistration Update</h3>' +
|
"<h3>Resgistration Update</h3>" +
|
||||||
'<p>The registration issue has been fixed and registrations are now open.</p>' +
|
"<p>The registration issue has been fixed and registrations are now open.</p>" +
|
||||||
'<p>Headcode and PIS Lookups will still be possible without registering but only for a limited time.</p>' +
|
"<p>Headcode and PIS Lookups will still be possible without registering but only for a limited time.</p>" +
|
||||||
'<p>You will receive further warning before mandatory registration is re-enabled.</p>'
|
"<p>You will receive further warning before mandatory registration is re-enabled.</p>"
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
import { uuid } from '$lib/stores/uuid';
|
import { uuid } from "$lib/stores/uuid";
|
||||||
|
|
||||||
export let code = '';
|
export let code = "";
|
||||||
export let type = '';
|
export let type = "";
|
||||||
|
|
||||||
async function getDelay(code = '') {
|
async function getDelay(code = "") {
|
||||||
console.log(`Fetching delay reason ${code}`);
|
console.log(`Fetching delay reason ${code}`);
|
||||||
const data = await getReason(code);
|
const data = await getReason(code);
|
||||||
return data[0].lateReason || 'This train has been delayed';
|
return data[0].lateReason || "This train has been delayed";
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCancel(code = '') {
|
async function getCancel(code = "") {
|
||||||
console.log(`Fetching cancel reason ${code}`);
|
console.log(`Fetching cancel reason ${code}`);
|
||||||
const data = await getReason(code);
|
const data = await getReason(code);
|
||||||
return data[0].cancReason || 'This train has been cancelled';
|
return data[0].cancReason || "This train has been cancelled";
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getReason(code = '') {
|
async function getReason(code = "") {
|
||||||
const url = `${getApiUrl()}/api/v2/ref/reasonCode/${code}`;
|
const url = `${getApiUrl()}/api/v2/ref/reasonCode/${code}`;
|
||||||
const options = {
|
const options = {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
uuid: $uuid
|
uuid: $uuid
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if type === 'cancel'}
|
{#if type === "cancel"}
|
||||||
{#await getCancel(code)}
|
{#await getCancel(code)}
|
||||||
This train has been cancelled
|
This train has been cancelled
|
||||||
{:then reason}
|
{:then reason}
|
||||||
@ -38,7 +38,7 @@
|
|||||||
{:catch}
|
{:catch}
|
||||||
This train has been cancelled
|
This train has been cancelled
|
||||||
{/await}
|
{/await}
|
||||||
{:else if type === 'delay'}
|
{:else if type === "delay"}
|
||||||
{#await getDelay(code)}
|
{#await getDelay(code)}
|
||||||
This train has been delayed
|
This train has been delayed
|
||||||
{:then reason}
|
{:then reason}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { dev } from '$app/environment';
|
import { dev } from "$app/environment";
|
||||||
import { uuid } from '$lib/stores/uuid';
|
import { uuid } from "$lib/stores/uuid";
|
||||||
import type { Unsubscriber } from 'svelte/store';
|
import type { Unsubscriber } from "svelte/store";
|
||||||
|
|
||||||
function getUrlString(): string {
|
function getUrlString(): string {
|
||||||
if (dev) {
|
if (dev) {
|
||||||
const testUrl: string = 'http://localhost:8460';
|
const testUrl: string = "http://localhost:8460";
|
||||||
console.info('DEVMODE active, using testing URL: ', testUrl);
|
console.info("DEVMODE active, using testing URL: ", testUrl);
|
||||||
return testUrl;
|
return testUrl;
|
||||||
} else {
|
} else {
|
||||||
const currentUrl: string = `https://${window.location.host}`;
|
const currentUrl: string = `https://${window.location.host}`;
|
||||||
@ -14,18 +14,18 @@ function getUrlString(): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function apiGet(path: string): Promise<any> {
|
export async function apiGet(path: string): Promise<any> {
|
||||||
let uuidString: string = '';
|
let uuidString: string = "";
|
||||||
let unsubscribe: Unsubscriber;
|
let unsubscribe: Unsubscriber;
|
||||||
try {
|
try {
|
||||||
unsubscribe = uuid.subscribe((value) => {
|
unsubscribe = uuid.subscribe((value) => {
|
||||||
uuidString = value;
|
uuidString = value;
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error('Unable to read UUID');
|
throw new Error("Unable to read UUID");
|
||||||
}
|
}
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
uuid: uuidString
|
uuid: uuidString
|
||||||
}
|
}
|
||||||
@ -35,15 +35,15 @@ export async function apiGet(path: string): Promise<any> {
|
|||||||
const res = await fetch(getUrlString() + path, options);
|
const res = await fetch(getUrlString() + path, options);
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error('Network response not ok');
|
throw new Error("Network response not ok");
|
||||||
}
|
}
|
||||||
const contentType = res.headers.get('content-type');
|
const contentType = res.headers.get("content-type");
|
||||||
if (!contentType || !contentType.includes('application/json')) {
|
if (!contentType || !contentType.includes("application/json")) {
|
||||||
throw new Error('Invalid response. Require JSON.');
|
throw new Error("Invalid response. Require JSON.");
|
||||||
}
|
}
|
||||||
return await res.json();
|
return await res.json();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching data:', err);
|
console.error("Error fetching data:", err);
|
||||||
throw err;
|
throw err;
|
||||||
} finally {
|
} finally {
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { dev } from '$app/environment';
|
import { dev } from "$app/environment";
|
||||||
|
|
||||||
const testUrl: string = 'http://localhost:8460';
|
const testUrl: string = "http://localhost:8460";
|
||||||
const prodUrl: string = 'https://owlboard.info';
|
const prodUrl: string = "https://owlboard.info";
|
||||||
|
|
||||||
export function getApiUrl() {
|
export function getApiUrl() {
|
||||||
if (dev) {
|
if (dev) {
|
||||||
console.info('DEVMODE active, using testing URL: ', testUrl);
|
console.info("DEVMODE active, using testing URL: ", testUrl);
|
||||||
return testUrl;
|
return testUrl;
|
||||||
}
|
}
|
||||||
return prodUrl;
|
return prodUrl;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { writable, type Writable } from 'svelte/store';
|
import { writable, type Writable } from "svelte/store";
|
||||||
import { browser } from '$app/environment';
|
import { browser } from "$app/environment";
|
||||||
|
|
||||||
export const ql = writable(fromLocalStorage('ql', []));
|
export const ql = writable(fromLocalStorage("ql", []));
|
||||||
toLocalStorage(ql, 'ql');
|
toLocalStorage(ql, "ql");
|
||||||
|
|
||||||
function fromLocalStorage(storageKey: string, fallback: string[]): string[] {
|
function fromLocalStorage(storageKey: string, fallback: string[]): string[] {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
const storedValue = localStorage.getItem(storageKey);
|
const storedValue = localStorage.getItem(storageKey);
|
||||||
if (storedValue !== 'undefined' && storedValue !== null) {
|
if (storedValue !== "undefined" && storedValue !== null) {
|
||||||
return typeof fallback === 'object' ? JSON.parse(storedValue) : storedValue;
|
return typeof fallback === "object" ? JSON.parse(storedValue) : storedValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
@ -17,7 +17,7 @@ function fromLocalStorage(storageKey: string, fallback: string[]): string[] {
|
|||||||
function toLocalStorage(store: Writable<string[]>, storageKey: string) {
|
function toLocalStorage(store: Writable<string[]>, storageKey: string) {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
store.subscribe((value) => {
|
store.subscribe((value) => {
|
||||||
let storageValue = typeof value === 'object' ? JSON.stringify(value.sort()) : value;
|
let storageValue = typeof value === "object" ? JSON.stringify(value.sort()) : value;
|
||||||
|
|
||||||
localStorage.setItem(storageKey, storageValue);
|
localStorage.setItem(storageKey, storageValue);
|
||||||
});
|
});
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
export const tocs = new Map<string, string>([
|
export const tocs = new Map<string, string>([
|
||||||
['gw', 'Great Western Railway'],
|
["gw", "Great Western Railway"],
|
||||||
['sw', 'South Western Railway'],
|
["sw", "South Western Railway"],
|
||||||
['il', 'Island Line'],
|
["il", "Island Line"],
|
||||||
['nt', 'Northern'],
|
["nt", "Northern"],
|
||||||
['aw', 'Trafnidiaeth Cymru'],
|
["aw", "Trafnidiaeth Cymru"],
|
||||||
['cc', 'c2c'],
|
["cc", "c2c"],
|
||||||
['cs', 'Caledonian Sleeper'],
|
["cs", "Caledonian Sleeper"],
|
||||||
['ch', 'Chiltern Railways'],
|
["ch", "Chiltern Railways"],
|
||||||
['xc', 'CrossCountry'],
|
["xc", "CrossCountry"],
|
||||||
['em', 'East Midlands Railway'],
|
["em", "East Midlands Railway"],
|
||||||
['es', 'Eurostar'],
|
["es", "Eurostar"],
|
||||||
['ht', 'Hull Trains'],
|
["ht", "Hull Trains"],
|
||||||
['tl', 'Thameslink'],
|
["tl", "Thameslink"],
|
||||||
['gc', 'Grand Central'],
|
["gc", "Grand Central"],
|
||||||
['gx', 'Gatwick Express'],
|
["gx", "Gatwick Express"],
|
||||||
['hx', 'Heathrow Express'],
|
["hx", "Heathrow Express"],
|
||||||
['ls', 'Locomotive Services Limited'],
|
["ls", "Locomotive Services Limited"],
|
||||||
['me', 'Merseyrail'],
|
["me", "Merseyrail"],
|
||||||
['lr', 'Network Rail OTM'],
|
["lr", "Network Rail OTM"],
|
||||||
['xr', 'TfL Elizabeth Line'],
|
["xr", "TfL Elizabeth Line"],
|
||||||
['se', 'Southeastern'],
|
["se", "Southeastern"],
|
||||||
['sn', 'Southern'],
|
["sn", "Southern"],
|
||||||
['le', 'Greater Anglia'],
|
["le", "Greater Anglia"],
|
||||||
['ga', 'Greater Anglia'],
|
["ga", "Greater Anglia"],
|
||||||
['lm', 'West Midlands Railway (LM)'],
|
["lm", "West Midlands Railway (LM)"],
|
||||||
['sr', 'ScotRail'],
|
["sr", "ScotRail"],
|
||||||
['gn', 'Great Northern'],
|
["gn", "Great Northern"],
|
||||||
['lt', 'TfL London Underground'],
|
["lt", "TfL London Underground"],
|
||||||
['lo', 'TfL London Overground'],
|
["lo", "TfL London Overground"],
|
||||||
['sj', 'SuperTram (Sheffield)'],
|
["sj", "SuperTram (Sheffield)"],
|
||||||
['tp', 'TransPennine Express'],
|
["tp", "TransPennine Express"],
|
||||||
['vt', 'Avanti West Coast'],
|
["vt", "Avanti West Coast"],
|
||||||
['gr', 'LNER'],
|
["gr", "LNER"],
|
||||||
['wr', 'West Coast Railway'],
|
["wr", "West Coast Railway"],
|
||||||
['ty', 'Vintage Trains'],
|
["ty", "Vintage Trains"],
|
||||||
['tw', 'Nexus (Tyne & Wear Metro)'],
|
["tw", "Nexus (Tyne & Wear Metro)"],
|
||||||
['ld', 'Lumo'],
|
["ld", "Lumo"],
|
||||||
['so', 'Rail Adventure'],
|
["so", "Rail Adventure"],
|
||||||
['ln', 'Grand Union Trains'],
|
["ln", "Grand Union Trains"],
|
||||||
['zz', 'Freight/Charter Company'],
|
["zz", "Freight/Charter Company"],
|
||||||
['wm', 'West Midlands Railway (WM)'],
|
["wm", "West Midlands Railway (WM)"],
|
||||||
['uk', 'Unknown Operator']
|
["uk", "Unknown Operator"]
|
||||||
]);
|
]);
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from "svelte/store";
|
||||||
import { browser } from '$app/environment';
|
import { browser } from "$app/environment";
|
||||||
|
|
||||||
export const uuid = writable(fromLocalStorage('uuid', null));
|
export const uuid = writable(fromLocalStorage("uuid", null));
|
||||||
toLocalStorage(uuid, 'uuid');
|
toLocalStorage(uuid, "uuid");
|
||||||
|
|
||||||
function fromLocalStorage(storageKey, fallback) {
|
function fromLocalStorage(storageKey, fallback) {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
const storedValue = localStorage.getItem(storageKey);
|
const storedValue = localStorage.getItem(storageKey);
|
||||||
if (storedValue !== 'undefined') {
|
if (storedValue !== "undefined") {
|
||||||
return storedValue;
|
return storedValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
export const version: string = '2024.04.5';
|
export const version: string = "2024.04.5";
|
||||||
export const versionTag: string = '';
|
export const versionTag: string = "";
|
||||||
export const showWelcome: boolean = false;
|
export const showWelcome: boolean = false;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { writable, type Writable } from 'svelte/store';
|
import { writable, type Writable } from "svelte/store";
|
||||||
import { browser } from '$app/environment';
|
import { browser } from "$app/environment";
|
||||||
|
|
||||||
export const welcome = writable(fromLocalStorage('welcome', '0'));
|
export const welcome = writable(fromLocalStorage("welcome", "0"));
|
||||||
toLocalStorage(welcome, 'welcome');
|
toLocalStorage(welcome, "welcome");
|
||||||
|
|
||||||
function fromLocalStorage(storageKey: string, fallback: string) {
|
function fromLocalStorage(storageKey: string, fallback: string) {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
const storedValue = localStorage.getItem(storageKey);
|
const storedValue = localStorage.getItem(storageKey);
|
||||||
if (storedValue !== 'undefined') {
|
if (storedValue !== "undefined") {
|
||||||
return storedValue;
|
return storedValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { OB_Pis_SimpleObject } from '@owlboard/ts-types';
|
import type { OB_Pis_SimpleObject } from "@owlboard/ts-types";
|
||||||
|
|
||||||
export let pisObject: OB_Pis_SimpleObject;
|
export let pisObject: OB_Pis_SimpleObject;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if pisObject}
|
{#if pisObject}
|
||||||
{#if typeof pisObject === 'string' || typeof pisObject === 'number'}
|
{#if typeof pisObject === "string" || typeof pisObject === "number"}
|
||||||
<span class="pis">PIS: {pisObject}</span>
|
<span class="pis">PIS: {pisObject}</span>
|
||||||
{:else if pisObject['skipCount'] === 0}
|
{:else if pisObject["skipCount"] === 0}
|
||||||
<span class="pis">PIS: {pisObject.code}</span>
|
<span class="pis">PIS: {pisObject.code}</span>
|
||||||
{:else if pisObject['skipCount'] > 0}
|
{:else if pisObject["skipCount"] > 0}
|
||||||
<span class="pis">PIS: {pisObject.code}</span>
|
<span class="pis">PIS: {pisObject.code}</span>
|
||||||
<br />
|
<br />
|
||||||
<span class="pis-text"
|
<span class="pis-text"
|
||||||
>(skip {pisObject.skipType}{#if pisObject.skipCount > 1} {' ' + pisObject.skipCount} stops{:else} stop{/if})</span
|
>(skip {pisObject.skipType}{#if pisObject.skipCount > 1} {" " + pisObject.skipCount} stops{:else} stop{/if})</span
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
export let toc: string;
|
export let toc: string;
|
||||||
export let full: boolean = false;
|
export let full: boolean = false;
|
||||||
|
|
||||||
import { tocs as map } from '$lib/stores/tocMap';
|
import { tocs as map } from "$lib/stores/tocMap";
|
||||||
|
|
||||||
let text: string;
|
let text: string;
|
||||||
|
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { fly } from 'svelte/transition';
|
import { fly } from "svelte/transition";
|
||||||
import { uuid } from '$lib/stores/uuid';
|
import { uuid } from "$lib/stores/uuid";
|
||||||
import LoadingText from '$lib/navigation/loading-text.svelte';
|
import LoadingText from "$lib/navigation/loading-text.svelte";
|
||||||
import StylesToc from './styles-toc.svelte';
|
import StylesToc from "./styles-toc.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
import PisHandler from '$lib/train/pis-handler.svelte';
|
import PisHandler from "$lib/train/pis-handler.svelte";
|
||||||
|
|
||||||
import type { OB_TrainTT_service } from '@owlboard/ts-types';
|
import type { OB_TrainTT_service } from "@owlboard/ts-types";
|
||||||
import TrainIcons from './trainIcons.svelte';
|
import TrainIcons from "./trainIcons.svelte";
|
||||||
|
|
||||||
export let service: OB_TrainTT_service;
|
export let service: OB_TrainTT_service;
|
||||||
|
|
||||||
let isExpanded = false;
|
let isExpanded = false;
|
||||||
|
|
||||||
async function getTrainByUID(tuid = '') {
|
async function getTrainByUID(tuid = "") {
|
||||||
const url = `${getApiUrl()}/api/v2/timetable/train/now/byTrainUid/${tuid}`;
|
const url = `${getApiUrl()}/api/v2/timetable/train/now/byTrainUid/${tuid}`;
|
||||||
const options = {
|
const options = {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
uuid: $uuid
|
uuid: $uuid
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@
|
|||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
return await res.json();
|
return await res.json();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unable to Fetch');
|
throw new Error("Unable to Fetch");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,9 +37,9 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="container-header" on:click={expand} on:keypress={expand}>
|
<div class="container-header" on:click={expand} on:keypress={expand}>
|
||||||
<span class="header"
|
<span class="header"
|
||||||
><StylesToc toc={service?.operator || ''} />
|
><StylesToc toc={service?.operator || ""} />
|
||||||
{service?.stops[0]['publicDeparture'] || service?.stops[0]['wttDeparture']}
|
{service?.stops[0]["publicDeparture"] || service?.stops[0]["wttDeparture"]}
|
||||||
{service?.stops[0]['tiploc']} to {service?.stops[service['stops'].length - 1]['tiploc']}</span
|
{service?.stops[0]["tiploc"]} to {service?.stops[service["stops"].length - 1]["tiploc"]}</span
|
||||||
>
|
>
|
||||||
<span id="container-arrow" class:isExpanded>V</span>
|
<span id="container-arrow" class:isExpanded>V</span>
|
||||||
</div>
|
</div>
|
||||||
@ -48,28 +48,28 @@
|
|||||||
{#await getTrainByUID(service.trainUid)}
|
{#await getTrainByUID(service.trainUid)}
|
||||||
<LoadingText />
|
<LoadingText />
|
||||||
{:then serviceDetail}
|
{:then serviceDetail}
|
||||||
{#if serviceDetail.stpIndicator === 'C'}
|
{#if serviceDetail.stpIndicator === "C"}
|
||||||
<p class="text-message">This has been removed from the timetable for today.</p>
|
<p class="text-message">This has been removed from the timetable for today.</p>
|
||||||
<p class="text-message">The service may have been retimed, re-routed or removed from todays timetable completely.</p>
|
<p class="text-message">The service may have been retimed, re-routed or removed from todays timetable completely.</p>
|
||||||
<p class="text-message">If it has been retimed or re-routed, there is likely to be another service with the same headcode booked to run.</p>
|
<p class="text-message">If it has been retimed or re-routed, there is likely to be another service with the same headcode booked to run.</p>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="detailOperator"><StylesToc toc={service?.operator || ''} full={true} /></div>
|
<div class="detailOperator"><StylesToc toc={service?.operator || ""} full={true} /></div>
|
||||||
|
|
||||||
<TrainIcons serviceDetails={serviceDetail.serviceDetail} />
|
<TrainIcons serviceDetails={serviceDetail.serviceDetail} />
|
||||||
{#if serviceDetail.pis}
|
{#if serviceDetail.pis}
|
||||||
<PisHandler pisObject={serviceDetail.pis} />
|
<PisHandler pisObject={serviceDetail.pis} />
|
||||||
{/if}
|
{/if}
|
||||||
<p class="svc-detail">
|
<p class="svc-detail">
|
||||||
Planned Type: {parseInt(serviceDetail.planSpeed) || '--'}mph {serviceDetail.powerType || 'Non-Rail vehicle'}
|
Planned Type: {parseInt(serviceDetail.planSpeed) || "--"}mph {serviceDetail.powerType || "Non-Rail vehicle"}
|
||||||
</p>
|
</p>
|
||||||
<p class="svc-detail">
|
<p class="svc-detail">
|
||||||
Days Run: {serviceDetail?.daysRun.join(', ').toUpperCase() || 'Unknown'}
|
Days Run: {serviceDetail?.daysRun.join(", ").toUpperCase() || "Unknown"}
|
||||||
</p>
|
</p>
|
||||||
<p class="svc-detail validity">
|
<p class="svc-detail validity">
|
||||||
Valid From: {new Date(serviceDetail.scheduleStart).toLocaleDateString('en-GB', {
|
Valid From: {new Date(serviceDetail.scheduleStart).toLocaleDateString("en-GB", {
|
||||||
timeZone: 'UTC'
|
timeZone: "UTC"
|
||||||
})} - {new Date(serviceDetail.scheduleEnd).toLocaleDateString('en-GB', {
|
})} - {new Date(serviceDetail.scheduleEnd).toLocaleDateString("en-GB", {
|
||||||
timeZone: 'UTC'
|
timeZone: "UTC"
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
<table>
|
<table>
|
||||||
@ -84,19 +84,19 @@
|
|||||||
<tr>
|
<tr>
|
||||||
{#if stop.publicArrival || stop.publicDeparture}
|
{#if stop.publicArrival || stop.publicDeparture}
|
||||||
<td>{stop.tiploc}</td>
|
<td>{stop.tiploc}</td>
|
||||||
<td>{stop.platform || '-'}</td>
|
<td>{stop.platform || "-"}</td>
|
||||||
<td>{stop.publicArrival || '-'}</td>
|
<td>{stop.publicArrival || "-"}</td>
|
||||||
<td>{stop.publicDeparture || '-'}</td>
|
<td>{stop.publicDeparture || "-"}</td>
|
||||||
{:else if stop.wttArrival || stop.wttDeparture}
|
{:else if stop.wttArrival || stop.wttDeparture}
|
||||||
<td class="wtt">{stop.tiploc}</td>
|
<td class="wtt">{stop.tiploc}</td>
|
||||||
<td class="wtt">{stop.platform || stop.depLine || stop.arrLine || '-'}</td>
|
<td class="wtt">{stop.platform || stop.depLine || stop.arrLine || "-"}</td>
|
||||||
<td class="wtt">{stop.wttArrival || '-'}</td>
|
<td class="wtt">{stop.wttArrival || "-"}</td>
|
||||||
<td class="wtt">{stop.wttDeparture || '-'}</td>
|
<td class="wtt">{stop.wttDeparture || "-"}</td>
|
||||||
{:else}
|
{:else}
|
||||||
<td class="pass">{stop.tiploc}</td>
|
<td class="pass">{stop.tiploc}</td>
|
||||||
<td class="pass">{stop.platform || stop.depLine || stop.arrLine || '-'}</td>
|
<td class="pass">{stop.platform || stop.depLine || stop.arrLine || "-"}</td>
|
||||||
<td class="pass">-</td>
|
<td class="pass">-</td>
|
||||||
<td class="pass">{stop.pass || '-'}</td>
|
<td class="pass">{stop.pass || "-"}</td>
|
||||||
{/if}
|
{/if}
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Tooltip from '$lib/Tooltip.svelte';
|
import Tooltip from "$lib/Tooltip.svelte";
|
||||||
import type { ServiceDetail } from '@owlboard/ts-types';
|
import type { ServiceDetail } from "@owlboard/ts-types";
|
||||||
import { IconBed, IconSquare1, IconSquareLetterV, IconToolsKitchen2 } from '@tabler/icons-svelte';
|
import { IconBed, IconSquare1, IconSquareLetterV, IconToolsKitchen2 } from "@tabler/icons-svelte";
|
||||||
|
|
||||||
export let serviceDetails: ServiceDetail;
|
export let serviceDetails: ServiceDetail;
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { page } from '$app/stores';
|
import { page } from "$app/stores";
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
const title = 'OwlBoard - Error';
|
const title = "OwlBoard - Error";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import '$lib/themes.css';
|
import "$lib/themes.css";
|
||||||
import '$lib/main.css';
|
import "$lib/main.css";
|
||||||
import { dev } from '$app/environment';
|
import { dev } from "$app/environment";
|
||||||
import DevBanner from '$lib/DevBanner.svelte';
|
import DevBanner from "$lib/DevBanner.svelte";
|
||||||
import { page } from '$app/stores';
|
import { page } from "$app/stores";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import InputIsland from '$lib/islands/input-island-form.svelte';
|
import InputIsland from "$lib/islands/input-island-form.svelte";
|
||||||
import QuickLinkIsland from '$lib/islands/quick-link-island.svelte';
|
import QuickLinkIsland from "$lib/islands/quick-link-island.svelte";
|
||||||
import Welcome from '$lib/overlays/welcome.svelte';
|
import Welcome from "$lib/overlays/welcome.svelte";
|
||||||
import { welcome } from '$lib/stores/welcome';
|
import { welcome } from "$lib/stores/welcome";
|
||||||
import { version, showWelcome } from '$lib/stores/version';
|
import { version, showWelcome } from "$lib/stores/version";
|
||||||
|
|
||||||
const title = 'OwlBoard';
|
const title = "OwlBoard";
|
||||||
const inputIslands = [
|
const inputIslands = [
|
||||||
{
|
{
|
||||||
title: 'Live Departure Boards',
|
title: "Live Departure Boards",
|
||||||
action: '/ldb',
|
action: "/ldb",
|
||||||
placeholder: 'Enter CRS/TIPLOC',
|
placeholder: "Enter CRS/TIPLOC",
|
||||||
queryName: 'station'
|
queryName: "station"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Train Details & PIS',
|
title: "Train Details & PIS",
|
||||||
action: '/train',
|
action: "/train",
|
||||||
placeholder: 'Enter Headcode',
|
placeholder: "Enter Headcode",
|
||||||
queryName: 'headcode'
|
queryName: "headcode"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if showWelcome && ($welcome === 'null' || !$welcome || parseInt($welcome.replace(/\./g, '')) < parseInt(version.replace(/\./g, '')))}
|
{#if showWelcome && ($welcome === "null" || !$welcome || parseInt($welcome.replace(/\./g, "")) < parseInt(version.replace(/\./g, "")))}
|
||||||
<Welcome />
|
<Welcome />
|
||||||
{/if}
|
{/if}
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
|
|
||||||
const title = '404 - Not Found';
|
const title = "404 - Not Found";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
|
|
||||||
const title = '50x - Server Error';
|
const title = "50x - Server Error";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav-ldb.svelte';
|
import Nav from "$lib/navigation/nav-ldb.svelte";
|
||||||
import PublicLdb from '$lib/ldb/public-ldb.svelte';
|
import PublicLdb from "$lib/ldb/public-ldb.svelte";
|
||||||
import StaffLdb from '$lib/ldb/staff/staff-ldb.svelte';
|
import StaffLdb from "$lib/ldb/staff/staff-ldb.svelte";
|
||||||
import { uuid } from '$lib/stores/uuid.js';
|
import { uuid } from "$lib/stores/uuid.js";
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
let title = 'Loading';
|
let title = "Loading";
|
||||||
|
|
||||||
async function getHeadcode() {
|
async function getHeadcode() {
|
||||||
return new URLSearchParams(window.location.search).get('station');
|
return new URLSearchParams(window.location.search).get("station");
|
||||||
}
|
}
|
||||||
|
|
||||||
let station = '';
|
let station = "";
|
||||||
let staff = false;
|
let staff = false;
|
||||||
let uuidValue = '';
|
let uuidValue = "";
|
||||||
|
|
||||||
$: uuidValue = $uuid;
|
$: uuidValue = $uuid;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
station = (await getHeadcode()) || '';
|
station = (await getHeadcode()) || "";
|
||||||
if (uuidValue !== null && uuidValue !== '' && uuidValue !== 'null') {
|
if (uuidValue !== null && uuidValue !== "" && uuidValue !== "null") {
|
||||||
staff = true;
|
staff = true;
|
||||||
title = 'Staff Board';
|
title = "Staff Board";
|
||||||
} else {
|
} else {
|
||||||
title = 'Public Board';
|
title = "Public Board";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,20 +1,32 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import { IconCode, IconHelp, IconInfoCircle, IconLocation, IconMessageCode, IconNumber, IconSettings, IconSpy, IconUser, IconUserPlus, IconVersions } from '@tabler/icons-svelte';
|
import {
|
||||||
const title = 'More';
|
IconCode,
|
||||||
|
IconHelp,
|
||||||
|
IconInfoCircle,
|
||||||
|
IconLocation,
|
||||||
|
IconMessageCode,
|
||||||
|
IconNumber,
|
||||||
|
IconSettings,
|
||||||
|
IconSpy,
|
||||||
|
IconUser,
|
||||||
|
IconUserPlus,
|
||||||
|
IconVersions
|
||||||
|
} from "@tabler/icons-svelte";
|
||||||
|
const title = "More";
|
||||||
|
|
||||||
const links = [
|
const links = [
|
||||||
{ title: 'Your Data', path: '/more/data', icon: IconUser },
|
{ title: "Your Data", path: "/more/data", icon: IconUser },
|
||||||
{ title: 'Registration', path: '/more/reg', icon: IconUserPlus },
|
{ title: "Registration", path: "/more/reg", icon: IconUserPlus },
|
||||||
{ title: 'Settings', path: '/more/settings', icon: IconSettings },
|
{ title: "Settings", path: "/more/settings", icon: IconSettings },
|
||||||
{ title: 'Help', path: '/more/help', icon: IconHelp },
|
{ title: "Help", path: "/more/help", icon: IconHelp },
|
||||||
{ title: 'About', path: '/more/about', icon: IconInfoCircle },
|
{ title: "About", path: "/more/about", icon: IconInfoCircle },
|
||||||
{ title: 'Location Reference Code Lookup', path: '/more/corpus', icon: IconLocation },
|
{ title: "Location Reference Code Lookup", path: "/more/corpus", icon: IconLocation },
|
||||||
{ title: 'Reason Code Lookup', path: '/more/reasons', icon: IconMessageCode },
|
{ title: "Reason Code Lookup", path: "/more/reasons", icon: IconMessageCode },
|
||||||
{ title: 'Privacy Policy', path: '/more/privacy', icon: IconSpy },
|
{ title: "Privacy Policy", path: "/more/privacy", icon: IconSpy },
|
||||||
{ title: 'Component Versions', path: '/more/versions', icon: IconVersions },
|
{ title: "Component Versions", path: "/more/versions", icon: IconVersions },
|
||||||
{ title: 'Statistics', path: '/more/statistics', icon: IconNumber }
|
{ title: "Statistics", path: "/more/statistics", icon: IconNumber }
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import LargeLogo from '$lib/images/large-logo.svelte';
|
import LargeLogo from "$lib/images/large-logo.svelte";
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
|
|
||||||
const title = 'About';
|
const title = "About";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
const title = 'Location Codes';
|
const title = "Location Codes";
|
||||||
|
|
||||||
let val = {
|
let val = {
|
||||||
crs: '',
|
crs: "",
|
||||||
tiploc: '',
|
tiploc: "",
|
||||||
stanox: '',
|
stanox: "",
|
||||||
nlc: '',
|
nlc: "",
|
||||||
name: '',
|
name: "",
|
||||||
uic: ''
|
uic: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
|
|
||||||
async function getData(type = '', value = '') {
|
async function getData(type = "", value = "") {
|
||||||
const url = `${getApiUrl()}/api/v2/ref/locationCode/${type}/${value}`;
|
const url = `${getApiUrl()}/api/v2/ref/locationCode/${type}/${value}`;
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
@ -26,16 +26,16 @@
|
|||||||
|
|
||||||
async function processData(data) {
|
async function processData(data) {
|
||||||
//console.log("data",JSON.stringify(data))
|
//console.log("data",JSON.stringify(data))
|
||||||
if (data.ERROR == 'Offline') {
|
if (data.ERROR == "Offline") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
val = {
|
val = {
|
||||||
crs: data[0]['3ALPHA'] || 'None',
|
crs: data[0]["3ALPHA"] || "None",
|
||||||
tiploc: data[0]['TIPLOC'] || 'None',
|
tiploc: data[0]["TIPLOC"] || "None",
|
||||||
stanox: data[0]['STANOX'] || 'None',
|
stanox: data[0]["STANOX"] || "None",
|
||||||
nlc: data[0]['NLC'] || 'None',
|
nlc: data[0]["NLC"] || "None",
|
||||||
name: data[0]['NLCDESC'] || 'None',
|
name: data[0]["NLCDESC"] || "None",
|
||||||
uic: data[0]['UIC'] || 'None'
|
uic: data[0]["UIC"] || "None"
|
||||||
};
|
};
|
||||||
//console.log("val",JSON.stringify(val));
|
//console.log("val",JSON.stringify(val));
|
||||||
}
|
}
|
||||||
@ -44,13 +44,13 @@
|
|||||||
isLoading = true;
|
isLoading = true;
|
||||||
let data = [];
|
let data = [];
|
||||||
if (val?.crs) {
|
if (val?.crs) {
|
||||||
data = await getData('crs', val.crs);
|
data = await getData("crs", val.crs);
|
||||||
} else if (val?.tiploc) {
|
} else if (val?.tiploc) {
|
||||||
data = await getData('tiploc', val.tiploc);
|
data = await getData("tiploc", val.tiploc);
|
||||||
} else if (val?.stanox) {
|
} else if (val?.stanox) {
|
||||||
data = await getData('stanox', val.stanox);
|
data = await getData("stanox", val.stanox);
|
||||||
} else if (val?.nlc) {
|
} else if (val?.nlc) {
|
||||||
data = await getData('nlc', val.nlc);
|
data = await getData("nlc", val.nlc);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -59,12 +59,12 @@
|
|||||||
|
|
||||||
async function reset() {
|
async function reset() {
|
||||||
val = {
|
val = {
|
||||||
crs: '',
|
crs: "",
|
||||||
tiploc: '',
|
tiploc: "",
|
||||||
stanox: '',
|
stanox: "",
|
||||||
nlc: '',
|
nlc: "",
|
||||||
name: '',
|
name: "",
|
||||||
uic: ''
|
uic: ""
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
<script>
|
<script>
|
||||||
import LogoutButton from '$lib/navigation/LogoutButton.svelte';
|
import LogoutButton from "$lib/navigation/LogoutButton.svelte";
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
import { uuid } from '$lib/stores/uuid.js';
|
import { uuid } from "$lib/stores/uuid.js";
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from "svelte";
|
||||||
const title = 'Your Data';
|
const title = "Your Data";
|
||||||
|
|
||||||
let data = [
|
let data = [
|
||||||
{
|
{
|
||||||
domain: 'User not Found',
|
domain: "User not Found",
|
||||||
atime: 'User not Found'
|
atime: "User not Found"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
if ($uuid != 'null') {
|
if ($uuid != "null") {
|
||||||
const url = `${getApiUrl()}/api/v2/user/${$uuid}`;
|
const url = `${getApiUrl()}/api/v2/user/${$uuid}`;
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
const json = await res.json();
|
const json = await res.json();
|
||||||
@ -44,13 +44,13 @@
|
|||||||
|
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
<Loading />
|
<Loading />
|
||||||
{:else if data[0].domain != 'User not Found'}
|
{:else if data[0].domain != "User not Found"}
|
||||||
<p class="api_response">Registration Domain: {data[0]['domain']}</p>
|
<p class="api_response">Registration Domain: {data[0]["domain"]}</p>
|
||||||
<p class="api_response">Access Time: {data[0]['atime']}</p>
|
<p class="api_response">Access Time: {data[0]["atime"]}</p>
|
||||||
<LogoutButton />
|
<LogoutButton />
|
||||||
<p>
|
<p>
|
||||||
Clicking the logout button will delete your data from your browser. You will then be able to make a new account, your old account will remain inactive and be deleted after 90
|
Clicking the logout button will delete your data from your browser. You will then be able to make a new account, your old account will remain inactive and be deleted after
|
||||||
days.
|
90 days.
|
||||||
</p>
|
</p>
|
||||||
{:else}
|
{:else}
|
||||||
<p class="api_response">You are not registered, we don't have any data stored.</p>
|
<p class="api_response">You are not registered, we don't have any data stored.</p>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header title={'Help'} />
|
<Header title={"Help"} />
|
||||||
<Nav />
|
<Nav />
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<p>
|
<p>
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
const title = 'Privacy Policy';
|
const title = "Privacy Policy";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
OwlBoard stores the minimum amount of data necessary to provide its functions for your use. No personal data is stored unless you report an issue. To review the specific data
|
OwlBoard stores the minimum amount of data necessary to provide its functions for your use. No personal data is stored unless you report an issue. To review the specific
|
||||||
that we store, please visit <a href="/more/data">My Data</a>.
|
data that we store, please visit <a href="/more/data">My Data</a>.
|
||||||
</p>
|
</p>
|
||||||
<p>OwlBoard does not utilize any cookies. IP addresses and browser fingerprints are not logged.</p>
|
<p>OwlBoard does not utilize any cookies. IP addresses and browser fingerprints are not logged.</p>
|
||||||
<h2>If You Do Not Sign Up</h2>
|
<h2>If You Do Not Sign Up</h2>
|
||||||
<p>
|
<p>
|
||||||
If you choose not to sign up, no personal data will be processed or stored unless you report an issue. Any personal settings are stored locally in your browser and do not leave
|
If you choose not to sign up, no personal data will be processed or stored unless you report an issue. Any personal settings are stored locally in your browser and do not
|
||||||
your device.
|
leave your device.
|
||||||
</p>
|
</p>
|
||||||
<h2>If You Sign Up</h2>
|
<h2>If You Sign Up</h2>
|
||||||
<p>
|
<p>
|
||||||
If you sign up for the rail staff version of OwlBoard, we do require the storage of some data. However, none of this data can be used to personally identify you. Any personal
|
If you sign up for the rail staff version of OwlBoard, we do require the storage of some data. However, none of this data can be used to personally identify you. Any
|
||||||
settings are stored locally in your browser and do not leave your device.
|
personal settings are stored locally in your browser and do not leave your device.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
During the sign-up process, you will be asked to provide a work email address, which will be checked to confirm its origin from a railway company. Once confirmed, an email
|
During the sign-up process, you will be asked to provide a work email address, which will be checked to confirm its origin from a railway company. Once confirmed, an email
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from "svelte";
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import ResultIsland from '$lib/islands/result-island.svelte';
|
import ResultIsland from "$lib/islands/result-island.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
|
|
||||||
const title = 'Reason Codes';
|
const title = "Reason Codes";
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
let inputValue = '';
|
let inputValue = "";
|
||||||
let resultObject = {
|
let resultObject = {
|
||||||
results: false,
|
results: false,
|
||||||
title: '',
|
title: "",
|
||||||
resultLines: []
|
resultLines: []
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -37,12 +37,12 @@
|
|||||||
async function handleData(data) {
|
async function handleData(data) {
|
||||||
let resultLines = [];
|
let resultLines = [];
|
||||||
if (data.length) {
|
if (data.length) {
|
||||||
resultObject.title = data[0]['code'];
|
resultObject.title = data[0]["code"];
|
||||||
resultLines = [data[0]['lateReason'], data[0]['cancReason']];
|
resultLines = [data[0]["lateReason"], data[0]["cancReason"]];
|
||||||
} else {
|
} else {
|
||||||
resultObject = {
|
resultObject = {
|
||||||
results: false,
|
results: false,
|
||||||
title: 'Not Found',
|
title: "Not Found",
|
||||||
resultLines: []
|
resultLines: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@
|
|||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
border: none;
|
border: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
box-shadow: var(--box-shadow);
|
box-shadow: var(--box-shadow);
|
||||||
@ -111,7 +111,7 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-family: urwgothic, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
font-family: urwgothic, "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
background-color: var(--island-bg-color);
|
background-color: var(--island-bg-color);
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from "svelte";
|
||||||
import { checkAuth } from '$lib/libauth';
|
import { checkAuth } from "$lib/libauth";
|
||||||
import LogoutButton from '$lib/navigation/LogoutButton.svelte';
|
import LogoutButton from "$lib/navigation/LogoutButton.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
|
|
||||||
const title = 'Register';
|
const title = "Register";
|
||||||
|
|
||||||
let state = 'unreg';
|
let state = "unreg";
|
||||||
let isLoading = true;
|
let isLoading = true;
|
||||||
let inputValue = '';
|
let inputValue = "";
|
||||||
|
|
||||||
function handleInput(event: KeyboardEvent) {
|
function handleInput(event: KeyboardEvent) {
|
||||||
inputValue = event?.target?.value;
|
inputValue = event?.target?.value;
|
||||||
@ -21,9 +21,9 @@
|
|||||||
isLoading = true;
|
isLoading = true;
|
||||||
const url = `${getApiUrl()}/api/v2/user/request`;
|
const url = `${getApiUrl()}/api/v2/user/request`;
|
||||||
const request = {
|
const request = {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
email: inputValue
|
email: inputValue
|
||||||
@ -31,11 +31,11 @@
|
|||||||
};
|
};
|
||||||
const res = await fetch(url, request);
|
const res = await fetch(url, request);
|
||||||
if (res.status == 400 || res.status == 403) {
|
if (res.status == 400 || res.status == 403) {
|
||||||
state = 'unauth';
|
state = "unauth";
|
||||||
} else if (res.status == 201) {
|
} else if (res.status == 201) {
|
||||||
state = 'sent';
|
state = "sent";
|
||||||
} else {
|
} else {
|
||||||
state = 'error';
|
state = "error";
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
@ -43,9 +43,9 @@
|
|||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const auth = await checkAuth();
|
const auth = await checkAuth();
|
||||||
if (auth.uuidPresent === false) {
|
if (auth.uuidPresent === false) {
|
||||||
state = 'unreg';
|
state = "unreg";
|
||||||
} else if (auth.uuidPresent === true) {
|
} else if (auth.uuidPresent === true) {
|
||||||
state = 'reg';
|
state = "reg";
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
@ -56,7 +56,7 @@
|
|||||||
<section class="content">
|
<section class="content">
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
<Loading />
|
<Loading />
|
||||||
{:else if state == 'unreg'}
|
{:else if state == "unreg"}
|
||||||
<p>To register, you will need to enter a work email address to receive a confirmation email</p>
|
<p>To register, you will need to enter a work email address to receive a confirmation email</p>
|
||||||
<p class="bold">Already have a registration code? <a href="/more/reg/submit">enter it here</a></p>
|
<p class="bold">Already have a registration code? <a href="/more/reg/submit">enter it here</a></p>
|
||||||
<form on:submit={request}>
|
<form on:submit={request}>
|
||||||
@ -75,21 +75,21 @@
|
|||||||
<li>Non-Public trains on departure boards</li>
|
<li>Non-Public trains on departure boards</li>
|
||||||
<li>Hidden platform numbers on departure boards</li>
|
<li>Hidden platform numbers on departure boards</li>
|
||||||
<li>See up to the next 40 trains departing a station over the next two hours</li>
|
<li>See up to the next 40 trains departing a station over the next two hours</li>
|
||||||
{:else if state == 'sent'}
|
{:else if state == "sent"}
|
||||||
<p>An email has been sent, enter the code in the email to activate your profile.</p>
|
<p>An email has been sent, enter the code in the email to activate your profile.</p>
|
||||||
<p class="bold"><a href="/more/reg/submit">Ready to enter your code?</a></p>
|
<p class="bold"><a href="/more/reg/submit">Ready to enter your code?</a></p>
|
||||||
<p>If you use multiple browsers, you will only be logged in using the browser you open the link with.</p>
|
<p>If you use multiple browsers, you will only be logged in using the browser you open the link with.</p>
|
||||||
<p>You will be able to register again using the same email address</p>
|
<p>You will be able to register again using the same email address</p>
|
||||||
{:else if state == 'unauth'}
|
{:else if state == "unauth"}
|
||||||
<p>The email address you entered does not belong to an authorised business.</p>
|
<p>The email address you entered does not belong to an authorised business.</p>
|
||||||
<p>If you think this is an error, you can get help on <a href="/more/help">the help page</a>.</p>
|
<p>If you think this is an error, you can get help on <a href="/more/help">the help page</a>.</p>
|
||||||
{:else if state == 'error'}
|
{:else if state == "error"}
|
||||||
<p>There was an error processing your request.</p>
|
<p>There was an error processing your request.</p>
|
||||||
<p>Check that the email you entered was correct or try again later.</p>
|
<p>Check that the email you entered was correct or try again later.</p>
|
||||||
{:else if state == 'reg'}
|
{:else if state == "reg"}
|
||||||
<p>
|
<p>
|
||||||
You are already registered for OwlBoard. If you've recently logged out or updated, you may need to refresh this page to register as old data could still be stored in your
|
You are already registered for OwlBoard. If you've recently logged out or updated, you may need to refresh this page to register as old data could still be stored in
|
||||||
browser.
|
your browser.
|
||||||
</p>
|
</p>
|
||||||
<LogoutButton />
|
<LogoutButton />
|
||||||
{/if}
|
{/if}
|
||||||
@ -121,7 +121,7 @@
|
|||||||
height: 40px;
|
height: 40px;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
max-width: 375px;
|
max-width: 375px;
|
||||||
font-family: urwgothic, 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
|
font-family: urwgothic, "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
import { uuid } from '$lib/stores/uuid';
|
import { uuid } from "$lib/stores/uuid";
|
||||||
|
|
||||||
const title = 'Submit Registration';
|
const title = "Submit Registration";
|
||||||
let state = false;
|
let state = false;
|
||||||
let status: string;
|
let status: string;
|
||||||
|
|
||||||
let inputs: { id: string; value: string }[] = [
|
let inputs: { id: string; value: string }[] = [
|
||||||
{ id: '1', value: '' },
|
{ id: "1", value: "" },
|
||||||
{ id: '2', value: '' },
|
{ id: "2", value: "" },
|
||||||
{ id: '3', value: '' },
|
{ id: "3", value: "" },
|
||||||
{ id: '4', value: '' },
|
{ id: "4", value: "" },
|
||||||
{ id: '5', value: '' },
|
{ id: "5", value: "" },
|
||||||
{ id: '6', value: '' }
|
{ id: "6", value: "" }
|
||||||
];
|
];
|
||||||
|
|
||||||
function handleInput(index: number, event: KeyboardEvent): void {
|
function handleInput(index: number, event: KeyboardEvent): void {
|
||||||
if (event.key === 'Backspace' && index > 0 && inputs[index].value === '') {
|
if (event.key === "Backspace" && index > 0 && inputs[index].value === "") {
|
||||||
const prevInput = document.getElementById(`input-${index}`);
|
const prevInput = document.getElementById(`input-${index}`);
|
||||||
if (prevInput) {
|
if (prevInput) {
|
||||||
prevInput.focus();
|
prevInput.focus();
|
||||||
@ -32,7 +32,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
let submitString: string = '';
|
let submitString: string = "";
|
||||||
for (const input of inputs) {
|
for (const input of inputs) {
|
||||||
submitString += input.value.toUpperCase();
|
submitString += input.value.toUpperCase();
|
||||||
}
|
}
|
||||||
@ -40,11 +40,11 @@
|
|||||||
const res = await submit(submitString);
|
const res = await submit(submitString);
|
||||||
console.log(`Registration Status: ${res}`);
|
console.log(`Registration Status: ${res}`);
|
||||||
if (res == 201) {
|
if (res == 201) {
|
||||||
status = 'okay';
|
status = "okay";
|
||||||
} else if (res == 401) {
|
} else if (res == 401) {
|
||||||
status = 'fail';
|
status = "fail";
|
||||||
} else {
|
} else {
|
||||||
console.error('Unable to register: ', status);
|
console.error("Unable to register: ", status);
|
||||||
}
|
}
|
||||||
state = true;
|
state = true;
|
||||||
}
|
}
|
||||||
@ -52,9 +52,9 @@
|
|||||||
async function submit(id: string): Promise<number> {
|
async function submit(id: string): Promise<number> {
|
||||||
const url = `${getApiUrl()}/api/v2/user/register`;
|
const url = `${getApiUrl()}/api/v2/user/register`;
|
||||||
const request = {
|
const request = {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
uuid: id
|
uuid: id
|
||||||
@ -74,11 +74,11 @@
|
|||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
|
||||||
{#if state}
|
{#if state}
|
||||||
{#if status == 'okay'}
|
{#if status == "okay"}
|
||||||
<p class="title-ish">You are now registered</p>
|
<p class="title-ish">You are now registered</p>
|
||||||
<p>Your secret key will be stored in your browser.</p>
|
<p>Your secret key will be stored in your browser.</p>
|
||||||
<p>If you change browsers, change device or clear your browsing data, you may have to register again.</p>
|
<p>If you change browsers, change device or clear your browsing data, you may have to register again.</p>
|
||||||
{:else if status == 'fail'}
|
{:else if status == "fail"}
|
||||||
<p class="title-ish">Your code was not accepted</p>
|
<p class="title-ish">Your code was not accepted</p>
|
||||||
<p>The code expires after 1 hour, you can check the code and enter it again or request a <a href="/more/reg">new code</a>.</p>
|
<p>The code expires after 1 hour, you can check the code and enter it again or request a <a href="/more/reg">new code</a>.</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from "$lib/islands/island.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from "svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import Done from '$lib/navigation/done.svelte';
|
import Done from "$lib/navigation/done.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
|
|
||||||
const title = 'Report Issue';
|
const title = "Report Issue";
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
let isDone = false;
|
let isDone = false;
|
||||||
let isError = false;
|
let isError = false;
|
||||||
|
|
||||||
let reportType = '',
|
let reportType = "",
|
||||||
reportSubject = '',
|
reportSubject = "",
|
||||||
reportMsg = '',
|
reportMsg = "",
|
||||||
reportCollected;
|
reportCollected;
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
reportCollected = {
|
reportCollected = {
|
||||||
@ -34,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function send() {
|
async function send() {
|
||||||
console.log('SEND DATA REQUESTED');
|
console.log("SEND DATA REQUESTED");
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
const formData = JSON.stringify({
|
const formData = JSON.stringify({
|
||||||
label: reportType,
|
label: reportType,
|
||||||
@ -50,9 +50,9 @@
|
|||||||
});
|
});
|
||||||
const url = `${getApiUrl()}/misc/issue`;
|
const url = `${getApiUrl()}/misc/issue`;
|
||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
body: formData
|
body: formData
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@
|
|||||||
isLoading = false;
|
isLoading = false;
|
||||||
isDone = true;
|
isDone = true;
|
||||||
await new Promise((r) => setTimeout(r, 2000));
|
await new Promise((r) => setTimeout(r, 2000));
|
||||||
window.location.href = '/';
|
window.location.href = "/";
|
||||||
} else {
|
} else {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
isError = true;
|
isError = true;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import QlSet from '$lib/islands/quick-link-set-island.svelte';
|
import QlSet from "$lib/islands/quick-link-set-island.svelte";
|
||||||
const title = 'Settings';
|
const title = "Settings";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header {title} />
|
<Header {title} />
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from "$lib/islands/island.svelte";
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
const title = 'Statistics';
|
const title = "Statistics";
|
||||||
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
const url = `${getApiUrl()}/misc/server/stats`;
|
const url = `${getApiUrl()}/misc/server/stats`;
|
||||||
@ -31,7 +31,7 @@
|
|||||||
<br />
|
<br />
|
||||||
<p>API Server:<br /><span>{data?.hostname}</span></p>
|
<p>API Server:<br /><span>{data?.hostname}</span></p>
|
||||||
<p>Runtime Mode: <span>{data?.runtimeMode}</span></p>
|
<p>Runtime Mode: <span>{data?.runtimeMode}</span></p>
|
||||||
<p>Stats Reset: <span>{U2L(data?.reset) || 'Unknown'}</span></p>
|
<p>Stats Reset: <span>{U2L(data?.reset) || "Unknown"}</span></p>
|
||||||
<h2>Last Update</h2>
|
<h2>Last Update</h2>
|
||||||
<p>Timetable: <span>{U2L(data?.updateTimes?.timetable)}</span></p>
|
<p>Timetable: <span>{U2L(data?.updateTimes?.timetable)}</span></p>
|
||||||
<p>Location Ref: <span>{U2L(data?.updateTimes?.corpus)}</span></p>
|
<p>Location Ref: <span>{U2L(data?.updateTimes?.corpus)}</span></p>
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from "$lib/islands/island.svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import LargeLogo from '$lib/images/large-logo.svelte';
|
import LargeLogo from "$lib/images/large-logo.svelte";
|
||||||
import { version, versionTag } from '$lib/stores/version';
|
import { version, versionTag } from "$lib/stores/version";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
import { IconBrandGolang, IconBrandJavascript, IconBrandNodejs, IconBrandPython, IconBrandSvelte, IconBrandTypescript, IconFileTypeSql } from '@tabler/icons-svelte';
|
import { IconBrandGolang, IconBrandJavascript, IconBrandNodejs, IconBrandPython, IconBrandSvelte, IconBrandTypescript, IconFileTypeSql } from "@tabler/icons-svelte";
|
||||||
import Tooltip from '$lib/Tooltip.svelte';
|
import Tooltip from "$lib/Tooltip.svelte";
|
||||||
const title = 'Versions';
|
const title = "Versions";
|
||||||
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
const url = `${getApiUrl()}/misc/server/versions`;
|
const url = `${getApiUrl()}/misc/server/versions`;
|
||||||
@ -41,17 +41,19 @@
|
|||||||
<Tooltip text="Javascript"><IconBrandJavascript /></Tooltip>
|
<Tooltip text="Javascript"><IconBrandJavascript /></Tooltip>
|
||||||
<Tooltip text="Typescript"><IconBrandTypescript /></Tooltip>
|
<Tooltip text="Typescript"><IconBrandTypescript /></Tooltip>
|
||||||
<br />
|
<br />
|
||||||
<a class="data" href="https://git.fjla.uk/owlboard/backend" target="_blank">API Server version<br /><span class="data">{data?.backend || 'Unknown'}</span></a>
|
<a class="data" href="https://git.fjla.uk/owlboard/backend" target="_blank">API Server version<br /><span class="data">{data?.backend || "Unknown"}</span></a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<Tooltip text="Python"><IconBrandPython /></Tooltip>
|
<Tooltip text="Python"><IconBrandPython /></Tooltip>
|
||||||
<br />
|
<br />
|
||||||
<a class="data" href="https://git.fjla.uk/owlboard/db-manager" target="_blank">DB Manager version<br /><span class="data">{data?.['db-manager'] || 'Unknown'}</span></a>
|
<a class="data" href="https://git.fjla.uk/owlboard/db-manager" target="_blank">DB Manager version<br /><span class="data">{data?.["db-manager"] || "Unknown"}</span></a>
|
||||||
</p>
|
</p>
|
||||||
<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">MQ Client version<br /><span class="data">{data?.['mq-client'] || 'Not installed'}</span></a>
|
<a class="data" href="https://git.fjla.uk/owlboard/mq-client" target="_blank"
|
||||||
|
>MQ Client version<br /><span class="data">{data?.["mq-client"] || "Not installed"}</span></a
|
||||||
|
>
|
||||||
</p>
|
</p>
|
||||||
</Island>
|
</Island>
|
||||||
{:catch}
|
{:catch}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from "$lib/islands/island.svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import { uuid } from '$lib/stores/uuid';
|
import { uuid } from "$lib/stores/uuid";
|
||||||
import StylesToc from '$lib/train/styles-toc.svelte';
|
import StylesToc from "$lib/train/styles-toc.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
|
|
||||||
const title = 'PIS Finder';
|
const title = "PIS Finder";
|
||||||
const variables = { title: 'Results' };
|
const variables = { title: "Results" };
|
||||||
let entryPIS = '';
|
let entryPIS = "";
|
||||||
let entryStartCRS = '';
|
let entryStartCRS = "";
|
||||||
let entryEndCRS = '';
|
let entryEndCRS = "";
|
||||||
let data = [];
|
let data = [];
|
||||||
let error = false;
|
let error = false;
|
||||||
let errMsg = 'Unknown Error';
|
let errMsg = "Unknown Error";
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
|
|
||||||
async function findByStartEnd() {
|
async function findByStartEnd() {
|
||||||
@ -33,24 +33,24 @@
|
|||||||
|
|
||||||
async function fetchData(url) {
|
async function fetchData(url) {
|
||||||
const options = {
|
const options = {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
uuid: $uuid
|
uuid: $uuid
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const res = await fetch(url, options); // Enable Auth
|
const res = await fetch(url, options); // Enable Auth
|
||||||
if (res.status == 401) {
|
if (res.status == 401) {
|
||||||
errMsg = 'You must be logged in to the staff version';
|
errMsg = "You must be logged in to the staff version";
|
||||||
error = true;
|
error = true;
|
||||||
return false;
|
return false;
|
||||||
} else if (res.status == 500) {
|
} else if (res.status == 500) {
|
||||||
errMsg = 'Server Error, try again later';
|
errMsg = "Server Error, try again later";
|
||||||
error = true;
|
error = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const jsonData = await res.json();
|
const jsonData = await res.json();
|
||||||
if (jsonData.ERROR == 'offline') {
|
if (jsonData.ERROR == "offline") {
|
||||||
errMsg = 'Connection error, check your internet connection and try again';
|
errMsg = "Connection error, check your internet connection and try again";
|
||||||
error = true;
|
error = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -60,9 +60,9 @@
|
|||||||
async function reset() {
|
async function reset() {
|
||||||
data = [];
|
data = [];
|
||||||
error = false;
|
error = false;
|
||||||
entryPIS = '';
|
entryPIS = "";
|
||||||
entryStartCRS = '';
|
entryStartCRS = "";
|
||||||
entryEndCRS = '';
|
entryEndCRS = "";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -86,9 +86,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{#each data as item}
|
{#each data as item}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="toc toc-data"><StylesToc toc={item.toc || '-'} /></td>
|
<td class="toc toc-data"><StylesToc toc={item.toc || "-"} /></td>
|
||||||
<td class="code">{item.code}</td>
|
<td class="code">{item.code}</td>
|
||||||
<td class="stops stops-data">{item.stops.join(' ')}</td>
|
<td class="stops stops-data">{item.stops.join(" ")}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</table>
|
</table>
|
||||||
|
@ -1,52 +1,52 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Header from '$lib/navigation/header.svelte';
|
import Header from "$lib/navigation/header.svelte";
|
||||||
import Loading from '$lib/navigation/loading.svelte';
|
import Loading from "$lib/navigation/loading.svelte";
|
||||||
import Island from '$lib/islands/island.svelte';
|
import Island from "$lib/islands/island.svelte";
|
||||||
import Nav from '$lib/navigation/nav.svelte';
|
import Nav from "$lib/navigation/nav.svelte";
|
||||||
import { uuid } from '$lib/stores/uuid';
|
import { uuid } from "$lib/stores/uuid";
|
||||||
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from "svelte";
|
||||||
import TrainDetail from '$lib/train/train-detail.svelte';
|
import TrainDetail from "$lib/train/train-detail.svelte";
|
||||||
import { getApiUrl } from '$lib/scripts/upstream';
|
import { getApiUrl } from "$lib/scripts/upstream";
|
||||||
|
|
||||||
let title = 'Timetable Results';
|
let title = "Timetable Results";
|
||||||
let id = '';
|
let id = "";
|
||||||
let data = [];
|
let data = [];
|
||||||
let isLoading = true;
|
let isLoading = true;
|
||||||
let error = false;
|
let error = false;
|
||||||
let errMsg = '';
|
let errMsg = "";
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (id) {
|
if (id) {
|
||||||
title = id.toUpperCase();
|
title = id.toUpperCase();
|
||||||
} else {
|
} else {
|
||||||
title = 'Querying Timetable';
|
title = "Querying Timetable";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getHeadcode() {
|
async function getHeadcode() {
|
||||||
return new URLSearchParams(window.location.search).get('headcode');
|
return new URLSearchParams(window.location.search).get("headcode");
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
id = (await getHeadcode()) || '';
|
id = (await getHeadcode()) || "";
|
||||||
const res = await fetchData(id);
|
const res = await fetchData(id);
|
||||||
if (res) {
|
if (res) {
|
||||||
data = res;
|
data = res;
|
||||||
if (!data.length) {
|
if (!data.length) {
|
||||||
error = true;
|
error = true;
|
||||||
errMsg = 'No services found';
|
errMsg = "No services found";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
async function fetchData(id = '') {
|
async function fetchData(id = "") {
|
||||||
const date = 'now';
|
const date = "now";
|
||||||
const searchType = 'headcode';
|
const searchType = "headcode";
|
||||||
const options = {
|
const options = {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
uuid: $uuid
|
uuid: $uuid
|
||||||
}
|
}
|
||||||
@ -58,16 +58,16 @@
|
|||||||
return await res.json();
|
return await res.json();
|
||||||
} else if (res.status === 401) {
|
} else if (res.status === 401) {
|
||||||
error = true;
|
error = true;
|
||||||
errMsg = 'You must be logged into the staff version for this feature';
|
errMsg = "You must be logged into the staff version for this feature";
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
errMsg = 'Unable to connect, check your connection and try again';
|
errMsg = "Unable to connect, check your connection and try again";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = true;
|
error = true;
|
||||||
errMsg = 'Connection error, try again later';
|
errMsg = "Connection error, try again later";
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
/// <reference types="@sveltejs/kit" />
|
/// <reference types="@sveltejs/kit" />
|
||||||
|
|
||||||
import { build, files, version } from '$service-worker';
|
import { build, files, version } from "$service-worker";
|
||||||
|
|
||||||
const cacheName = `ob-${version}`;
|
const cacheName = `ob-${version}`;
|
||||||
const pointlessConstant = true;
|
const pointlessConstant = true;
|
||||||
console.log(`pointlessContant is ${pointlessConstant}`);
|
console.log(`pointlessContant is ${pointlessConstant}`);
|
||||||
|
|
||||||
const assets = [...build, ...files, '/service-worker.js'];
|
const assets = [...build, ...files, "/service-worker.js"];
|
||||||
|
|
||||||
self.addEventListener('install', (event) => {
|
self.addEventListener("install", (event) => {
|
||||||
async function addToCache() {
|
async function addToCache() {
|
||||||
const cache = await caches.open(cacheName);
|
const cache = await caches.open(cacheName);
|
||||||
await cache.addAll(assets);
|
await cache.addAll(assets);
|
||||||
@ -17,7 +17,7 @@ self.addEventListener('install', (event) => {
|
|||||||
event.waitUntil(addToCache());
|
event.waitUntil(addToCache());
|
||||||
});
|
});
|
||||||
|
|
||||||
self.addEventListener('activate', (event) => {
|
self.addEventListener("activate", (event) => {
|
||||||
async function deleteOldCache() {
|
async function deleteOldCache() {
|
||||||
for (const key of await caches.keys()) {
|
for (const key of await caches.keys()) {
|
||||||
if (key !== cacheName) {
|
if (key !== cacheName) {
|
||||||
@ -29,8 +29,8 @@ self.addEventListener('activate', (event) => {
|
|||||||
event.waitUntil(deleteOldCache());
|
event.waitUntil(deleteOldCache());
|
||||||
});
|
});
|
||||||
|
|
||||||
self.addEventListener('fetch', (event) => {
|
self.addEventListener("fetch", (event) => {
|
||||||
if (event.request.method !== 'GET') {
|
if (event.request.method !== "GET") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
async function respond() {
|
async function respond() {
|
||||||
@ -42,7 +42,7 @@ self.addEventListener('fetch', (event) => {
|
|||||||
try {
|
try {
|
||||||
return await fetch(event.request);
|
return await fetch(event.request);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return { error: 'OFFLINE', errorMsg: 'You are offline' };
|
return { error: "OFFLINE", errorMsg: "You are offline" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Remove the service worker /sw.js from legacy installations
|
// Remove the service worker /sw.js from legacy installations
|
||||||
// This should then enable the new /service-worker.js to be installed
|
// This should then enable the new /service-worker.js to be installed
|
||||||
|
|
||||||
self.addEventListener('activate', function (e) {
|
self.addEventListener("activate", function (e) {
|
||||||
console.log(`Unregistering service worker`);
|
console.log(`Unregistering service worker`);
|
||||||
self.registration
|
self.registration
|
||||||
.unregister()
|
.unregister()
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import adapter from '@sveltejs/adapter-static';
|
import adapter from "@sveltejs/adapter-static";
|
||||||
import { vitePreprocess } from '@sveltejs/kit/vite';
|
import { vitePreprocess } from "@sveltejs/kit/vite";
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
preprocess: vitePreprocess(),
|
preprocess: vitePreprocess(),
|
||||||
kit: {
|
kit: {
|
||||||
adapter: adapter({
|
adapter: adapter({
|
||||||
pages: 'build',
|
pages: "build",
|
||||||
assets: 'build',
|
assets: "build",
|
||||||
precompress: true,
|
precompress: true,
|
||||||
strict: true
|
strict: true
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { sveltekit } from '@sveltejs/kit/vite';
|
import { sveltekit } from "@sveltejs/kit/vite";
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from "vite";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [sveltekit()]
|
plugins: [sveltekit()]
|
||||||
|
Loading…
Reference in New Issue
Block a user