feat!: improve saving locations
All checks were successful
TrafficCue CI / check (push) Successful in 1m6s
TrafficCue CI / build (push) Successful in 48s

Shows saved home and work locations with a marker on the map and provides a better API for saved locations opening room for more locations in the future

BREAKING CHANGE: no longer uses saved.home, saved.work localStorage entries, locations need to be re-entered to use the saved entry instead
This commit is contained in:
Cfp
2025-07-12 10:54:22 +02:00
parent 4b20143480
commit 4b520be5f9
7 changed files with 61 additions and 15 deletions

View File

@ -7,6 +7,7 @@
import VehicleSelector from "../VehicleSelector.svelte";
import Post from "../Post.svelte";
import RequiresCapability from "../RequiresCapability.svelte";
import { saved } from "$lib/saved.svelte";
</script>
<div
@ -18,12 +19,11 @@
variant="secondary"
class="flex-1"
onclick={() => {
const home = localStorage.getItem("saved.home");
if (!home) {
const { lat, lon } = saved.home;
if (!lat || !lon) {
alert("No home location saved.");
return;
}
const { lat, lon } = JSON.parse(home);
pin.dropPin(lat, lon);
pin.showInfo();
map.value?.flyTo({
@ -39,12 +39,11 @@
variant="secondary"
class="flex-1"
onclick={() => {
const work = localStorage.getItem("saved.work");
if (!work) {
const { lat, lon } = saved.work;
if (!lat || !lon) {
alert("No work location saved.");
return;
}
const { lat, lon } = JSON.parse(work);
pin.dropPin(lat, lon);
pin.showInfo();
map.value?.flyTo({