Replace homescreen 'islands' with 'cards' and remove now unused 'island' components

This commit is contained in:
Fred Boniface
2024-07-07 21:02:10 +01:00
parent 9ad046dd9f
commit 512c77e81c
9 changed files with 37 additions and 209 deletions

View File

@@ -1,36 +1,35 @@
<script lang="ts">
import Header from "$lib/navigation/header.svelte";
import Nav from "$lib/navigation/nav.svelte";
import InputIsland from "$lib/islands/input-island-form.svelte";
import QuickLinkIsland from "$lib/islands/quick-link-island.svelte";
import Welcome from "$lib/overlays/welcome.svelte";
import { welcome } from "$lib/stores/welcome";
import { version, showWelcome } from "$lib/stores/version";
import { featureDetect } from "$lib/scripts/featureDetect";
import { onMount } from "svelte";
import toast from "svelte-french-toast";
import NearToMeIsland from "$lib/islands/near-to-me-island.svelte";
import type { LookupCardConfig } from "$lib/cards/Card.types";
import LookupCard from "$lib/cards/LookupCard.svelte";
import NearToMeCard from "$lib/cards/NearToMeCard.svelte";
import QuickLinkCard from "$lib/cards/QuickLinkCard.svelte";
const title = "OwlBoard";
const inputIslands = [
const lookupCards: LookupCardConfig[] = [
{
title: "Live Departure Boards",
action: "/ldb",
placeholder: "Enter CRS/TIPLOC",
queryName: "station",
title: "Live Arr/Dep Boards",
helpText: "",
formAction: "/ldb",
placeholder: "enter crs/tiploc",
maxLen: 7,
fieldName: "station"
},
{
title: "Train Details & PIS",
action: "/train",
placeholder: "Enter Headcode",
queryName: "headcode",
title: "Timetable & PIS",
helpText: "",
formAction: "/train",
placeholder: "enter headcode",
maxLen: 4,
fieldName: "headcode"
},
];
onMount(async () => {
const featureSupport = featureDetect();
console.log(featureSupport);
if (!featureSupport.critical) {
toast.error("Your browser is missing critical features, OwlBoard might not work properly. See `Menu > Statistics` for more information.");
} else if (!featureSupport.nice) {
@@ -39,15 +38,11 @@
});
</script>
{#if showWelcome && ($welcome === "null" || !$welcome || parseInt($welcome.replace(/\./g, "")) < parseInt(version.replace(/\./g, "")))}
<Welcome />
{/if}
<Header {title} />
{#each inputIslands as variables}
<InputIsland {variables} />
{#each lookupCards as config}
<LookupCard {config} />
{/each}
<NearToMeIsland />
<QuickLinkIsland />
<NearToMeCard />
<QuickLinkCard />
<Nav />