From 45b64002f4435f2d5c85c218753cf48f69c457b5 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 9 Jul 2023 08:12:25 +0100 Subject: [PATCH] Fixes to StaffLDB - needs componentisong --- src/app.css | 4 +- src/lib/ldb/staff/service-row.svelte | 158 ------------------- src/lib/ldb/staff/staff-ldb.svelte | 185 +++++++++++++---------- src/lib/ldb/staff/table-generator.svelte | 12 ++ src/lib/overlays/welcome.svelte | 4 +- src/routes/train/+page.svelte | 22 +-- 6 files changed, 134 insertions(+), 251 deletions(-) delete mode 100644 src/lib/ldb/staff/service-row.svelte create mode 100644 src/lib/ldb/staff/table-generator.svelte diff --git a/src/app.css b/src/app.css index 5faa7c0..0b0676f 100644 --- a/src/app.css +++ b/src/app.css @@ -56,7 +56,9 @@ body { color: var(--second-text-color); font-family: urwgothic, sans-serif; text-align: center; - padding-bottom: 60px; /*Footer height*/ + margin: auto; + width: 100%; + padding-bottom: 65px; } a { color: var(--link-color); diff --git a/src/lib/ldb/staff/service-row.svelte b/src/lib/ldb/staff/service-row.svelte deleted file mode 100644 index 29e0121..0000000 --- a/src/lib/ldb/staff/service-row.svelte +++ /dev/null @@ -1,158 +0,0 @@ - - -{#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} diff --git a/src/lib/ldb/staff/staff-ldb.svelte b/src/lib/ldb/staff/staff-ldb.svelte index b920b0f..099845b 100644 --- a/src/lib/ldb/staff/staff-ldb.svelte +++ b/src/lib/ldb/staff/staff-ldb.svelte @@ -286,12 +286,12 @@ {#if alerts.length} {/if} - +
- + + @@ -363,11 +363,11 @@ {#if busServices.length}
Bus services
-
Updated: {dataAge.toLocaleTimeString()} - Staff Boards under development
- ArrivalDepartureArrivalDeparture
ID
+
- + + @@ -433,76 +433,76 @@
- ArrivalDepartureArrivalDeparture
ID
{/if} {#if ferryServices.length} -
- Ferry services
- - - - - - - - - - - - - - - - {#each ferryServices as service} - {#await generateServiceData(service)} - - - - {:then serviceStats} - - - - - - - - - - - - - - {:catch} - - - - {/await} - {/each} -
- ArrivalDeparture
IDFromToPlatSchExpSchExp
Loading...
{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} -
Unable to load service
+
+ Bus services
+ + + + + + + + + + + + + + + + {#each ferryServices as service} + {#await generateServiceData(service)} + + + + {:then serviceStats} + + + + + + + + + + + + + + {:catch} + + + + {/await} + {/each} +
+ ArrivalDeparture
IDFromToPlatSchExpSchExp
Loading...
{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} +
Unable to load service
{/if} {/if} @@ -515,16 +515,42 @@ .transport-mode { width: 30px; + margin: auto; } - table { + .dataTable { color: white; font-weight: normal; - margin: auto; - margin-top: 0px; + width: 100%; + margin: 0px, 0px; + padding-left: 8px; padding-right: 8px; } + .id { + width: 12%; + } + + .from { + width: 20%; + } + + .to { + width: 20%; + } + + .plat { + width: 8%; + } + + .timePair { + width: 20%; + } + + .time { + width: 10%; + } + .data { font-weight: normal; } @@ -544,6 +570,7 @@ .text-row { margin-top: 0px; padding-bottom: 5px; + width: 100%; } .text-data { diff --git a/src/lib/ldb/staff/table-generator.svelte b/src/lib/ldb/staff/table-generator.svelte new file mode 100644 index 0000000..00a4ff3 --- /dev/null +++ b/src/lib/ldb/staff/table-generator.svelte @@ -0,0 +1,12 @@ + + + +
+ + \ No newline at end of file diff --git a/src/lib/overlays/welcome.svelte b/src/lib/overlays/welcome.svelte index 95bb762..1d83d40 100644 --- a/src/lib/overlays/welcome.svelte +++ b/src/lib/overlays/welcome.svelte @@ -25,7 +25,7 @@ const pageText = [ '

A brand new look

' + "

OwlBoard has a brand new look, making it even faster for you to access the data - you won't have to register again.

" + - "

Live station data is still available right from the homepage. If you are signed up, you'll get improved data from the Staff board

" + + "

Live station data is still available right from the homepage. If you are signed up, you'll get improved data from the Staff board. Bus and Ferry services are still included

" + '

Train Data & PIS is now available right from the homepage if you are searching by headcode, for other PIS searches, the PIS finder is in the bottom menu

', '

Staff Station Boards

' + '

If you are registered, staff station boards will be available.

' + @@ -34,7 +34,7 @@ '

Everything Else

' + "

Everything else has moved to the 'More' menu, where you'll find the Reference Code lookup and software details." + '
' + - "

You won't see this welcome screen again

" + "

You will only see this welcome page again when there are new updates

" ]; diff --git a/src/routes/train/+page.svelte b/src/routes/train/+page.svelte index 4802788..40f0f35 100644 --- a/src/routes/train/+page.svelte +++ b/src/routes/train/+page.svelte @@ -53,22 +53,22 @@ const url = `https://owlboard.info/api/v2/timetable/train/${date}/${searchType}/${id}`; try { const res = await fetch(url, options); + if (res.status == 200) { + return await res.json(); + } else if (res.status === 401) { + error = true; + errMsg = 'You must be logged into the staff version for this feature'; + return false; + } else { + error = true; + errMsg = 'Unable to connect, check your connection and try again'; + return false; + } } catch (err) { error = true; errMsg = 'Connection error, try again later'; } isLoading = false; - if (res.status == 200) { - return await res.json(); - } else if (res.status === 401) { - error = true; - errMsg = 'You must be logged into the staff version for this feature'; - return false; - } else { - error = true; - errMsg = 'Unable to connect, check your connection and try again'; - return false; - } }