1.9
New SunSoak multiselect UTCI modifiers pulldown Linked new SunSoak to profiles Updated content to match new changes
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
FREE_DAYS, FILTER_PROFILES, OUTDOORS_VARIANTS,
|
||||
profileButtonOrder, variantIcons,
|
||||
activityVariantKeys, placeVariantKeys, workVariantKeys,
|
||||
UTCI_ENVIRONMENTS, VARIANT_DEFAULT_ENV,
|
||||
} from '../config.js';
|
||||
import { utciCategory } from '../utils.js';
|
||||
import { buildHourlyRows } from '../compute.js';
|
||||
@@ -196,6 +197,9 @@ export function useAppState() {
|
||||
const hasIndoor = variantCols['indoorT'] || variantCols['managedT'];
|
||||
setIndoorMode(hasIndoor ? 'on' : 'off');
|
||||
}
|
||||
// Auto-set UTCI environment modifier to match the selected variant.
|
||||
const defaultEnv = VARIANT_DEFAULT_ENV[v] ?? 'open';
|
||||
setUtciEnvAndSave(defaultEnv);
|
||||
};
|
||||
|
||||
const activeCols = activeProfile === 'outdoors'
|
||||
@@ -244,6 +248,20 @@ export function useAppState() {
|
||||
try { localStorage.setItem('sunscope_pollen_type', v); } catch (e) { /* ignore */ }
|
||||
setPollenType(v);
|
||||
};
|
||||
|
||||
const [utciEnv, setUtciEnv] = useState(() => {
|
||||
try {
|
||||
const saved = localStorage.getItem('sunscope_utci_env');
|
||||
if (saved && UTCI_ENVIRONMENTS[saved]) return saved;
|
||||
// No saved env - derive from the saved variant if it has a default.
|
||||
const savedVariant = localStorage.getItem('sunscope_outdoors_variant') || '';
|
||||
return VARIANT_DEFAULT_ENV[savedVariant] ?? 'open';
|
||||
} catch (e) { return 'open'; }
|
||||
});
|
||||
const setUtciEnvAndSave = (v) => {
|
||||
try { localStorage.setItem('sunscope_utci_env', v); } catch (e) { /* ignore */ }
|
||||
setUtciEnv(v);
|
||||
};
|
||||
|
||||
const [showDecimals, setShowDecimals] = useState(() => {
|
||||
try { const s = localStorage.getItem('sunscope_show_decimals'); return s === null ? false : s !== '0'; } catch (e) { return false; }
|
||||
@@ -359,7 +377,7 @@ export function useAppState() {
|
||||
|
||||
// ── 9. COMPUTATION ───────────────────────────────────────────────────
|
||||
const { hourlyRows, days, utcOffsetMs } = buildHourlyRows({
|
||||
forecast, airQuality, location, vehicleType, vehicleVent, buildingType,
|
||||
forecast, airQuality, location, vehicleType, vehicleVent, buildingType, utciEnv,
|
||||
});
|
||||
|
||||
const visible = days[selectedDay]?.rows || [];
|
||||
@@ -497,6 +515,7 @@ export function useAppState() {
|
||||
indoorManaged, setIndoorManaged: setIndoorManagedAndSave,
|
||||
indoorMode, setIndoorMode: setIndoorModeAndSave,
|
||||
pollenType, setPollenTypeAndSave,
|
||||
utciEnv, setUtciEnv: setUtciEnvAndSave,
|
||||
showDecimals, toggleShowDecimals,
|
||||
showUnits, toggleShowUnits,
|
||||
// table refs
|
||||
|
||||
Reference in New Issue
Block a user