fix: weather sidebar toggle — remove sub-checkboxes, fix toggle reliability

Remove the per-field weather checkboxes from the quick-settings sidebar;
those belong in the full settings modal only.

Also make the toggle more reliable: it now updates both the per-view
viewSettings override (saveViewSetting) AND the local profile state
(setProfile) so that effectiveWeatherEnabled is guaranteed to flip on
the next render regardless of which branch getEffective() takes.

v1.83.4
This commit is contained in:
mARTin 2026-04-05 12:42:41 +02:00
parent b6c47c81b3
commit 2016b1cb18
2 changed files with 3 additions and 36 deletions

View File

@ -1,6 +1,6 @@
{
"name": "my-weekly-todo-list",
"version": "1.83.3",
"version": "1.83.4",
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js",
"scripts": {

View File

@ -5569,47 +5569,14 @@ export default function WeeklyView() {
{effectiveShowProjectIcons ? <Eye size={16} /> : <EyeOff size={16} />}
</button>
</div>
{(profile.weatherEnabled || profile.weatherLat || profile.weatherLon) && (<>
{(profile.weatherEnabled || profile.weatherLat || profile.weatherLon) && (
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
<span style={{ fontSize: "0.75rem", fontWeight: 600, color: darkMode ? "#9ca3af" : "#6b7280" }}>{profile.language === "de" ? "Wetter" : "Weather"}</span>
<button onClick={() => saveViewSetting("weatherEnabled", !effectiveWeatherEnabled, true)} style={{ background: "none", border: "none", cursor: "pointer", padding: "2px", color: darkMode ? "#9ca3af" : "#6b7280" }}>
<button onClick={() => { const v = !effectiveWeatherEnabled; setProfile((p: any) => ({ ...p, weatherEnabled: v })); saveViewSetting("weatherEnabled", v, true); }} style={{ background: "none", border: "none", cursor: "pointer", padding: "2px", color: darkMode ? "#9ca3af" : "#6b7280" }}>
{effectiveWeatherEnabled ? <Eye size={16} /> : <EyeOff size={16} />}
</button>
</div>
{effectiveWeatherEnabled && (
<div style={{ display: "flex", flexDirection: "column", gap: "2px", paddingLeft: "4px" }}>
{([
{ key: "icon" as WeatherDisplayKey, label: profile.language === "de" ? "Symbol" : "Icon" },
{ key: "temp" as WeatherDisplayKey, label: profile.language === "de" ? "Temperatur" : "Temperature" },
{ key: "feelsLike" as WeatherDisplayKey, label: profile.language === "de" ? "Gefühlt" : "Feels like" },
{ key: "wind" as WeatherDisplayKey, label: profile.language === "de" ? "Wind" : "Wind" },
{ key: "gusts" as WeatherDisplayKey, label: profile.language === "de" ? "Böen" : "Gusts" },
{ key: "precipProb" as WeatherDisplayKey, label: profile.language === "de" ? "Regenw." : "Rain prob." },
{ key: "precip" as WeatherDisplayKey, label: profile.language === "de" ? "Niederschlag" : "Precip. (mm)" },
{ key: "humidity" as WeatherDisplayKey, label: profile.language === "de" ? "Luftfeuchte" : "Humidity" },
{ key: "uv" as WeatherDisplayKey, label: "UV" },
] as { key: WeatherDisplayKey; label: string }[]).map(({ key, label }) => {
const checked = effectiveWeatherDisplay.includes(key);
return (
<label key={key} style={{ display: "flex", alignItems: "center", gap: "6px", cursor: "pointer", fontSize: "0.72rem", color: darkMode ? "#9ca3af" : "#6b7280" }}>
<input
type="checkbox"
checked={checked}
onChange={() => {
const updated = checked
? effectiveWeatherDisplay.filter(k => k !== key)
: [...effectiveWeatherDisplay, key];
saveViewSetting("weatherDisplay", updated.length > 0 ? updated : ["icon"], true);
}}
style={{ width: "12px", height: "12px", accentColor: darkMode ? "#6366f1" : "#2563eb" }}
/>
{label}
</label>
);
})}
</div>
)}
</>)}
{/* Start on */}
<div style={{ display: "flex", flexDirection: "column", gap: "6px" }}>