From 44e76144dda0d39e256d099e6bd4c0b955952914 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 23 Feb 2024 17:22:50 -0800 Subject: [PATCH] add skeleton placeholders --- client/src/app.css | 4 ++++ client/src/lib/Dashboard/Compass.svelte | 7 ++++--- client/src/lib/Dashboard/Dashboard.svelte | 2 +- client/src/lib/Dashboard/SpeedLimit.svelte | 11 ++++++++--- client/src/lib/Dashboard/Speedometer.svelte | 13 +++++++++++-- .../src/lib/Dashboard/TopBar/BatteryDisplay.svelte | 8 ++++++-- client/src/lib/Dashboard/TopBar/GearSelector.svelte | 5 ++++- 7 files changed, 38 insertions(+), 12 deletions(-) diff --git a/client/src/app.css b/client/src/app.css index 809c4f0..9342690 100644 --- a/client/src/app.css +++ b/client/src/app.css @@ -17,3 +17,7 @@ @apply bg-black text-white; } } + +.placeholder { + @apply text-neutral-300 bg-neutral-300 animate-pulse rounded-lg; +} diff --git a/client/src/lib/Dashboard/Compass.svelte b/client/src/lib/Dashboard/Compass.svelte index de3a3a2..a22fe28 100644 --- a/client/src/lib/Dashboard/Compass.svelte +++ b/client/src/lib/Dashboard/Compass.svelte @@ -16,13 +16,14 @@ export let orientation: number $: accResolved = Math.hypot(accx, accy) + $: placeholder = accx === -999 && accy === -999 -
-

+

+

Heading {getDirection(orientation)} ({orientation.toFixed(2)}°)

-

+

{getAcceleration(accResolved)} ({mpss2knps(accResolved).toFixed(2)} kn/s)

diff --git a/client/src/lib/Dashboard/Dashboard.svelte b/client/src/lib/Dashboard/Dashboard.svelte index 3319a41..56281eb 100644 --- a/client/src/lib/Dashboard/Dashboard.svelte +++ b/client/src/lib/Dashboard/Dashboard.svelte @@ -32,7 +32,7 @@
- +
diff --git a/client/src/lib/Dashboard/SpeedLimit.svelte b/client/src/lib/Dashboard/SpeedLimit.svelte index 5cd45e0..bb59b73 100644 --- a/client/src/lib/Dashboard/SpeedLimit.svelte +++ b/client/src/lib/Dashboard/SpeedLimit.svelte @@ -7,8 +7,6 @@ -->
SPEED
LIMIT
-
{formatted}
+
{speedLimit}
+ + diff --git a/client/src/lib/Dashboard/Speedometer.svelte b/client/src/lib/Dashboard/Speedometer.svelte index 395949a..fdc8d69 100644 --- a/client/src/lib/Dashboard/Speedometer.svelte +++ b/client/src/lib/Dashboard/Speedometer.svelte @@ -12,9 +12,18 @@ export let speed: number = 0.0 $: formatted = mps2mph(speed).toFixed(1) + + $: placeholder = speed === Math.hypot(-999, -999)
-
{formatted}
-
MPH
+
+ {placeholder ? '-----' : formatted} +
+
+ MPH +
diff --git a/client/src/lib/Dashboard/TopBar/BatteryDisplay.svelte b/client/src/lib/Dashboard/TopBar/BatteryDisplay.svelte index deeddd0..839f2c9 100644 --- a/client/src/lib/Dashboard/TopBar/BatteryDisplay.svelte +++ b/client/src/lib/Dashboard/TopBar/BatteryDisplay.svelte @@ -2,13 +2,17 @@ export let voltage: number $: formatted = voltage.toFixed(1) + + $: placeholder = voltage === -999 -
+
{formatted} V
- battery_horiz_075 + battery_horiz_075