diff --git a/src/lib/train/pis-handler.svelte b/src/lib/train/pis-handler.svelte new file mode 100644 index 0000000..993fb4a --- /dev/null +++ b/src/lib/train/pis-handler.svelte @@ -0,0 +1,15 @@ + + +{#if pisObject} + {#if typeof pisObject === 'string' || typeof pisObject === 'number'} + {pisObject} + {:else if pisObject['skipCount'] === 0} + {pisObject.code} + {:else if pisObject['skipCount'] > 0} + {pisObject.code} - (Skip {pisObject.skipType}{#if pisObject.skipCount > 1} {pisObject.skipCount} stops{:else} stop{/if}) + {/if} +{/if} diff --git a/src/lib/train/train-detail.svelte b/src/lib/train/train-detail.svelte index dcf5405..18bdec6 100644 --- a/src/lib/train/train-detail.svelte +++ b/src/lib/train/train-detail.svelte @@ -4,6 +4,7 @@ import LoadingText from '$lib/navigation/loading-text.svelte'; import StylesToc from './styles-toc.svelte'; import { getApiUrl } from '$lib/scripts/upstream'; + import PisHandler from '$lib/train/pis-handler.svelte'; export let service = ''; @@ -48,7 +49,7 @@ {:then serviceDetail}
{#if serviceDetail.pis} -

PIS: {serviceDetail.pis}

+

PIS:

{/if}

Planned Type: {parseInt(serviceDetail.planSpeed) || '--'}mph {serviceDetail.powerType || 'Non-Rail vehicle'}