From c8cf245e4e4ca674fca7151e41312576a1b24bbd Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 10 Jan 2026 20:09:48 +0000 Subject: [PATCH 1/7] feat: handle null speed values as valid placeholder state Updates the geolocation handler to accept `null` speed values (common when stationary or acquiring fix) as valid updates rather than ignoring them. This triggers the UI to display the placeholder text instead of stale speed data, while correctly updating data freshness timestamps to prevent false warnings. --- package-lock.json | 4 ++-- package.json | 2 +- src/app.ts | 14 +++++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index aa64357..88e9b54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "speedometer", - "version": "0.0.84", + "version": "0.0.85", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "speedometer", - "version": "0.0.84", + "version": "0.0.85", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index dd00a77..3baac24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "speedometer", - "version": "0.0.84", + "version": "0.0.85", "description": "Minimal PWA speedometer that displays GPS speed. Includes TypeScript script to render PNG icons from SVG using sharp.", "license": "MIT", "private": true, diff --git a/src/app.ts b/src/app.ts index f64502f..498abdd 100644 --- a/src/app.ts +++ b/src/app.ts @@ -79,7 +79,12 @@ function updateUnitUI(): void { } // Render the speed (expects m/s) -function renderSpeed(metersPerSecond: number): void { +function renderSpeed(metersPerSecond: number | null): void { + if (metersPerSecond === null) { + showPlaceholder(); + return; + } + // Check validity if (!Number.isFinite(metersPerSecond) || metersPerSecond < 0) { setStatus("FIXME: Error"); @@ -267,8 +272,11 @@ function handlePosition(pos: GeolocationPosition): void { const { speed, accuracy } = pos.coords; - // Update speed only when native speed is provided and valid - if (typeof speed === "number" && Number.isFinite(speed) && speed >= 0) { + // Update speed only when native speed is provided and valid OR null + if ( + speed === null || + (typeof speed === "number" && Number.isFinite(speed) && speed >= 0) + ) { if (firstSpeedTimestamp === null) { firstSpeedTimestamp = now; } From 048203f99643202ef141554541bdff1e637a7423 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 11 Jan 2026 05:30:11 +0000 Subject: [PATCH 2/7] Update info popover logic to handle permission prompts dynamically - Replace static "Got it" button with dynamic button in `#info-popover` - Add `checkPermissions` logic using `navigator.permissions` API - Update popover UI state based on permission status (prompt vs granted) - Use `data-action` attribute for button behavior stability - Ensure popover remains open when asking for permissions - Hide warning message and switch to "Got it" when permissions are granted --- index.html | 2 +- package-lock.json | 4 +-- package.json | 2 +- src/app.ts | 72 +++++++++++++++++++++++++++++++++++++++++------ 4 files changed, 68 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index 7215ebf..77a2e4d 100644 --- a/index.html +++ b/index.html @@ -652,7 +652,7 @@