fix: slot buttons now update the time grid via saveViewSetting

The SettingsSidebar stores cellDuration in viewSettings (per-view) via
saveViewSetting, so getEffective() returns that value and ignores local
state. The QuickSettings/header/mobile buttons were only calling
setCellDuration (local state) + saveSetting (cookie), which getEffective
overrides. Now all three button groups also call saveViewSetting so the
grid immediately reflects the selected slot size.

v1.81.18
This commit is contained in:
mARTin 2026-04-02 22:58:15 +02:00
parent ca67817b7b
commit 4cab83e545
2 changed files with 4 additions and 3 deletions

View File

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

View File

@ -5450,7 +5450,7 @@ export default function WeeklyView() {
</span> </span>
<div style={{ display: "flex", gap: "4px" }}> <div style={{ display: "flex", gap: "4px" }}>
{(([15, 20, 30, 60] as CellDuration[])).map((d) => ( {(([15, 20, 30, 60] as CellDuration[])).map((d) => (
<button key={d} onClick={() => { setCellDuration(d); saveSetting("cellDuration", d); }} <button key={d} onClick={() => { setCellDuration(d); saveSetting("cellDuration", d); saveViewSetting("cellDuration", d, true); }}
style={{ flex: 1, padding: "5px 0", fontSize: "0.8rem", borderRadius: "6px", border: "none", cursor: "pointer", fontWeight: effectiveCellDuration === d ? 700 : 400, background: effectiveCellDuration === d ? (darkMode ? "#374151" : "#333") : (darkMode ? "#1f2937" : "#e5e7eb"), color: effectiveCellDuration === d ? "#fff" : (darkMode ? "#9ca3af" : "#6b7280") }}> style={{ flex: 1, padding: "5px 0", fontSize: "0.8rem", borderRadius: "6px", border: "none", cursor: "pointer", fontWeight: effectiveCellDuration === d ? 700 : 400, background: effectiveCellDuration === d ? (darkMode ? "#374151" : "#333") : (darkMode ? "#1f2937" : "#e5e7eb"), color: effectiveCellDuration === d ? "#fff" : (darkMode ? "#9ca3af" : "#6b7280") }}>
{d}m {d}m
</button> </button>
@ -5750,6 +5750,7 @@ export default function WeeklyView() {
onClick={() => { onClick={() => {
setCellDuration(duration); setCellDuration(duration);
saveSetting("cellDuration", duration); saveSetting("cellDuration", duration);
saveViewSetting("cellDuration", duration, true);
}} }}
className={`px-2 py-0.5 text-xs rounded transition-colors ${effectiveCellDuration === duration ? "bg-white shadow-sm font-bold text-black" : "text-gray-500 hover:text-gray-900 hover:bg-gray-200 dark:hover:bg-gray-700"}`} className={`px-2 py-0.5 text-xs rounded transition-colors ${effectiveCellDuration === duration ? "bg-white shadow-sm font-bold text-black" : "text-gray-500 hover:text-gray-900 hover:bg-gray-200 dark:hover:bg-gray-700"}`}
> >
@ -5995,7 +5996,7 @@ export default function WeeklyView() {
{(([15, 20, 30, 60] as CellDuration[])).map((duration) => ( {(([15, 20, 30, 60] as CellDuration[])).map((duration) => (
<button <button
key={duration} key={duration}
onClick={() => { setCellDuration(duration); saveSetting("cellDuration", duration); }} onClick={() => { setCellDuration(duration); saveSetting("cellDuration", duration); saveViewSetting("cellDuration", duration, true); }}
style={{ padding: "2px 8px", fontSize: "12px", borderRadius: "4px", border: "none", cursor: "pointer", fontWeight: effectiveCellDuration === duration ? 700 : 400, background: effectiveCellDuration === duration ? "var(--bg-secondary, #e5e7eb)" : "transparent", color: "inherit" }} style={{ padding: "2px 8px", fontSize: "12px", borderRadius: "4px", border: "none", cursor: "pointer", fontWeight: effectiveCellDuration === duration ? 700 : 400, background: effectiveCellDuration === duration ? "var(--bg-secondary, #e5e7eb)" : "transparent", color: "inherit" }}
> >
{duration}m {duration}m