From 144ef1f759f2ddb62bc1be38ae3e651297425af3 Mon Sep 17 00:00:00 2001 From: Walker Sutton Date: Wed, 30 Sep 2026 00:03:59 -0400 Subject: [PATCH] feat: Enduro HUD template with unit-tracking labels and compact units - label.unit_of: a label renders a metric's unit ("mph"/"km/h") and follows the unit-system setting instead of frozen static text - scene.compact_units: app-level "km/h" vs "kmh" style, applied to value suffixes, plot point labels and unit labels - new bundled enduro_hud template (+ website listing) - test that every bundled template deserializes Co-Authored-By: Claude Opus 5.5 --- app/src/components/layout/CenterCanvas.svelte | 1 + app/src/components/overlays/Settings.svelte | 11 + .../panels/ElementProperties.svelte | 37 +- app/src/lib/elementTypes.js | 8 +- app/src/state/appState.svelte.js | 33 +- src-tauri/render-core/src/activity.rs | 1 + src-tauri/render-core/src/chart.rs | 89 +- src-tauri/render-core/src/frame.rs | 1 + src-tauri/render-core/src/template.rs | 161 ++++ src-tauri/render-core/src/units.rs | 25 + .../render-core/tests/bundled_templates.rs | 37 + src-tauri/src/lib.rs | 2 + templates/README.md | 1 + templates/enduro_hud/README.md | 49 + templates/enduro_hud/enduro_hud.json | 909 ++++++++++++++++++ templates/enduro_hud/preview.jpg | Bin 0 -> 522175 bytes website/content/templates.json | 8 + .../public/templates/enduro_hud/preview.jpg | Bin 0 -> 522175 bytes 18 files changed, 1348 insertions(+), 25 deletions(-) create mode 100644 src-tauri/render-core/tests/bundled_templates.rs create mode 100644 templates/enduro_hud/README.md create mode 100644 templates/enduro_hud/enduro_hud.json create mode 100644 templates/enduro_hud/preview.jpg create mode 100644 website/public/templates/enduro_hud/preview.jpg diff --git a/app/src/components/layout/CenterCanvas.svelte b/app/src/components/layout/CenterCanvas.svelte index 7a05bb5..a7a1353 100644 --- a/app/src/components/layout/CenterCanvas.svelte +++ b/app/src/components/layout/CenterCanvas.svelte @@ -209,6 +209,7 @@ const _hasActivity = app.hasActivity void app.gpxFilename // reactive dep: re-run when GPX changes void app.units // reactive dep: the unit-system preference flips readouts + void app.compactUnits // reactive dep: the km/h↔kmh style flips readouts void previewW // reactive dep: re-render when the base target size changes void previewH // (export resolution, preview box size, or display pixel ratio) diff --git a/app/src/components/overlays/Settings.svelte b/app/src/components/overlays/Settings.svelte index 3483274..3b98ccc 100644 --- a/app/src/components/overlays/Settings.svelte +++ b/app/src/components/overlays/Settings.svelte @@ -73,6 +73,17 @@ ]} onchange={(v) => (app.units = v)} /> +

+ Speed unit style — how compound speed units are written. +

+ update('text', e.target.value)} /> + {#if item.unit_of} +

+ Shows the {UNIT_OF_OPTIONS.find((o) => o.value === item.unit_of)?.label.split(' ')[0].toLowerCase() ?? item.unit_of} unit + (e.g. {effectiveUnitLabel(item.unit_of)}) and follows your unit setting. +

+ {:else} + update('text', e.target.value)} /> + {/if} +