feat: add speed limit display
Some checks failed
TrafficCue CI / check (push) Failing after 1m53s
TrafficCue CI / build (push) Successful in 10m10s
TrafficCue CI / build-android (push) Successful in 30m40s

This commit is contained in:
2025-10-20 17:51:06 +02:00
parent b46646a462
commit 4ef2667c4e
5 changed files with 366 additions and 1 deletions

View File

@ -14,6 +14,7 @@
import RequiresCapability from "./RequiresCapability.svelte";
import {
advertiseRemoteLocation,
getRoadMetadata,
location,
remoteLocation,
} from "./location.svelte";
@ -27,6 +28,7 @@
import Progressbar from "../Progressbar.svelte";
import { postHazard } from "$lib/services/lnv";
import { fetchHazards } from "./hazards.svelte";
import { getSpeed } from "$lib/services/TileMeta";
const views: Record<string, string> = {
main: "MainSidebar",
@ -180,6 +182,17 @@
{(location.speed * 3.6 | 0).toFixed(0)}
</div>
{/if}
{#if getRoadMetadata()}
{@const meta = getRoadMetadata()!}
{#if meta.maxspeed}
{@const maxspeed = getSpeed(meta.maxspeed)}
{#if maxspeed && maxspeed < 100}
<div id="max-speed" style="position: fixed; {mobileView ? `bottom: calc(50px + ${sidebarHeight.current}px + 10px + 2ch + 20px + 10px); right: 10px;` : "bottom: calc(10px + 2ch + 20px + 10px); right: 10px;"}">
{meta.maxspeed}
</div>
{/if}
{/if}
{/if}
<div
id="sidebar"
@ -406,7 +419,8 @@
padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
#speedometer {
#speedometer,
#max-speed {
z-index: 30;
background-color: hsla(0, 0%, 5%, 0.6);
backdrop-filter: blur(5px);
@ -417,5 +431,12 @@
border-radius: 10px;
text-align: center;
width: calc(2ch + 20px);
height: calc(2ch + 20px);
}
#max-speed {
border-radius: 50%;
border: 5px solid red;
padding: 5px;
}
</style>