diff --git a/src/lib/components/ui/TrainService.svelte b/src/lib/components/ui/TrainService.svelte
index 37ddb1d..b1cc9c4 100644
--- a/src/lib/components/ui/TrainService.svelte
+++ b/src/lib/components/ui/TrainService.svelte
@@ -1,5 +1,5 @@
@@ -68,7 +113,7 @@
{service.dt}
-
+
@@ -86,7 +131,6 @@
{#if details.header.cl}
{details.header.cn ? ' near ' : ' at '}
-
{/if}
{/if}
@@ -101,9 +145,14 @@
{/if}
{/if}
-
-
-
+ {#if details.pis}
+
+ {details.pis.code}
+
+ {/if}
+
+
+
Times in yellow are estimates
@@ -117,40 +166,54 @@
| Location |
Plat |
Sch |
- Est/Act |
+ Act |
Sch |
- Est/Act |
+ Act |
|
-
- {#each details.locations as loc}
+ {#each details.locations as loc}
+
+
- | {loc.t} |
- {loc.p} |
+
+ {loc.t}
+ |
+ {loc.p} |
{#if loc.r == 'PASS'}
- Pass |
+ Pass |
{formatUkTime(loc.wtp)} |
{formatUkTime(loc.atp || loc.etp || '--')} |
{:else}
{formatUkTime(loc.pta || loc.wta || '--')} |
- {formatUkTime(loc.ata || loc.eta || '--')} |
{formatUkTime(loc.ptd || loc.wtd || '--')} |
- {formatUkTime(loc.atd || loc.etd || '--')} |
{/if}
{#if loc}
- {@const delay = calculateDelay(loc)}
- {delay.val} |
+ {@const delay = calculateDelay(loc)}
+ {delay.val} |
{/if}
- {/each}
-
+ {#if loc.act && getRelevantActivities(loc.act).length > 0}
+
+ |
+
+ {#each getRelevantActivities(loc.act) as note}
+ {note}
+ {/each}
+
+ |
+
+ {/if}
+
+ {/each}
@@ -158,163 +221,202 @@
\ No newline at end of file
+ @keyframes load-spin {
+ to {
+ transform: rotate(360deg);
+ }
+ }
+
diff --git a/src/lib/global.css b/src/lib/global.css
index bf97738..5d6c623 100644
--- a/src/lib/global.css
+++ b/src/lib/global.css
@@ -46,88 +46,88 @@
/* 100: Thin */
@font-face {
- font-family: 'JetBrains Mono';
- src: url('/type/jetbrains-mono/JetBrainsMono-Thin.woff2') format('woff2');
- font-weight: 100;
- font-style: normal;
- font-display: swap;
+ font-family: 'JetBrains Mono';
+ src: url('/type/jetbrains-mono/JetBrainsMono-Thin.woff2') format('woff2');
+ font-weight: 100;
+ font-style: normal;
+ font-display: swap;
}
@font-face {
- font-family: 'JetBrains Mono';
- src: url('/type/jetbrains-mono/JetBrainsMono-ThinItalic.woff2') format('woff2');
- font-weight: 100;
- font-style: italic;
- font-display: swap;
+ font-family: 'JetBrains Mono';
+ src: url('/type/jetbrains-mono/JetBrainsMono-ThinItalic.woff2') format('woff2');
+ font-weight: 100;
+ font-style: italic;
+ font-display: swap;
}
/* 200: ExtraLight */
@font-face {
- font-family: 'JetBrains Mono';
- src: url('/type/jetbrains-mono/JetBrainsMono-ExtraLight.woff2') format('woff2');
- font-weight: 200;
- font-style: normal;
- font-display: swap;
+ font-family: 'JetBrains Mono';
+ src: url('/type/jetbrains-mono/JetBrainsMono-ExtraLight.woff2') format('woff2');
+ font-weight: 200;
+ font-style: normal;
+ font-display: swap;
}
/* 300: Light */
@font-face {
- font-family: 'JetBrains Mono';
- src: url('/type/jetbrains-mono/JetBrainsMono-Light.woff2') format('woff2');
- font-weight: 300;
- font-style: normal;
- font-display: swap;
+ font-family: 'JetBrains Mono';
+ src: url('/type/jetbrains-mono/JetBrainsMono-Light.woff2') format('woff2');
+ font-weight: 300;
+ font-style: normal;
+ font-display: swap;
}
/* 400: Regular / Italic */
@font-face {
- font-family: 'JetBrains Mono';
- src: url('/type/jetbrains-mono/JetBrainsMono-Regular.woff2') format('woff2');
- font-weight: 400;
- font-style: normal;
- font-display: swap;
+ font-family: 'JetBrains Mono';
+ src: url('/type/jetbrains-mono/JetBrainsMono-Regular.woff2') format('woff2');
+ font-weight: 400;
+ font-style: normal;
+ font-display: swap;
}
@font-face {
- font-family: 'JetBrains Mono';
- src: url('/type/jetbrains-mono/JetBrainsMono-Italic.woff2') format('woff2');
- font-weight: 400;
- font-style: italic;
- font-display: swap;
+ font-family: 'JetBrains Mono';
+ src: url('/type/jetbrains-mono/JetBrainsMono-Italic.woff2') format('woff2');
+ font-weight: 400;
+ font-style: italic;
+ font-display: swap;
}
/* 500: Medium */
@font-face {
- font-family: 'JetBrains Mono';
- src: url('/type/jetbrains-mono/JetBrainsMono-Medium.woff2') format('woff2');
- font-weight: 500;
- font-style: normal;
- font-display: swap;
+ font-family: 'JetBrains Mono';
+ src: url('/type/jetbrains-mono/JetBrainsMono-Medium.woff2') format('woff2');
+ font-weight: 500;
+ font-style: normal;
+ font-display: swap;
}
/* 600: SemiBold */
@font-face {
- font-family: 'JetBrains Mono';
- src: url('/type/jetbrains-mono/JetBrainsMono-SemiBold.woff2') format('woff2');
- font-weight: 600;
- font-style: normal;
- font-display: swap;
+ font-family: 'JetBrains Mono';
+ src: url('/type/jetbrains-mono/JetBrainsMono-SemiBold.woff2') format('woff2');
+ font-weight: 600;
+ font-style: normal;
+ font-display: swap;
}
/* 700: Bold */
@font-face {
- font-family: 'JetBrains Mono';
- src: url('/type/jetbrains-mono/JetBrainsMono-Bold.woff2') format('woff2');
- font-weight: 700;
- font-style: normal;
- font-display: swap;
+ font-family: 'JetBrains Mono';
+ src: url('/type/jetbrains-mono/JetBrainsMono-Bold.woff2') format('woff2');
+ font-weight: 700;
+ font-style: normal;
+ font-display: swap;
}
/* 800: ExtraBold */
@font-face {
- font-family: 'JetBrains Mono';
- src: url('/type/jetbrains-mono/JetBrainsMono-ExtraBold.woff2') format('woff2');
- font-weight: 800;
- font-style: normal;
- font-display: swap;
+ font-family: 'JetBrains Mono';
+ src: url('/type/jetbrains-mono/JetBrainsMono-ExtraBold.woff2') format('woff2');
+ font-weight: 800;
+ font-style: normal;
+ font-display: swap;
}
:root {
/* Brand Colours */
@@ -153,7 +153,8 @@
/* Pulse Animations */
@keyframes pulse {
- 0%, 100% {
+ 0%,
+ 100% {
opacity: 1;
}
50% {
@@ -162,15 +163,17 @@
}
@keyframes fast-pulse {
- 0%, 50%, 100% {
+ 0%,
+ 50%,
+ 100% {
opacity: 1;
}
- 25%, 75% {
+ 25%,
+ 75% {
opacity: 0;
}
}
-
body {
margin: 0;
padding: 0;
diff --git a/src/lib/utils/time.ts b/src/lib/utils/time.ts
index 5830fd6..21c03a5 100644
--- a/src/lib/utils/time.ts
+++ b/src/lib/utils/time.ts
@@ -23,27 +23,28 @@ export function formatUkTime(dateStr: string | Date | undefined): string {
* @param 'Schedule Location' object
* @returns Delay string for departure boards
*/
-export function calculateDelay(loc: ApiTrainsTrainDetails.ServiceLocation): {val: string, type: string} {
-const pairs = [
- { actual: loc.atd, sched: loc.ptd ?? loc.wtd },
- { actual: loc.ata, sched: loc.pta ?? loc.wta },
- { actual: loc.atp, sched: loc.wtp }
- ];
+export function calculateDelay(loc: ApiTrainsTrainDetails.ServiceLocation): {
+ val: string;
+ type: string;
+} {
+ const pairs = [
+ { actual: loc.atd, sched: loc.ptd ?? loc.wtd },
+ { actual: loc.ata, sched: loc.pta ?? loc.wta },
+ { actual: loc.atp, sched: loc.wtp }
+ ];
- const match = pairs.find(p => p.actual && p.sched);
+ const match = pairs.find((p) => p.actual && p.sched);
- if (!match || !match.actual || !match.sched) return {val: '', type: 'none'};
+ if (!match || !match.actual || !match.sched) return { val: '', type: 'none' };
- const diffMinutes = Math.round(
- (Date.parse(match.actual) - Date.parse(match.sched)) / 60000
- );
+ const diffMinutes = Math.round((Date.parse(match.actual) - Date.parse(match.sched)) / 60000);
- if (diffMinutes === 0) return {val: 'RT', type: 'ontime'};
+ if (diffMinutes === 0) return { val: 'RT', type: 'ontime' };
- const absDiff = Math.abs(diffMinutes);
- if (diffMinutes > 0) {
- return { val: `${absDiff}L`, type: 'late' };
- } else {
- return { val: `${absDiff}E`, type: 'early' };
- }
+ const absDiff = Math.abs(diffMinutes);
+ if (diffMinutes > 0) {
+ return { val: `${absDiff}L`, type: 'late' };
+ } else {
+ return { val: `${absDiff}E`, type: 'early' };
+ }
}