From 9cd082193b939e52bf75749ef56044e2bde92e36 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 5 Feb 2024 21:07:56 +0000 Subject: [PATCH] Adjust train detail dtop box to space out PIS details --- src/lib/scripts/upstream.ts | 9 ++++--- src/lib/train/pis-handler.svelte | 22 ++++++++++++++--- src/lib/train/train-detail.svelte | 41 +++++++++++++++++++------------ 3 files changed, 50 insertions(+), 22 deletions(-) diff --git a/src/lib/scripts/upstream.ts b/src/lib/scripts/upstream.ts index 8ef362b..669455a 100644 --- a/src/lib/scripts/upstream.ts +++ b/src/lib/scripts/upstream.ts @@ -1,9 +1,12 @@ import { dev } from '$app/environment'; +const testUrl: string = 'http://localhost:8460' +const prodUrl: string = 'https://owlboard.info' + export function getApiUrl() { if (dev) { - console.info('DEVMODE active, using testing URL'); - return 'http://localhost:8460'; + console.info('DEVMODE active, using testing URL: ', testUrl); + return testUrl; } - return 'https://owlboard.info'; + return prodUrl; } diff --git a/src/lib/train/pis-handler.svelte b/src/lib/train/pis-handler.svelte index 1e77b27..6fc6a18 100644 --- a/src/lib/train/pis-handler.svelte +++ b/src/lib/train/pis-handler.svelte @@ -6,10 +6,26 @@ {#if pisObject} {#if typeof pisObject === 'string' || typeof pisObject === 'number'} - {pisObject} + PIS: {pisObject} {:else if pisObject['skipCount'] === 0} - {pisObject.code} + PIS: {pisObject.code} {:else if pisObject['skipCount'] > 0} - {pisObject.code} - (Skip first {pisObject.skipType}{#if pisObject.skipCount > 1} {pisObject.skipCount} stops{:else} stop{/if}) + PIS: {pisObject.code} +
+ (skip first {pisObject.skipType}{#if pisObject.skipCount > 1} {pisObject.skipCount} stops{:else} stop{/if}) {/if} {/if} + + \ No newline at end of file diff --git a/src/lib/train/train-detail.svelte b/src/lib/train/train-detail.svelte index e340010..cc61625 100644 --- a/src/lib/train/train-detail.svelte +++ b/src/lib/train/train-detail.svelte @@ -31,14 +31,12 @@ } -
{service?.stops[0]['publicDeparture'] || service?.stops[0]['wttDeparture']} - {service?.stops[0]['tiploc']} to {service?.stops[service['stops'].length - 1]['tiploc']}{#if service?.vstp}VSTP{/if} V
@@ -48,12 +46,15 @@ {:then serviceDetail} {#if serviceDetail.stpIndicator === 'C'} - This has been removed from the timetable for today
- It is likely another service is running in its place +

This has been removed from the timetable for today.

+ The service will not run, another service may be running in its place.

{:else} + {#if serviceDetail.vstp} +
VSTP
+ {/if}
{#if serviceDetail.pis} -

PIS:

+ {/if}

Planned Type: {parseInt(serviceDetail.planSpeed) || '--'}mph {serviceDetail.powerType || 'Non-Rail vehicle'} @@ -62,9 +63,9 @@ Days Run: {serviceDetail?.daysRun.join(', ').toUpperCase() || 'Unknown'}

- Valid From: {new Date(serviceDetail.scheduleStartDate).toLocaleDateString('en-GB', { + Valid From: {new Date(serviceDetail.scheduleStart).toLocaleDateString('en-GB', { timeZone: 'UTC' - })} - {new Date(serviceDetail.scheduleEndDate).toLocaleDateString('en-GB', { + })} - {new Date(serviceDetail.scheduleEnd).toLocaleDateString('en-GB', { timeZone: 'UTC' })}

@@ -146,15 +147,8 @@ margin-bottom: 15px; font-weight: 600; } - .pis { - font-size: 18px; - font-weight: 600; - color: var(--main-text-color); - margin-top: 10px; - margin-bottom: 5px; - } .svc-detail { - margin-top: 2px; + margin-top: 6px; margin-bottom: 2px; color: var(--island-text-color); } @@ -167,4 +161,19 @@ padding-bottom: 10px; color: var(--island-text-color); } + .text-message { + margin: 5px; + margin-left: 20px; + margin-right: 20px; + padding-bottom: 10px; + } + .vstp { + background-color: red; + margin: auto; + padding: 5px; + width: 50px; + border-radius: 5px; + border-color: darkred; + font-weight: bolder; + }