Run formatter

This commit is contained in:
Fred Boniface 2023-07-07 22:07:37 +01:00
parent 8a7c78219f
commit b6dca2df78
3 changed files with 68 additions and 67 deletions

View File

@ -1,7 +1,7 @@
<script>
export let service;
import Reason from "$lib/raw-fetchers/reason.svelte";
import Reason from '$lib/raw-fetchers/reason.svelte';
function parseTimes(service) {
const sta = new Date(service.sta),
@ -111,7 +111,7 @@
<tr>
<td colspan="8"> Loading... </td>
</tr>
{:then serviceStats}
{:then serviceStats}
<tr class="{serviceStats.isCancelled && 'can-dat'} {serviceStats.isNonPublic && 'ecs'}">
<td class="id id-data data" on:click={showDetails(service.rid, service.uid, service.trainid)} on:keypress={showDetails(service.rid, service.uid, service.trainid)}
>{service.trainid}</td
@ -129,13 +129,13 @@
<td class="plat plat-data data {serviceStats.platformHidden && 'hidden'}">{serviceStats.platform.number || '-'}</td>
<td class="time time-data data">{serviceStats.schArr}</td>
<td
class="time time-data data {serviceStats.canArr && 'can-time'} {serviceStats.isArrDelayed && 'late'} {serviceStats.isEarlyArr && 'early'} {serviceStats.isLateArr &&
'late'}">{serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr}</td
class="time time-data data {serviceStats.canArr && 'can-time'} {serviceStats.isArrDelayed && 'late'} {serviceStats.isEarlyArr && 'early'} {serviceStats.isLateArr && 'late'}"
>{serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr}</td
>
<td class="time time-data data {serviceStats.isCancelled && 'can-dat'}">{serviceStats.schDep}</td>
<td
class="time time-data data {serviceStats.canDep && 'can-time'} {serviceStats.isDepDelayed && 'late'} {serviceStats.isEarlyDep && 'early'} {serviceStats.isLateDep &&
'late'}">{serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep}</td
class="time time-data data {serviceStats.canDep && 'can-time'} {serviceStats.isDepDelayed && 'late'} {serviceStats.isEarlyDep && 'early'} {serviceStats.isLateDep && 'late'}"
>{serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep}</td
>
</tr>
<tr class="text-row">

View File

@ -93,7 +93,6 @@
}
return times;
}
</script>
<OverlayIsland>
@ -111,14 +110,18 @@
</p>
<table id="detailTable">
{#if train.GetServiceDetailsResult.delayReason}
<tr><td colspan="7" class="late">
<tr
><td colspan="7" class="late">
<Reason type="delay" code={train.GetServiceDetailsResult.delayReason} />
</td></tr>
</td></tr
>
{/if}
{#if train.GetServiceDetailsResult.cancelReason}
<tr><td colspan="7" class="canc">
<tr
><td colspan="7" class="canc">
<Reason type="cancel" code={train.GetServiceDetailsResult.cancelReason} />
</td></tr>
</td></tr
>
{/if}
<tr>
<th colspan="2" />

View File

@ -1,18 +1,17 @@
<script>
import { uuid } from "$lib/stores/uuid";
import { uuid } from '$lib/stores/uuid';
export let code = '';
export let type = '';
async function getDelay(code = '') {
console.log(`Fetching delay reason ${code}`)
console.log(`Fetching delay reason ${code}`);
const data = await getReason(code);
return data[0].lateReason || 'This train has been delayed';
}
async function getCancel(code = '') {
console.log(`Fetching cancel reason ${code}`)
console.log(`Fetching cancel reason ${code}`);
const data = await getReason(code);
return data[0].cancReason || 'This train has been cancelled';
}
@ -28,10 +27,9 @@
const res = await fetch(url, options);
return await res.json();
}
</script>
{#if type === "cancel"}
{#if type === 'cancel'}
{#await getCancel(code)}
This train has been cancelled
{:then reason}
@ -39,7 +37,7 @@
{:catch}
This train has been cancelled
{/await}
{:else if type === "delay"}
{:else if type === 'delay'}
{#await getDelay(code)}
This train has been delayed
{:then reason}