Add NRCC to new board
This commit is contained in:
parent
bb12b98780
commit
53c2562b70
@ -5,6 +5,7 @@
|
|||||||
import { detailInit, defineDetail } from './train-detail';
|
import { detailInit, defineDetail } from './train-detail';
|
||||||
import TrainDetail from './train-detail.svelte';
|
import TrainDetail from './train-detail.svelte';
|
||||||
import { fetchStaffLdb } from './fetch';
|
import { fetchStaffLdb } from './fetch';
|
||||||
|
import AlertBar from '../nrcc/alert-bar.svelte';
|
||||||
|
|
||||||
export let station: string;
|
export let station: string;
|
||||||
export let title: string | undefined = 'Loading...';
|
export let title: string | undefined = 'Loading...';
|
||||||
@ -13,6 +14,7 @@
|
|||||||
code: '',
|
code: '',
|
||||||
message: '',
|
message: '',
|
||||||
};
|
};
|
||||||
|
let nrcc: string[] = [];
|
||||||
|
|
||||||
let detail = detailInit();
|
let detail = detailInit();
|
||||||
function hideDetail() {
|
function hideDetail() {
|
||||||
@ -28,6 +30,11 @@
|
|||||||
const data = await fetchStaffLdb(station);
|
const data = await fetchStaffLdb(station);
|
||||||
if (data.data) {
|
if (data.data) {
|
||||||
title = data.data.locationName;
|
title = data.data.locationName;
|
||||||
|
if (data.data?.nrccMessages) {
|
||||||
|
for (const msg of data.data.nrccMessages) {
|
||||||
|
nrcc.push(msg.xhtmlMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
errorDetail.code = data.obStatus.toString() || "UNKNOWN";
|
errorDetail.code = data.obStatus.toString() || "UNKNOWN";
|
||||||
@ -60,6 +67,9 @@
|
|||||||
<span class="table-head-text">Ferry Services</span>
|
<span class="table-head-text">Ferry Services</span>
|
||||||
<TableGenerator services={data.ferryServices} click={showDetail} />
|
<TableGenerator services={data.ferryServices} click={showDetail} />
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if nrcc.length}
|
||||||
|
<AlertBar alerts={nrcc} />
|
||||||
|
{/if}
|
||||||
<!-- NRCC Alerts are not available -->
|
<!-- NRCC Alerts are not available -->
|
||||||
{/if}
|
{/if}
|
||||||
{:catch}
|
{:catch}
|
||||||
|
Loading…
Reference in New Issue
Block a user