From 5bcf281502e69c32bcfba87750a644044ec7326c Mon Sep 17 00:00:00 2001 From: mARTin Date: Tue, 31 Mar 2026 09:31:36 +0200 Subject: [PATCH] fix: mobile sync icon no longer shifts date; selected day tracks last clicked column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mobile header: removed spinner/error from inside the date button, placed as a fixed-width (24px) sibling slot after the button — date text position is now stable regardless of sync state - Selected day: added selectedDay state tracking the last day column the user clicked; passed to getSelectedDay() so "Selektierter Tag" in the header reflects the actual cursor position, not just visibleDays[0] - getSelectedDay() priority: explicit selection → today if visible → first visible day - Navigating to a new week resets selectedDay so the header stays accurate v1.81.1 --- package.json | 2 +- src/components/WeeklyView.tsx | 30 +++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 89a4bb9..d578ab3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "my-weekly-todo-list", - "version": "1.81.0", + "version": "1.81.1", "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": { diff --git a/src/components/WeeklyView.tsx b/src/components/WeeklyView.tsx index a14ac30..ee160b4 100644 --- a/src/components/WeeklyView.tsx +++ b/src/components/WeeklyView.tsx @@ -415,8 +415,10 @@ function formatCustomHeader(format: string, days: Date[], language: string, t: a return format.replace(regex, (match) => tokens[match] || match); } -// Get the "selected" day for current_day header: today if visible, otherwise first visible day -function getSelectedDay(days: Date[]): Date { +// Get the "selected" day for current_day header. +// Priority: explicit selection → today if visible → first visible day +function getSelectedDay(days: Date[], explicitSelection?: Date | null): Date { + if (explicitSelection) return explicitSelection; const today = new Date(); return days.some(d => d.getDate() === today.getDate() && @@ -792,6 +794,9 @@ export default function WeeklyView() { const [isMobile, setIsMobile] = useState(false); const [isPortrait, setIsPortrait] = useState(false); + // Tracks the last day column the user interacted with (for "selected day" header display) + const [selectedDay, setSelectedDay] = useState(null); + const [showMobileFabSheet, setShowMobileFabSheet] = useState(false); const [showMobileFabMenu, setShowMobileFabMenu] = useState(false); const [mobileStickyDay, setMobileStickyDay] = useState(null); @@ -3429,6 +3434,7 @@ export default function WeeklyView() { } setCurrentWeekStart(newDate); setSlideDirection(direction === "left" ? "next" : "prev"); + setSelectedDay(null); // reset so header shows the new week's today/first day }; const goToPrevWeek = () => @@ -5601,17 +5607,13 @@ export default function WeeklyView() { - {/* Center: Date display (tap to jump to date) */} + {/* Center: Date display (tap to jump to date) + fixed-width sync slot */} + {/* Sync status indicator — fixed width so date never shifts */} +
+ {syncError + ? + : (isLoading || isSyncing || syncStatus === "syncing") + ?
+ : null} +
+ {/* Right: Settings menu */}