Compare commits

..

No commits in common. "7df190220f83954e94a934cffc51b262e6596a33" and "847545760b25598d58fc3594ba6546c9690f02a2" have entirely different histories.

8 changed files with 68 additions and 212 deletions

View File

@ -19,7 +19,7 @@
{link.toUpperCase()} {link.toUpperCase()}
</a> </a>
{:else if link.length === 4} {:else if link.length === 4}
<a class="link" href="/train?headcode={link}"> <a class="link" href="/result-timetable?headcode={link}">
{link.toUpperCase()} {link.toUpperCase()}
</a> </a>
{/if} {/if}

View File

@ -18,10 +18,4 @@
<p>{line}</p> <p>{line}</p>
{/each} {/each}
</Island> </Island>
<style>
p {
color: white;
}
</style>

View File

@ -1,6 +1,5 @@
<script> <script>
export let station = ""; export let station = "";
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';
@ -9,41 +8,25 @@
let jsonData = null; let jsonData = null;
let services = []; let services = [];
let busServices = [];
let ferryServices = [];
let dataAge = null; let dataAge = null;
let isLoading = true; let isLoading = true;
$: { $: {
if (jsonData === null && requestedStation) { if (jsonData === null && requestedStation) {
fetchData(); fetchData();
}
if (jsonData?.GetStationBoardResult?.generatedAt) {
dataAge = new Date(jsonData.GetStationBoardResult.generatedAt);
}
if (jsonData?.GetStationBoardResult?.trainServices?.service) {
services = jsonData.GetStationBoardResult.trainServices.service;
} else {
services = [];
}
if (jsonData?.GetStationBoardResult?.busServices?.service) {
busServices = jsonData.GetStationBoardResult.busServices.service;
}
if (jsonData?.GetStationBoardResult?.ferryServices?.service) {
ferryServices = jsonData.GetStationBoardResult.ferryServices.service;
}
if (jsonData?.GetStationBoardResult?.locationName) {
title = jsonData.GetStationBoardResult.locationName
} else {
title = "Loading Board"
}
} }
if (jsonData && jsonData.GetStationBoardResult && jsonData.GetStationBoardResult.generatedAt) {
dataAge = new Date(jsonData.GetStationBoardResult.generatedAt);
}
if (jsonData && jsonData.GetStationBoardResult && jsonData.GetStationBoardResult.trainServices && jsonData.GetStationBoardResult.trainServices.service) {
services = jsonData.GetStationBoardResult.trainServices.service;
} else {
services = [];
}
}
async function fetchData() { async function fetchData() {
isLoading = true; // Set loading state isLoading = true; // Set loading state
try { try {
@ -107,119 +90,48 @@
<Loading /> <Loading />
{:else} {:else}
<p id="timestamp">Updated: {dataAge.toLocaleTimeString()}</p> <p id="timestamp">Updated: {dataAge.toLocaleTimeString()}</p>
{#if services.length} <p>Public LDB for {station}</p>
<table>
<tr>
<th class="from">From</th>
<th class="to">To</th>
<th class="plat">Plat.</th>
<th class="time">Sch Arr.</th>
<th class="time">Exp Arr.</th>
<th class="time">Sch Dep.</th>
<th class="time">Exp Dep.</th>
</tr>
{#each services as service}
<tr>
<td class="origdest from">{service.origin?.location?.locationName || ''}</td>
<td class="origdest to">{service.destination?.location?.locationName || ''}</td>
<td class="plat">{service.platform || '-'}</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.std).data}</td>
<td class="time {parseTime(service.etd).changed}">{parseTime(service.etd).data}</td>
</tr>
<tr><td colspan="7"> <table>
<p class="service-detail"> <tr>
A {service.operator || 'Unknown'} service <th class="from">From</th>
{#if service['length']} <th class="to">To</th>
with {service['length'] || 'some'} coaches <th class="plat">Plat.</th>
{/if} <th class="time">Sch Arr.</th>
</p> <th class="time">Exp Arr.</th>
{#if service.delayReason} <th class="time">Sch Dep.</th>
<p class="service-detail">{service.delayReason}</p> <th class="time">Exp Dep.</th>
{/if} </tr>
{#if service.cancelReason} {#each services as service}
<p class="service-detail">{service.cancelReason}</p>
{/if}
</td></tr>
{/each}
</table>
{:else}
<p>No Scheduled Train Services</p>
{/if}
{#if busServices.length}
<table>
<tr> <tr>
<th class="from">From</th> <td class="origdest from">{service.origin?.location?.locationName || ''}</td>
<th class="to">To</th> <td class="origdest to">{service.destination?.location?.locationName || ''}</td>
<th class="time">Sch Arr.</th> <td class="plat">{service.platform || '-'}</td>
<th class="time">Exp Arr.</th> <td class="time">{parseTime(service.sta).data}</td>
<th class="time">Sch Dep.</th> <td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td>
<th class="time">Exp Dep.</th> <td class="time">{parseTime(service.std).data}</td>
<td class="time {parseTime(service.etd).changed}">{parseTime(service.etd).data}</td>
</tr> </tr>
{#each busServices as service} <!-- service-detail elements are currently contained within the 'From' column
<tr> It should be underneath the row. I will need to look at the vanilla interface
<td class="origdest from">{service.origin?.location?.locationName || ''}</td> to establish what I did differently there. Or, I can insert a new row
<td class="origdest to">{service.destination?.location?.locationName || ''}</td> with colspan="7" to add a row spanning all columns.-->
<td class="time">{parseTime(service.sta).data}</td> <tr><td colspan="7">
<td class="time {parseTime(service.eta).changed}">{parseTime(service.eta).data}</td> <p class="service-detail">
<td class="time">{parseTime(service.std).data}</td> A {service.operator || 'Unknown'} service
<td class="time {parseTime(service.etd).changed}">{parseTime(service.etd).data}</td> {#if service['length']}
</tr> with {service['length'] || 'some'} coaches
<tr><td colspan="7">
<p class="service-detail">
A {service.operator || 'Unknown'} service
</p>
{#if service.delayReason}
<p class="service-detail">{service.delayReason}</p>
{/if} {/if}
{#if service.cancelReason} </p>
<p class="service-detail">{service.cancelReason}</p> {#if service.delayReason}
{/if} <p class="service-detail">{service.delayReason}</p>
</td></tr> {/if}
{/each} {#if service.cancelReason}
</table> <p class="service-detail">{service.cancelReason}</p>
{:else} {/if}
<p>No Scheduled Bus Services</p> </td></tr>
{/if} {/each}
{#if ferryServices.length} </table>
<table>
<tr>
<th class="from">From</th>
<th class="to">To</th>
<th class="time">Sch Arr.</th>
<th class="time">Exp Arr.</th>
<th class="time">Sch Dep.</th>
<th class="time">Exp Dep.</th>
</tr>
{#each ferryServices as service}
<tr>
<td class="origdest from">{service.origin?.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.eta).changed}">{parseTime(service.eta).data}</td>
<td class="time">{parseTime(service.std).data}</td>
<td class="time {parseTime(service.etd).changed}">{parseTime(service.etd).data}</td>
</tr>
<tr><td colspan="7">
<p class="service-detail">
A {service.operator || 'Unknown'} service
</p>
{#if service.delayReason}
<p class="service-detail">{service.delayReason}</p>
{/if}
{#if service.cancelReason}
<p class="service-detail">{service.cancelReason}</p>
{/if}
</td></tr>
{/each}
</table>
{:else}
<p>No Scheduled Ferry Serices</p>
{/if}
{/if} {/if}
<style> <style>
#timestamp { #timestamp {

View File

@ -1,6 +1,5 @@
<script> <script>
export let station = ""; export let station = "";
export let title = "";
import { onMount } from 'svelte' import { onMount } from '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';
@ -8,7 +7,7 @@
let requestedStation; let requestedStation;
$: requestedStation = station; $: requestedStation = station;
let jsonData = {}; let jsonData = null;
let services = []; let services = [];
let dataAge = null; let dataAge = null;
let isLoading = true; let isLoading = true;
@ -18,21 +17,15 @@
fetchData(); fetchData();
} }
if (jsonData?.GetStationBoardResult?.generatedAt) { if (jsonData && jsonData.GetStationBoardResult && jsonData.GetStationBoardResult.generatedAt) {
dataAge = new Date(jsonData.GetStationBoardResult.generatedAt); dataAge = new Date(jsonData.GetStationBoardResult.generatedAt);
} }
if (jsonData?.GetStationBoardResult?.trainServices?.service) { if (jsonData && jsonData.GetStationBoardResult && jsonData.GetStationBoardResult.trainServices && jsonData.GetStationBoardResult.trainServices.service) {
services = jsonData.GetStationBoardResult.trainServices.service; services = jsonData.GetStationBoardResult.trainServices.service;
} else { } else {
services = []; services = [];
} }
if (jsonData?.GetStationBoardResult?.locationName) {
title = jsonData.GetStationBoardResult.locationName
} else {
title = "Loading Board"
}
} }
async function fetchData() { async function fetchData() {
@ -48,7 +41,7 @@
} }
} }
function parseTime(string = ""){ function parseTime(string){
let output let output
let change let change
switch (string) { switch (string) {

View File

@ -14,7 +14,7 @@ const inputIslands = [
}, },
{ {
title: "Train Details & PIS", title: "Train Details & PIS",
action: "/train", action: "/result-timetable",
placeholder: "Enter Headcode", placeholder: "Enter Headcode",
queryName: "headcode" queryName: "headcode"
} }

View File

@ -6,25 +6,23 @@
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" const title = "Public Board"
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;
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) {
staff = true; staff = true;
title = "Staff Board"
} else { } else {
title = "Public Board" staff = false;
} }
}) })
@ -34,7 +32,7 @@
<!-- If 'uuid' exists in store then load StaffLdb else load PublicLdb --> <!-- If 'uuid' exists in store then load StaffLdb else load PublicLdb -->
{#if !staff} {#if !staff}
<PublicLdb {station} bind:title={title} /> <PublicLdb {station} />
{:else} {:else}
<StaffLdb {station} /> <StaffLdb {station} />
{/if} {/if}

View File

@ -6,48 +6,7 @@
</script> </script>
<Header {title} /> <Header {title} />
<div>
<p>OwlBoard stores as little data as possible to offer its functions for you to use.
OwlBoard does not use any cookies, any data that is required is stored in your browser.
</p>
<p>Owlboard does not log IP addresses or browser fingerprints.</p>
<h2>If you do not sign up</h2>
<p>If you do not sign up, no personal data is processed or stored unless you report an issue.
</p>
<h2>If you do sign up</h2>
<p>If you do sign up for the rail staff version of OwlBoard, then we do need to store some data
but none of it can be used to personally identify you.
</p>
<p>When you sign up, you will need to provide a work email address which is checked to confirm that
it originates from a railway company. You are then sent an email with a registration link, OwlBoard
at this point, the username portion of the email address is discarted - for example 'a-user@owlboard.info'
would be stored at '@owlboard.info'. This host part of your email address is stored so that the data that
is displayed to you can be filtered, showing relevent results more prominently.
</p>
<p>The email-server may store the address and message content per it's usual operation and you consent to this
when you sign up.
</p>
<p>Alongside the host poriton of your email address, we store a randomly generated UUID which is used to authorize
access to the rail staff data.
</p>
<h2>Reporting an Issue</h2>
<p>When you report an issue, some data is collected - This data is: your browsers User Agent string and the size of the window you
are viewing the website in.</p>
<p>Any data that is submitted when you report an issue will be publically viewable alongside the
<a href="https://git.fjla.uk/owlboard/backend/issues" target="_blank">OwlBoard/backend git repository</a>.</p>
</div>
<Nav />
<style>
div { <Nav />
text-align: left;
}
h2 {
color: var(--second-text-color);
}
p {
color: white;
}
</style>