diff --git a/src/lib/components/lnv/LocationSelect.svelte b/src/lib/components/lnv/LocationSelect.svelte index 6bfb12e..4164afa 100644 --- a/src/lib/components/lnv/LocationSelect.svelte +++ b/src/lib/components/lnv/LocationSelect.svelte @@ -7,7 +7,13 @@ import { Button } from "$lib/components/ui/button/index.js"; import { cn } from "$lib/utils.js"; import { m } from "$lang/messages"; - import { BriefcaseIcon, HomeIcon, LocateIcon, MapPinIcon, SchoolIcon } from "@lucide/svelte"; + import { + BriefcaseIcon, + HomeIcon, + LocateIcon, + MapPinIcon, + SchoolIcon, + } from "@lucide/svelte"; import { geocode } from "$lib/saved.svelte"; import { reverseGeocode, search, type Feature } from "$lib/services/Search"; @@ -15,26 +21,26 @@ { value: "current", label: m["location-selector.current"](), - icon: LocateIcon + icon: LocateIcon, }, { value: "home", label: m["saved.home"](), subtext: geocode("home"), - icon: HomeIcon + icon: HomeIcon, }, { value: "school", label: m["saved.school"](), subtext: geocode("school"), - icon: SchoolIcon + icon: SchoolIcon, }, { value: "work", label: m["saved.work"](), subtext: geocode("work"), - icon: BriefcaseIcon - } + icon: BriefcaseIcon, + }, ]; let open = $state(false); @@ -47,14 +53,22 @@ async function getCoordLabel(value: `${number},${number}`) { const splitter = value.split(","); - const res = await reverseGeocode({ lat: parseFloat(splitter[0]), lon: parseFloat(splitter[1]) }) - if(res.length == 0) return ""; + const res = await reverseGeocode({ + lat: parseFloat(splitter[0]), + lon: parseFloat(splitter[1]), + }); + if (res.length == 0) return ""; const feature = res[0]; return feature.properties.name; } const selectedValue = $derived( - new Promise(async r => { r(locations.find((f) => f.value === value)?.label || await getCoordLabel(value)) }) + new Promise((r) => { + r( + locations.find((f) => f.value === value)?.label || + getCoordLabel(value).then((v) => r(v)), + ); + }), ); // We want to refocus the trigger button when the user selects @@ -126,7 +140,7 @@ {#if searchbarText == ""} - {#each locations as location} + {#each locations as location, _index (location.value)} { @@ -135,17 +149,15 @@ }} style="flex-direction: column; align-items: start;" > -
- +
+ {location.label}
@@ -158,8 +170,11 @@ {/each} {/if} - {#each searchResults as result} - {@const resultValue = result.geometry.coordinates[1] + "," + result.geometry.coordinates[0]} + {#each searchResults as result, _index (result.properties.osm_id)} + {@const resultValue = + result.geometry.coordinates[1] + + "," + + result.geometry.coordinates[0]} { @@ -168,21 +183,23 @@ }} style="flex-direction: column; align-items: start;" > -
- +
+ {result.properties.name}
- {result.properties.street}{result.properties.housenumber ? " " + result.properties.housenumber : ""}, {result.properties.city} + {result.properties.street}{result.properties.housenumber + ? " " + result.properties.housenumber + : ""}, {result.properties.city} {/each} diff --git a/src/lib/components/lnv/Sidebar.svelte b/src/lib/components/lnv/Sidebar.svelte index 8465d6b..06d9eaf 100644 --- a/src/lib/components/lnv/Sidebar.svelte +++ b/src/lib/components/lnv/Sidebar.svelte @@ -48,7 +48,10 @@ let CurrentView: Component = $state(LoadingSidebar); const modules = import.meta.glob("./sidebar/**/*.svelte"); $effect(() => { - const path = modules[`./sidebar/${views[view.current.type] || "InvalidSidebar"}.svelte`]; + const path = + modules[ + `./sidebar/${views[view.current.type] || "InvalidSidebar"}.svelte` + ]; if (!path) { // Invalid view import("./sidebar/InvalidSidebar.svelte").then((m) => { diff --git a/src/lib/components/lnv/sidebar/LoadingSidebar.svelte b/src/lib/components/lnv/sidebar/LoadingSidebar.svelte index 37d7092..da28569 100644 --- a/src/lib/components/lnv/sidebar/LoadingSidebar.svelte +++ b/src/lib/components/lnv/sidebar/LoadingSidebar.svelte @@ -1 +1 @@ -Loading... \ No newline at end of file +Loading... diff --git a/src/lib/components/lnv/sidebar/MainSidebar.svelte b/src/lib/components/lnv/sidebar/MainSidebar.svelte index dfc3c1f..b31ab62 100644 --- a/src/lib/components/lnv/sidebar/MainSidebar.svelte +++ b/src/lib/components/lnv/sidebar/MainSidebar.svelte @@ -102,13 +102,18 @@ {#await getSaved() then saved} {#if saved.length != 0}
-

Saved Routes

+

+ Saved Routes +

- {#each saved as save} - + {#each saved as save, _index (save.name)} + {/each}
diff --git a/src/lib/components/lnv/sidebar/RouteSidebar.svelte b/src/lib/components/lnv/sidebar/RouteSidebar.svelte index 3d323f4..7250090 100644 --- a/src/lib/components/lnv/sidebar/RouteSidebar.svelte +++ b/src/lib/components/lnv/sidebar/RouteSidebar.svelte @@ -1,6 +1,5 @@