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> <script>
export let service; export let service;
import Reason from "$lib/raw-fetchers/reason.svelte"; import Reason from '$lib/raw-fetchers/reason.svelte';
function parseTimes(service) { function parseTimes(service) {
const sta = new Date(service.sta), const sta = new Date(service.sta),
@ -129,13 +129,13 @@
<td class="plat plat-data data {serviceStats.platformHidden && 'hidden'}">{serviceStats.platform.number || '-'}</td> <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.schArr}</td>
<td <td
class="time time-data data {serviceStats.canArr && 'can-time'} {serviceStats.isArrDelayed && 'late'} {serviceStats.isEarlyArr && 'early'} {serviceStats.isLateArr && class="time time-data data {serviceStats.canArr && 'can-time'} {serviceStats.isArrDelayed && 'late'} {serviceStats.isEarlyArr && 'early'} {serviceStats.isLateArr && 'late'}"
'late'}">{serviceStats.isArrDelayed ? 'LATE' : serviceStats.expArr}</td >{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.isCancelled && 'can-dat'}">{serviceStats.schDep}</td>
<td <td
class="time time-data data {serviceStats.canDep && 'can-time'} {serviceStats.isDepDelayed && 'late'} {serviceStats.isEarlyDep && 'early'} {serviceStats.isLateDep && class="time time-data data {serviceStats.canDep && 'can-time'} {serviceStats.isDepDelayed && 'late'} {serviceStats.isEarlyDep && 'early'} {serviceStats.isLateDep && 'late'}"
'late'}">{serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep}</td >{serviceStats.isDepDelayed ? 'LATE' : serviceStats.expDep}</td
> >
</tr> </tr>
<tr class="text-row"> <tr class="text-row">

View File

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

View File

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