diff --git a/src/lib/train/train-detail.svelte b/src/lib/train/train-detail.svelte new file mode 100644 index 0000000..8fe22d3 --- /dev/null +++ b/src/lib/train/train-detail.svelte @@ -0,0 +1,109 @@ + + +
+
+ {service.operator || "GW"}: {service.stops[0]['publicDeparture'] || service.stops[0]['wttDeparture']} {service.stops[0]['tiploc']} to {service.stops[service['stops'].length -1]['tiploc']} + V +
+ {#if isExpanded} +
+ {#if service.pis} +

PIS: {service.pis}

+ {/if} +

Planned Type: {parseInt(service.planSpeed) || 68 }mph {service.powerType || "Bus" }

+

Days Run: {service.daysRun.join(", ").toUpperCase()}

+ + + + + + + {#if service.stops[0]['publicDeparture']} + {#each service.stops as stop} + {#if stop.publicArrival || stop.publicDeparture} + + + + + + {/if} + {/each} + {:else} + {#each service.stops as stop} + + + + + + {/each} + {/if} +
LocationSch Arr.Sch Dep.
{stop.tiploc}{stop.publicArrival || '-'}{stop.publicDeparture || '-'}
{stop.tiploc}{stop.wttArrival || '-'}{stop.wttDeparture || '-'}
+
+ {/if} +
+ + \ No newline at end of file diff --git a/src/routes/train/+page.svelte b/src/routes/train/+page.svelte index cd37647..cffdccd 100644 --- a/src/routes/train/+page.svelte +++ b/src/routes/train/+page.svelte @@ -6,6 +6,7 @@ import { uuid } from '$lib/stores/uuid'; import { onMount } from 'svelte' + import TrainDetail from '$lib/train/train-detail.svelte'; let title = "Timetable Results" let id = "" @@ -68,6 +69,7 @@
+
{#if error} @@ -80,63 +82,18 @@ {/if} {#each data as service} - {#if service.stops[0]['publicDeparture']} -

GW: {service.stops[0]['publicDeparture']} {service.stops[0]['tiploc']} to {service.stops[service['stops'].length -1]['tiploc']}

-

PIS: {service.pis}

- - - - - - - {#each service.stops as stop} - {#if stop.publicArrival || stop.publicDeparture} - - - - - - {/if} - {/each} -
LocationSch Arr.Sch Dep.
{stop.tiploc}{stop.publicArrival || '-'}{stop.publicDeparture || '-'}
- {:else} -

GW: {service.stops[0]['wttDeparture']} {service.stops[0]['tiploc']} to {service.stops[service['stops'].length -1]['tiploc']}

-

PIS: {service.pis}

- - - - - - - {#each service.stops as stop} - - - - - - {/each} -
LocationSch Arr.Sch Dep.
{stop.tiploc}{stop.wttArrival || '-'}{stop.wttDeparture || '-'}
- {/if} + {/each}