3.1.0.0
Vehicle Speed Calcs Extra At A Glance ranges New Driver profile
This commit is contained in:
@@ -29,7 +29,7 @@ import {
|
||||
activityVariantKeys, placeVariantKeys, workVariantKeys,
|
||||
UTCI_ENVIRONMENTS, VARIANT_DEFAULT_ENV,
|
||||
} from '../config.js';
|
||||
import { utciCategory } from '../utils.js';
|
||||
import { utciCategory, VEHICLE_SPEEDS } from '../utils.js';
|
||||
import { buildHourlyRows, aggregateRows } from '../compute.js';
|
||||
import { useForecast } from './useForecast.js';
|
||||
import { useColumnPopup } from './useColumnPopup.js';
|
||||
@@ -202,6 +202,14 @@ export function useAppState() {
|
||||
try { localStorage.setItem('sunscope_vehicle_vent', v ? '1' : '0'); } catch (e) { /* ignore */ }
|
||||
setVehicleVent(v);
|
||||
};
|
||||
// Road-speed class (key into VEHICLE_SPEEDS): 'static' | 'urban' | 'aroad' | 'motorway'.
|
||||
const [vehicleSpeed, setVehicleSpeed] = useState(() => {
|
||||
try { return localStorage.getItem('sunscope_vehicle_speed') || 'static'; } catch (e) { return 'static'; }
|
||||
});
|
||||
const setVehicleSpeedAndSave = (v) => {
|
||||
try { localStorage.setItem('sunscope_vehicle_speed', v); } catch (e) { /* ignore */ }
|
||||
setVehicleSpeed(v);
|
||||
};
|
||||
|
||||
const [outdoorsVariant, setOutdoorsVariant] = useState(() => {
|
||||
try { return localStorage.getItem('sunscope_outdoors_variant') || 'urban'; } catch (e) { return 'urban'; }
|
||||
@@ -220,6 +228,12 @@ export function useAppState() {
|
||||
// Auto-set UTCI environment modifier to match the selected variant.
|
||||
const defaultEnv = VARIANT_DEFAULT_ENV[v] ?? 'open';
|
||||
setUtciEnvAndSave(defaultEnv);
|
||||
// The Driver profile is about cab comfort - default the vehicle model to a
|
||||
// truck cab travelling at A-road speed.
|
||||
if (v === 'driver') {
|
||||
setVehicleTypeAndSave('truck');
|
||||
setVehicleSpeedAndSave('aroad');
|
||||
}
|
||||
};
|
||||
|
||||
const activeCols = activeProfile === 'outdoors'
|
||||
@@ -458,7 +472,9 @@ export function useAppState() {
|
||||
|
||||
// ── 9. COMPUTATION ───────────────────────────────────────────────────
|
||||
const { hourlyRows, days, utcOffsetMs } = buildHourlyRows({
|
||||
forecast, airQuality, location, vehicleType, vehicleVent, buildingType, utciEnv,
|
||||
forecast, airQuality, location, vehicleType, vehicleVent,
|
||||
vehicleSpeed: (VEHICLE_SPEEDS[vehicleSpeed] ?? VEHICLE_SPEEDS.static).mph,
|
||||
buildingType, utciEnv,
|
||||
});
|
||||
|
||||
const visible = days[selectedDay]?.rows || [];
|
||||
@@ -600,6 +616,7 @@ export function useAppState() {
|
||||
skinType, setSkinType,
|
||||
vehicleType, setVehicleType: setVehicleTypeAndSave,
|
||||
vehicleVent, setVehicleVent: setVehicleVentAndSave,
|
||||
vehicleSpeed, setVehicleSpeed: setVehicleSpeedAndSave,
|
||||
outdoorsVariant, setOutdoorsVariantAndSave,
|
||||
buildingType, setBuildingType: setBuildingTypeAndSave,
|
||||
indoorManaged, setIndoorManaged: setIndoorManagedAndSave,
|
||||
|
||||
Reference in New Issue
Block a user