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 @@
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 {

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,8 +66,7 @@
<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}
@ -86,7 +85,6 @@
{:else} {:else}
<ScriptButton text={"Turn on Location"} fn={turnOnLocation} /> <ScriptButton text={"Turn on Location"} fn={turnOnLocation} />
{/if} {/if}
{/if}
</Card> </Card>
<style> <style>

View File

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

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

@ -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 />