Add handler for PIS object
This commit is contained in:
parent
6505ba7f60
commit
e6ee0dc321
15
src/lib/train/pis-handler.svelte
Normal file
15
src/lib/train/pis-handler.svelte
Normal file
@ -0,0 +1,15 @@
|
||||
<script lang="ts">
|
||||
import type { OB_Pis_SimpleObject } from '@owlboard/ts-types';
|
||||
|
||||
export let pisObject: OB_Pis_SimpleObject;
|
||||
</script>
|
||||
|
||||
{#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}
|
@ -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}
|
||||
<div class="detailOperator"><StylesToc toc={service?.operator || ''} full={true} /></div>
|
||||
{#if serviceDetail.pis}
|
||||
<p class="pis">PIS: {serviceDetail.pis}</p>
|
||||
<p class="pis">PIS: <PisHandler pisObject={serviceDetail.pis} /></p>
|
||||
{/if}
|
||||
<p class="svc-detail">
|
||||
Planned Type: {parseInt(serviceDetail.planSpeed) || '--'}mph {serviceDetail.powerType || 'Non-Rail vehicle'}
|
||||
|
Loading…
Reference in New Issue
Block a user