diff --git a/src/lib/islands/overlay-island.svelte b/src/lib/islands/overlay-island.svelte
new file mode 100644
index 0000000..3b688fe
--- /dev/null
+++ b/src/lib/islands/overlay-island.svelte
@@ -0,0 +1,32 @@
+
+
+
+ {variables.title}
+
+
+
+
\ No newline at end of file
diff --git a/src/lib/ldb/public-ldb.svelte b/src/lib/ldb/public-ldb.svelte
index 8090204..1267daa 100644
--- a/src/lib/ldb/public-ldb.svelte
+++ b/src/lib/ldb/public-ldb.svelte
@@ -3,6 +3,7 @@
export let title = "Loading...";
import { onMount } from 'svelte'
import Loading from '$lib/navigation/loading.svelte';
+ import OverlayIsland from '$lib/islands/overlay-island.svelte';
let requestedStation;
$: requestedStation = station;
@@ -14,6 +15,7 @@
let dataAge = null;
let isLoading = true;
let dataExists = false;
+ let serviceDetail;
$: {
if (jsonData === null && requestedStation) {
@@ -73,6 +75,7 @@
output = 'CANC'
change = "cancelled"
break
+ case 'On Time':
case 'On time':
output = 'RT'
change = ""
@@ -100,6 +103,19 @@
return {data: output, changed: change}
}
+ async function loadService(sid) {
+ console.log(`Loading: ${sid}`);
+ for (const service of services) {
+ if (service.serviceID == sid) {
+ serviceDetail = service
+ }
+ }
+ }
+
+ async function closeService() {
+ serviceDetail = null;
+ }
+
onMount(() => {
if (requestedStation && jsonData === null) {
fetchData();
@@ -125,7 +141,7 @@
{#each services as service}
-
+ |
{#if Array.isArray(service.origin?.location)}
{service.origin.location[0]['locationName'] +
" & " +
@@ -134,7 +150,7 @@
{service.origin?.location?.locationName || ''}
{/if}
|
-
+ |
{#if Array.isArray(service.destination?.location)}
{service.destination.location[0]['locationName'] +
" & " +
@@ -244,6 +260,44 @@
Unable to find this station
{/if}
{/if}
+
+{#if serviceDetail}
+
+ Service Detail
+
+
+
+ Location |
+ Sch |
+ Exp |
+
+ {#if serviceDetail?.previousCallingPoints?.callingPointList?.callingPoint}
+ {#each serviceDetail.previousCallingPoints.callingPointList.callingPoint as prevPoint}
+
+ {prevPoint.locationName} |
+ {prevPoint.st} |
+ {parseTime(prevPoint.at || prevPoint.et).data} |
+
+ {/each}
+ {/if}
+
+ {title} |
+ {serviceDetail.std || serviceDetail.sta} |
+ {parseTime(serviceDetail.etd || serviceDetail.eta).data} |
+
+ {#if serviceDetail?.subsequentCallingPoints?.callingPointList?.callingPoint}
+ {#each serviceDetail.subsequentCallingPoints.callingPointList.callingPoint as nextPoint}
+
+ {nextPoint.locationName} |
+ {nextPoint.st} |
+ {parseTime(nextPoint.et).data} |
+
+ {/each}
+ {/if}
+
+
+{/if}
+
|