style: run prettier
All checks were successful
TrafficCue CI / check (push) Successful in 1m32s
TrafficCue CI / build (push) Successful in 9m41s
TrafficCue CI / build-android (push) Successful in 30m6s

This commit is contained in:
2025-09-29 19:00:25 +02:00
parent caf29ce60f
commit 1215c2ffb8
5 changed files with 32 additions and 22 deletions

View File

@ -20,7 +20,7 @@
alert("State mismatch. Please try again."); alert("State mismatch. Please try again.");
return; return;
} }
const token = await getOIDCUser(code, codeVerifier); const token = await getOIDCUser(code, codeVerifier);
localStorage.setItem("lnv-id", token.id_token); localStorage.setItem("lnv-id", token.id_token);
localStorage.setItem("lnv-token", token.access_token); localStorage.setItem("lnv-token", token.access_token);
@ -31,5 +31,5 @@
onMount(async () => { onMount(async () => {
await login(); await login();
location.href = "/"; location.href = "/";
}) });
</script> </script>

View File

@ -8,9 +8,7 @@
{#if saved.current.length != 0} {#if saved.current.length != 0}
<div> <div>
<h2 style="margin: 5px; margin-left: 0; font-size: 1.2em;"> <h2 style="margin: 5px; margin-left: 0; font-size: 1.2em;">Saved Routes</h2>
Saved Routes
</h2>
<div style="display: flex; flex-direction: column; gap: 10px;"> <div style="display: flex; flex-direction: column; gap: 10px;">
{#each saved.current as save, _index (save.name)} {#each saved.current as save, _index (save.name)}
@ -18,8 +16,9 @@
variant="secondary" variant="secondary"
onclick={() => { onclick={() => {
view.switch("trip", { route: save.data }); view.switch("trip", { route: save.data });
}}>{save.data.name}</Button> }}>{save.data.name}</Button
>
{/each} {/each}
</div> </div>
</div> </div>
{/if} {/if}

View File

@ -23,7 +23,7 @@
removeAllRoutes(); removeAllRoutes();
drawRoute(route); drawRoute(route);
if(route) { if (route) {
isSaved = await hasStore({ isSaved = await hasStore({
name: route.locations.map((l) => l.lat + "-" + l.lon).join(";"), name: route.locations.map((l) => l.lat + "-" + l.lon).join(";"),
type: "route", type: "route",
@ -59,22 +59,28 @@
variant="secondary" variant="secondary"
onclick={async () => { onclick={async () => {
if (isSaved) { if (isSaved) {
await updateStore({ await updateStore(
name: route.locations.map(l => l.lat + "-" + l.lon).join(";"), {
type: "route" name: route.locations.map((l) => l.lat + "-" + l.lon).join(";"),
}, null); type: "route",
},
null,
);
isSaved = false; isSaved = false;
// view.back(); // view.back();
} else { } else {
const name = prompt("Trip name?"); const name = prompt("Trip name?");
if (!name) return; if (!name) return;
await updateStore({ await updateStore(
name: route.locations.map(l => l.lat + "-" + l.lon).join(";"), {
type: "route" name: route.locations.map((l) => l.lat + "-" + l.lon).join(";"),
}, { type: "route",
...route, },
name {
}) ...route,
name,
},
);
isSaved = true; isSaved = true;
} }
}} }}

View File

@ -18,7 +18,12 @@
import { view } from "../../view.svelte"; import { view } from "../../view.svelte";
import { m } from "$lang/messages"; import { m } from "$lang/messages";
import { setOnboardingState } from "$lib/onboarding.svelte"; import { setOnboardingState } from "$lib/onboarding.svelte";
import { getDB, stores, syncStores, updateStore } from "$lib/services/stores.svelte"; import {
getDB,
stores,
syncStores,
updateStore,
} from "$lib/services/stores.svelte";
const dev = getDeveloperToggle(); const dev = getDeveloperToggle();

View File

@ -83,7 +83,7 @@ export async function syncStores() {
if (!(await hasCapability("stores"))) { if (!(await hasCapability("stores"))) {
return; return;
} }
if (!(localStorage.getItem("lnv-token"))) { if (!localStorage.getItem("lnv-token")) {
return; return;
} }
const db = await getDB(); const db = await getDB();