diff --git a/src/lib/islands/island.svelte b/src/lib/islands/island.svelte
index 098bb96..d036ab2 100644
--- a/src/lib/islands/island.svelte
+++ b/src/lib/islands/island.svelte
@@ -1,8 +1,10 @@
-
+
{variables.title}
diff --git a/src/lib/ldb/public-ldb.svelte b/src/lib/ldb/public-ldb.svelte
index bc26675..bd8f263 100644
--- a/src/lib/ldb/public-ldb.svelte
+++ b/src/lib/ldb/public-ldb.svelte
@@ -5,6 +5,7 @@
import Loading from '$lib/navigation/loading.svelte';
import OverlayIsland from '$lib/islands/overlay-island.svelte';
import AlertBar from '$lib/ldb/nrcc/alert-bar.svelte';
+ import Island from '$lib/islands/island.svelte';
let requestedStation;
$: requestedStation = station;
@@ -54,7 +55,7 @@
isLoading = true; // Set loading state
try {
console.log(`Requested Station: ${requestedStation}`);
- const data = await fetch(`https://owlboard.info/api/v1/ldb/${requestedStation}`);
+ const data = await fetch(`https://owlboard.info/api/v2/live/station/${requestedStation}/public`);
jsonData = await data.json();
} catch (error) {
console.error('Error fetching data:', error);
@@ -286,7 +287,9 @@
{/if}
{:else}
-
Unable to find this station
+
+ Unable to load data
+
{/if}
{#if serviceDetail}
diff --git a/src/lib/ldb/staff/staff-ldb.svelte b/src/lib/ldb/staff/staff-ldb.svelte
index ec65191..b920b0f 100644
--- a/src/lib/ldb/staff/staff-ldb.svelte
+++ b/src/lib/ldb/staff/staff-ldb.svelte
@@ -3,20 +3,26 @@
export let title = 'Loading...';
import { onMount } from 'svelte';
import AlertBar from '$lib/ldb/nrcc/alert-bar.svelte';
- import ServiceRow from './service-row.svelte';
+ //import ServiceRow from './service-row.svelte';
import StaffTrainDetail from '$lib/ldb/staff/train-detail.svelte';
import Reason from '$lib/raw-fetchers/reason.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { uuid } from '$lib/stores/uuid';
+ import Error from '../../../routes/+error.svelte';
+ import Island from '$lib/islands/island.svelte';
let requestedStation;
$: requestedStation = station;
let jsonData = {};
- let services = [];
+ let services = [],
+ busServices = [],
+ ferryServices = [];
let dataAge = null;
let isLoading = true;
+ let isErr = false;
+ let errMsg;
let alerts = [];
let detail = { show: false, rid: '', uid: '', headcode: '' };
@@ -31,6 +37,18 @@
services = [];
}
+ if (jsonData?.GetBoardResult?.busServices?.service) {
+ busServices = jsonData.GetBoardResult.busServices.service;
+ } else {
+ busServices = [];
+ }
+
+ if (jsonData?.GetBoardResult?.ferryServices?.service) {
+ ferryServices = jsonData.GetBoardResult.ferryServices.service;
+ } else {
+ ferryServices = [];
+ }
+
if (jsonData?.GetBoardResult?.locationName) {
title = jsonData.GetBoardResult.locationName;
} else {
@@ -54,9 +72,18 @@
}
};
const data = await fetch(url, opt);
- jsonData = await data.json();
+ const json = await data.json();
+ if (json.ERROR === 'NOT_FOUND') {
+ isErr = true;
+ errMsg = 'Unable to find this station';
+ } else {
+ jsonData = json;
+ }
} catch (error) {
console.error('Error fetching data:', error);
+ isLoading = false;
+ isErr = true;
+ errMsg = 'Connection error, try again later';
} finally {
isLoading = false; // Clear loading state
}
@@ -251,74 +278,232 @@
{#if isLoading}
+{:else if isErr}
+
+ {errMsg}
+
{:else}
{#if alerts.length}
{/if}
Updated: {dataAge.toLocaleTimeString()} - Staff Boards under development |
+
+ |
+ Arrival |
+ Departure |
+
ID |
From |
To |
Plat |
- Sch Arr |
- Exp Arr |
- Sch Dep |
- Exp Dep |
+ Sch |
+ Exp |
+ Sch |
+ Exp |
- {#each services as service}
- {#await generateServiceData(service)}
-
- Loading... |
-
- {:then serviceStats}
-
- {service.trainid} |
- {serviceStats.from} |
- {serviceStats.to} |
- {serviceStats.platform.number || '-'} |
- {serviceStats.schArr} |
- {serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr} |
- {serviceStats.schDep} |
- {serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep} |
-
-
-
- {service.operator}
- {#if serviceStats.length} | {serviceStats.length} carriages{/if}
-
- {#if service.cancelReason}
-
- {/if}
- {#if service?.delayReason && !service.isCancelled}
-
- {/if}
- |
-
- {:catch}
-
- Unable to load service |
-
- {/await}
- {/each}
+ {#if !services.length}
+ No Scheduled Train Services |
+ {:else}
+ {#each services as service}
+ {#await generateServiceData(service)}
+
+ Loading... |
+
+ {:then serviceStats}
+
+ {service.trainid} |
+ {serviceStats.from} |
+ {serviceStats.to} |
+ {serviceStats.platform.number || '-'} |
+ {serviceStats.schArr} |
+ {serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr} |
+ {serviceStats.schDep} |
+ {serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep} |
+
+
+
+ {service.operator}
+ {#if serviceStats.length} | {serviceStats.length} carriages{/if}
+
+ {#if service.cancelReason}
+
+
+ {/if}
+ {#if service?.delayReason && !service.isCancelled}
+
+ {/if}
+ |
+
+ {:catch}
+
+ Unable to load service |
+
+ {/await}
+ {/each}
+ {/if}
+ {#if busServices.length}
+
+
+
+
+ |
+ Arrival |
+ Departure |
+
+
+ ID |
+ From |
+ To |
+ Plat |
+ Sch |
+ Exp |
+ Sch |
+ Exp |
+
+ {#each busServices as service}
+ {#await generateServiceData(service)}
+
+ Loading... |
+
+ {:then serviceStats}
+
+ {service.trainid} |
+ {serviceStats.from} |
+ {serviceStats.to} |
+ {serviceStats.platform.number || '-'} |
+ {serviceStats.schArr} |
+ {serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr} |
+ {serviceStats.schDep} |
+ {serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep} |
+
+
+
+ {service.operator}
+ {#if serviceStats.length} | {serviceStats.length} carriages{/if}
+
+ {#if service.cancelReason}
+
+ {/if}
+ {#if service?.delayReason && !service.isCancelled}
+
+ {/if}
+ |
+
+ {:catch}
+
+ Unable to load service |
+
+ {/await}
+ {/each}
+
+ {/if}
+ {#if ferryServices.length}
+
+
+
+
+ |
+ Arrival |
+ Departure |
+
+
+ ID |
+ From |
+ To |
+ Plat |
+ Sch |
+ Exp |
+ Sch |
+ Exp |
+
+ {#each ferryServices as service}
+ {#await generateServiceData(service)}
+
+ Loading... |
+
+ {:then serviceStats}
+
+ {service.trainid} |
+ {serviceStats.from} |
+ {serviceStats.to} |
+ {serviceStats.platform.number || '-'} |
+ {serviceStats.schArr} |
+ {serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr} |
+ {serviceStats.schDep} |
+ {serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep} |
+
+
+
+ {service.operator}
+ {#if serviceStats.length} | {serviceStats.length} carriages{/if}
+
+ {#if service.cancelReason}
+
+ {/if}
+ {#if service?.delayReason && !service.isCancelled}
+
+ {/if}
+ |
+
+ {:catch}
+
+ Unable to load service |
+
+ {/await}
+ {/each}
+
+ {/if}
{/if}
@@ -328,6 +513,10 @@
color: var(--second-text-color);
}
+ .transport-mode {
+ width: 30px;
+ }
+
table {
color: white;
font-weight: normal;
diff --git a/src/lib/overlays/welcome.svelte b/src/lib/overlays/welcome.svelte
index 7d26c6e..95bb762 100644
--- a/src/lib/overlays/welcome.svelte
+++ b/src/lib/overlays/welcome.svelte
@@ -1,10 +1,11 @@
-
+