Run prettier for formatting fixes

This commit is contained in:
Fred Boniface 2024-07-12 15:29:55 +01:00
parent 2b8d32f3c9
commit 31b4653ca2
13 changed files with 54 additions and 58 deletions

View File

@ -3,7 +3,7 @@
<style> <style>
#banner { #banner {
width: 200px; width: 200px;
background: rgba(255, 0, 0,0.5); background: rgba(255, 0, 0, 0.5);
color: #ffffff7a; color: #ffffff7a;
position: fixed; position: fixed;
text-align: center; text-align: center;

View File

@ -3,7 +3,7 @@
export let text: string; export let text: string;
</script> </script>
<a class="link-button" href="{link}">{text}</a> <a class="link-button" href={link}>{text}</a>
<style> <style>
.link-button { .link-button {
@ -32,6 +32,6 @@
.link-button:hover { .link-button:hover {
box-shadow: var(--box-shadow-dark); box-shadow: var(--box-shadow-dark);
background-color: rgb(45,45,45); background-color: rgb(45, 45, 45);
} }
</style> </style>

View File

@ -31,6 +31,6 @@
.script-button:hover { .script-button:hover {
box-shadow: var(--box-shadow-dark); box-shadow: var(--box-shadow-dark);
background-color: rgb(45,45,45); background-color: rgb(45, 45, 45);
} }
</style> </style>

View File

@ -40,7 +40,7 @@
try { try {
const apiResponse = (await apiGet(apiPath)) as NearestStationResponse[]; const apiResponse = (await apiGet(apiPath)) as NearestStationResponse[];
stations = apiResponse; stations = apiResponse;
nearToMeCache.set(apiResponse) nearToMeCache.set(apiResponse);
} catch (err) { } catch (err) {
errorMessage = err as string; errorMessage = err as string;
} finally { } finally {
@ -54,7 +54,7 @@
errorMessage = "Register to use this feature"; errorMessage = "Register to use this feature";
} else { } else {
if ($nearToMeCache.length) { if ($nearToMeCache.length) {
stations = $nearToMeCache stations = $nearToMeCache;
} }
getNearestStations(); getNearestStations();
} }
@ -66,26 +66,24 @@
<Card {config}> <Card {config}>
{#if blockLoading} {#if blockLoading}
<InLineLoading /> <InLineLoading />
{:else} {:else if !$uuid || $uuid === "null"}
{#if !$uuid || $uuid === "null"} <LinkButton text="Register to use this feature" link="/more/reg" />
<LinkButton text="Register to use this feature" link="/more/reg" /> {:else if $location}
{:else if $location} {#if !stations.length}
{#if !stations.length} {#if errorMessage}
{#if errorMessage} <p>{errorMessage}</p>
<p>{errorMessage}</p>
{:else}
<InLineLoading />
{/if}
{:else} {:else}
<div id="buttons"> <InLineLoading />
{#each stations as station}
<LinkButton text={`${station.NLCDESC} - ${station.miles}mi`} link={`/ldb?station=${station["3ALPHA"]}`} />
{/each}
</div>
{/if} {/if}
{:else} {:else}
<ScriptButton text={"Turn on Location"} fn={turnOnLocation} /> <div id="buttons">
{#each stations as station}
<LinkButton text={`${station.NLCDESC} - ${station.miles}mi`} link={`/ldb?station=${station["3ALPHA"]}`} />
{/each}
</div>
{/if} {/if}
{:else}
<ScriptButton text={"Turn on Location"} fn={turnOnLocation} />
{/if} {/if}
</Card> </Card>

View File

@ -11,7 +11,7 @@
helpText: "", helpText: "",
onRefresh: () => {}, onRefresh: () => {},
refreshing: false, refreshing: false,
} };
</script> </script>
<Card config={upstreamProps}> <Card config={upstreamProps}>

View File

@ -1,6 +1,6 @@
<script> <script>
import { IconAlertCircle } from "@tabler/icons-svelte"; import { IconAlertCircle } from "@tabler/icons-svelte";
import { fly } from "svelte/transition"; import { fly } from "svelte/transition";
export let alerts = []; export let alerts = [];
$: uniqueAlerts = [...new Set(alerts)]; $: uniqueAlerts = [...new Set(alerts)];

View File

@ -31,7 +31,7 @@
let updatedTime: Date; let updatedTime: Date;
async function callFetch(station: string): Promise<StaffLdb> { async function callFetch(station: string): Promise<StaffLdb> {
console.log("callFetch function called") console.log("callFetch function called");
const data = await fetchStaffLdb(station); const data = await fetchStaffLdb(station);
if (data.data) { if (data.data) {
title = data.data.locationName; title = data.data.locationName;
@ -53,8 +53,7 @@
onMount(async () => { onMount(async () => {
console.log("staff-ldb component mounted"); console.log("staff-ldb component mounted");
}) });
</script> </script>
{#if nrcc.length} {#if nrcc.length}
@ -73,7 +72,6 @@
<Loading /> <Loading />
{:then data} {:then data}
{#if data} {#if data}
{#if data.trainServices?.length} {#if data.trainServices?.length}
<TableGenerator services={data.trainServices} click={showDetail} /> <TableGenerator services={data.trainServices} click={showDetail} />
{/if} {/if}

View File

@ -75,7 +75,7 @@
<p class="smallScreen">Your display is too small to view this data</p> <p class="smallScreen">Your display is too small to view this data</p>
<p class="smallScreen">Try rotating your device</p> <p class="smallScreen">Try rotating your device</p>
<table in:fade={{duration:500}}> <table in:fade={{ duration: 500 }}>
<tr> <tr>
<th class="id">ID</th> <th class="id">ID</th>
<th class="from">From</th> <th class="from">From</th>

View File

@ -4,29 +4,29 @@
export let updatedTime: Date | undefined; export let updatedTime: Date | undefined;
let currentTime: string = "00:00:00" let currentTime: string = "00:00:00";
let updateDisplay: string; let updateDisplay: string;
function updateTime() { function updateTime() {
const now = new Date(); const now = new Date();
const hours = now.getHours().toString().padStart(2, '0'); const hours = now.getHours().toString().padStart(2, "0");
const mins = now.getMinutes().toString().padStart(2, '0'); const mins = now.getMinutes().toString().padStart(2, "0");
const secs = now.getSeconds().toString().padStart(2, '0'); const secs = now.getSeconds().toString().padStart(2, "0");
currentTime = `${hours}:${mins}:${secs}` currentTime = `${hours}:${mins}:${secs}`;
} }
onMount(() => { onMount(() => {
console.log("TimeBar component mounted") console.log("TimeBar component mounted");
updateTime(); updateTime();
const interval = setInterval(updateTime, 250); const interval = setInterval(updateTime, 250);
return () => clearInterval(interval); return () => clearInterval(interval);
}) });
</script> </script>
<div id="TimeBar"> <div id="TimeBar">
{#if updatedTime} {#if updatedTime}
<span in:fade class="updated-time">Updated: {updatedTime.toLocaleTimeString()}</span> <span in:fade class="updated-time">Updated: {updatedTime.toLocaleTimeString()}</span>
{:else} {:else}
<span></span> <span />
{/if} {/if}
<span class="current-time">{currentTime}</span> <span class="current-time">{currentTime}</span>
</div> </div>
@ -42,12 +42,12 @@ onMount(() => {
padding: 0; padding: 0;
} }
.updated-time { .updated-time {
font-family: firamono, 'Courier New', Courier, monospace; font-family: firamono, "Courier New", Courier, monospace;
margin-left: 10px; margin-left: 10px;
font-size: 14px; font-size: 14px;
} }
.current-time { .current-time {
font-family: firamono, 'Courier New', Courier, monospace; font-family: firamono, "Courier New", Courier, monospace;
font-weight: 900; font-weight: 900;
vertical-align: middle; vertical-align: middle;
color: aliceblue; color: aliceblue;

View File

@ -8,7 +8,6 @@
]; ];
import { page } from "$app/stores"; import { page } from "$app/stores";
import { IconHome } from "@tabler/icons-svelte"; import { IconHome } from "@tabler/icons-svelte";
</script> </script>
<footer> <footer>

View File

@ -16,7 +16,7 @@
formAction: "/ldb", formAction: "/ldb",
placeholder: "enter crs/tiploc", placeholder: "enter crs/tiploc",
maxLen: 7, maxLen: 7,
fieldName: "station" fieldName: "station",
}, },
{ {
title: "Timetable & PIS", title: "Timetable & PIS",
@ -24,7 +24,7 @@
formAction: "/train", formAction: "/train",
placeholder: "enter headcode", placeholder: "enter headcode",
maxLen: 4, maxLen: 4,
fieldName: "headcode" fieldName: "headcode",
}, },
]; ];

View File

@ -27,7 +27,7 @@
helpText: "", helpText: "",
onRefresh: () => {}, onRefresh: () => {},
refreshing: false, refreshing: false,
} };
function load() { function load() {
isLoading = true; isLoading = true;
@ -41,8 +41,8 @@
async function getData() { async function getData() {
if (inputValue) { if (inputValue) {
const apiPath = `/api/v2/ref/reasonCode/${inputValue}`; const apiPath = `/api/v2/ref/reasonCode/${inputValue}`;
const res = await apiGet(apiPath) const res = await apiGet(apiPath);
return res return res;
} else { } else {
return []; return [];
} }

View File

@ -29,8 +29,9 @@
console.log("Refresh"); console.log("Refresh");
} }
</script> </script>
<Header title={"Test"} /> <Header title={"Test"} />
<TimeBar updatedTime={new Date} /> <TimeBar updatedTime={new Date()} />
<LookupCard config={LookupConfig} /> <LookupCard config={LookupConfig} />
<LookupCard config={TimetableConfig} /> <LookupCard config={TimetableConfig} />
<NearToMeCard /> <NearToMeCard />