run npm run format
This commit is contained in:
@@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
import { LOCATIONS } from '$lib/locations-object.svelte.ts';
|
import { LOCATIONS } from '$lib/locations-object.svelte.ts';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let { value = $bindable() } = $props();
|
let { value = $bindable() } = $props();
|
||||||
|
|
||||||
let showResults = $state(false);
|
let showResults = $state(false);
|
||||||
@@ -15,7 +13,6 @@
|
|||||||
|
|
||||||
const MAX_RESULTS = 5;
|
const MAX_RESULTS = 5;
|
||||||
|
|
||||||
|
|
||||||
function tokenize(query: string) {
|
function tokenize(query: string) {
|
||||||
return query.toLowerCase().trim().split(/\s+/).filter(Boolean);
|
return query.toLowerCase().trim().split(/\s+/).filter(Boolean);
|
||||||
}
|
}
|
||||||
@@ -41,8 +38,7 @@
|
|||||||
return a.n.localeCompare(b.n);
|
return a.n.localeCompare(b.n);
|
||||||
})
|
})
|
||||||
.slice(0, MAX_RESULTS);
|
.slice(0, MAX_RESULTS);
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (results) selectedIndex = -1;
|
if (results) selectedIndex = -1;
|
||||||
@@ -68,7 +64,7 @@
|
|||||||
selectedIndex = -1;
|
selectedIndex = -1;
|
||||||
value = '';
|
value = '';
|
||||||
console.log('Selected Location: ', JSON.stringify(loc));
|
console.log('Selected Location: ', JSON.stringify(loc));
|
||||||
const queryString = loc.c || loc.t
|
const queryString = loc.c || loc.t;
|
||||||
goto(`/board?loc=${queryString.toLowerCase()}`);
|
goto(`/board?loc=${queryString.toLowerCase()}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
interface LocationRecord {
|
interface LocationRecord {
|
||||||
n: string; // name
|
n: string; // name
|
||||||
t: string; // tiploc
|
t: string; // tiploc
|
||||||
c?: string; // crs
|
c?: string; // crs
|
||||||
s: string; // search string
|
s: string; // search string
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocationStore {
|
class LocationStore {
|
||||||
data = $state<LocationRecord[]>([]);
|
data = $state<LocationRecord[]>([]);
|
||||||
@@ -32,7 +32,6 @@ class LocationStore {
|
|||||||
return loc.t === query || loc.c === query;
|
return loc.t === query || loc.c === query;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const LOCATIONS = new LocationStore();
|
export const LOCATIONS = new LocationStore();
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
<section>
|
<section>Live board are not yet implemented on the server</section>
|
||||||
Live board are not yet implemented on the server
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
section {
|
section {
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ export const load: PageLoad = async ({ url }) => {
|
|||||||
await LOCATIONS.init(fetch);
|
await LOCATIONS.init(fetch);
|
||||||
}
|
}
|
||||||
|
|
||||||
let title: string = "";
|
let title: string = '';
|
||||||
|
|
||||||
if (!locId) {
|
if (!locId) {
|
||||||
error(400, {
|
error(400, {
|
||||||
message: 'Location not provided',
|
message: 'Location not provided',
|
||||||
owlCode: 'NO_LOCATION_IN_PATH',
|
owlCode: 'NO_LOCATION_IN_PATH'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,12 +26,12 @@ export const load: PageLoad = async ({ url }) => {
|
|||||||
} else {
|
} else {
|
||||||
error(404, {
|
error(404, {
|
||||||
message: `Location (${locId}) not found`,
|
message: `Location (${locId}) not found`,
|
||||||
owlCode: 'INVALID_LOCATION_CODE',
|
owlCode: 'INVALID_LOCATION_CODE'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
title,
|
title,
|
||||||
location,
|
location
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user