From 7265103573e69e0e9b7964173ef8bf6017f4f95f Mon Sep 17 00:00:00 2001 From: Tony James Date: Sun, 31 May 2026 22:52:15 +0100 Subject: [PATCH] feat(tesla): charging widget + in-car From pill + hide vehicle picker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ChargingWidget: green topbar pill with live kW + battery + minutes-to-target, shown only when state.chargingState === 'Charging'. Animated bolt icon. - Vehicle picker chip is hidden whenever Tesla is connected (anywhere, not just in-car) — we already know the car from vehicle_config. - When in-car AND Tesla connected, the From input collapses to a static pill with a Tesla badge so the driver doesn't have to type on the touch keyboard. Destination input remains editable. --- client/src/pages/TeslaTripPlanner.tsx | 78 +++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 10 deletions(-) diff --git a/client/src/pages/TeslaTripPlanner.tsx b/client/src/pages/TeslaTripPlanner.tsx index de63ceb..3fe32cc 100644 --- a/client/src/pages/TeslaTripPlanner.tsx +++ b/client/src/pages/TeslaTripPlanner.tsx @@ -1396,7 +1396,11 @@ function TopBar({ onDisconnectTesla: () => void; inCar: boolean; }) { - const hideVehicleChip = inCar && !!teslaStatus?.connected; + // Tesla connected → we know the car, so the manual vehicle picker is dead weight. + const hideVehicleChip = !!teslaStatus?.connected; + // In-car AND connected → origin is the car's actual GPS, so collapse the + // From input to a static pill (typing on a touchscreen sucks). + const showFromAsPill = inCar && !!teslaStatus?.connected; const hideGpxChip = inCar; const [locating, setLocating] = React.useState(false); const handleLocate = async () => { @@ -1435,15 +1439,26 @@ function TopBar({ >
- onOriginChange(e.target.value)} - onKeyDown={(e) => { if (e.key === 'Enter') { e.currentTarget.blur(); onODCommit(); } }} - onBlur={onODCommit} - placeholder="From" - className="bg-transparent border-none outline-none text-[13px] w-full" - style={{ color: 'var(--gd-text)' }} - /> + {showFromAsPill ? ( +
+ + {origin || 'Locating your car…'} +
+ ) : ( + onOriginChange(e.target.value)} + onKeyDown={(e) => { if (e.key === 'Enter') { e.currentTarget.blur(); onODCommit(); } }} + onBlur={onODCommit} + placeholder="From" + className="bg-transparent border-none outline-none text-[13px] w-full" + style={{ color: 'var(--gd-text)' }} + /> + )}