diff --git a/src/app.html b/src/app.html
index 7c40556..c7e23ff 100644
--- a/src/app.html
+++ b/src/app.html
@@ -4,7 +4,7 @@
-
+
([]);
loaded = $state(false);
- async init() {
+ async init(fetcher = fetch) {
if (this.loaded) return;
try {
- const res = await fetch('/api/tiplocs');
+ const res = await fetcher('/api/tiplocs');
this.data = await res.json();
this.loaded = true;
} catch (err) {
@@ -21,6 +21,18 @@ class LocationStore {
}
}
+ find(id: string | null): LocationRecord | undefined {
+ if (!id) return undefined;
+
+ const query = id.toUpperCase().trim();
+
+ console.log(query);
+
+ return this.data.find((loc) => {
+ return loc.t === query || loc.c === query;
+ });
+ }
+
}
export const LOCATIONS = new LocationStore();
\ No newline at end of file
diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte
index 779f0e5..5feeae3 100644
--- a/src/routes/+error.svelte
+++ b/src/routes/+error.svelte
@@ -59,12 +59,14 @@
color: var(--color-title);
max-width: 300px;
margin-top: 5px;
- margin-bottom: 30px;
+ margin-bottom: 20px;
}
.debug-info {
background: rgba(255, 255, 255, 0.05);
- padding: 5px 12px;
+ padding: 5px 15px;
+ margin-top: 0;
+ margin-bottom: 20px;
border-radius: 4px;
font-size: 0.8rem;
opacity: 0.6;
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 6a81584..e59e8e1 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -13,7 +13,7 @@
import { IconHome, IconDialpad, IconSettings, IconHelp, IconDots } from '@tabler/icons-svelte';
- onMount(() => LOCATIONS.init());
+ onMount(() => LOCATIONS.init(fetch));
let { children } = $props();
@@ -23,9 +23,9 @@
const navItems = [
{ label: 'Home', path: '/', icon: IconHome },
- { label: 'PIS', path: '/pis', icon: IconDialpad },
- { label: 'Options', path: '/preferences', icon: IconSettings },
- { label: 'About', path: '/about', icon: IconHelp }
+ { label: 'PIS', path: '/pis/', icon: IconDialpad },
+ { label: 'Options', path: '/preferences/', icon: IconSettings },
+ { label: 'About', path: '/about/', icon: IconHelp }
];
let navWidth = $state(0);
@@ -83,7 +83,7 @@