From 198cd4eb3d4375855da0678449e0968d280ddde5 Mon Sep 17 00:00:00 2001 From: Cfp Date: Thu, 14 Aug 2025 13:36:14 +0200 Subject: [PATCH] feat: add more infos to info sidebar --- .../components/lnv/info/FuelStation.svelte | 54 ++++++++++--------- .../components/lnv/info/InternetAccess.svelte | 21 ++++++++ .../components/lnv/info/RestaurantInfo.svelte | 22 ++++++++ .../components/lnv/sidebar/InfoSidebar.svelte | 28 +++++++--- 4 files changed, 93 insertions(+), 32 deletions(-) create mode 100644 src/lib/components/lnv/info/InternetAccess.svelte create mode 100644 src/lib/components/lnv/info/RestaurantInfo.svelte diff --git a/src/lib/components/lnv/info/FuelStation.svelte b/src/lib/components/lnv/info/FuelStation.svelte index 60d4603..4c8df3d 100644 --- a/src/lib/components/lnv/info/FuelStation.svelte +++ b/src/lib/components/lnv/info/FuelStation.svelte @@ -1,6 +1,7 @@ @@ -9,33 +10,34 @@ -

Prices

-{#await getStations(lat, lng)} -

Loading fuel prices...

-{:then stations} - {#if stations.stations.length > 0} - {@const station = stations.stations[0]} - {#if station.diesel} -

Diesel: {station.diesel}

+ +

Prices

+ {#await getStations(lat, lng)} +

Loading fuel prices...

+ {:then stations} + {#if stations.stations.length > 0} + {@const station = stations.stations[0]} + {#if station.diesel} +

Diesel: {station.diesel}

+ {/if} + {#if station.e10} +

E10: {station.e10}

+ {/if} + {#if station.e5} +

E5: {station.e5}

+ {/if} + {:else} +

No fuel prices available.

{/if} - {#if station.e10} -

E10: {station.e10}

- {/if} - {#if station.e5} -

E5: {station.e5}

- {/if} - {:else} -

No fuel prices available.

- {/if} -{:catch err} -

Error loading fuel prices: {err.message}

-{/await} + {:catch err} +

Error loading fuel prices: {err.message}

+ {/await} +
diff --git a/src/lib/components/lnv/info/InternetAccess.svelte b/src/lib/components/lnv/info/InternetAccess.svelte new file mode 100644 index 0000000..01d31c1 --- /dev/null +++ b/src/lib/components/lnv/info/InternetAccess.svelte @@ -0,0 +1,21 @@ + + +{#if tag != "no"} +

Internet Access

+ {#each splitter as value, _index (value)} + {value} + {/each} + {#if tags["internet_access:fee"] && tags["internet_access:fee"] != "no"} + Fee: {tags["internet_access:fee"]} + {/if} + {#if tags["internet_access:ssid"]} + {tags["internet_access:ssid"]} + {/if} +{/if} \ No newline at end of file diff --git a/src/lib/components/lnv/info/RestaurantInfo.svelte b/src/lib/components/lnv/info/RestaurantInfo.svelte new file mode 100644 index 0000000..1ea4ddc --- /dev/null +++ b/src/lib/components/lnv/info/RestaurantInfo.svelte @@ -0,0 +1,22 @@ + + +{#if matchingTags.length > 0} +

Restaurant

+ +{/if} \ No newline at end of file diff --git a/src/lib/components/lnv/sidebar/InfoSidebar.svelte b/src/lib/components/lnv/sidebar/InfoSidebar.svelte index fc42ae4..9c00e58 100644 --- a/src/lib/components/lnv/sidebar/InfoSidebar.svelte +++ b/src/lib/components/lnv/sidebar/InfoSidebar.svelte @@ -23,12 +23,16 @@ import MapAi from "../info/MapAI.svelte"; import RequiresCapability from "../RequiresCapability.svelte"; import { saved, saveLocations } from "$lib/saved.svelte"; + import { getDeveloperToggle } from "./settings/developer.svelte"; + import InternetAccess from "../info/InternetAccess.svelte"; + import RestaurantInfo from "../info/RestaurantInfo.svelte"; // let { feature }: { feature: Feature } = $props(); // let Icon = $derived(POIIcons[feature.properties.osm_key + "=" + feature.properties.osm_value]); let { lat, lng }: { lat: number; lng: number } = $props(); + const dev = getDeveloperToggle(); function getIcon( tags: Record, @@ -207,6 +211,16 @@ Set as Work + {#if dev.current} + + {/if} @@ -228,10 +242,14 @@ {/if} + {#if tags.internet_access} + + {/if} + + + {#if tags.amenity == "fuel"} - - - + {/if} @@ -239,7 +257,7 @@

Payment Methods

    {#each Object.entries(tags).filter( ([key]) => key.startsWith("payment:"), ) as [key, value] (key)} - {key.replace("payment:", "")}: {value} + {key.replace("payment:", "")}{value == "yes" ? "" : ": " + value} {/each}
{/if} @@ -249,8 +267,6 @@ © OpenStreetMap - -
{JSON.stringify(elements, null, 2)}
{/if} {:catch err}