From 2d76ecf8695f1143236ab7b5849aef1717101fbb Mon Sep 17 00:00:00 2001 From: Kyle Pope Date: Tue, 17 Mar 2026 20:03:22 +0800 Subject: [PATCH] Fix 1st-of-month highlight bug and restore Calendars header selectedDate now only set by user clicks in mini calendar, not by external currentDate prop (which is always 1st of displayed month from FullCalendar's view.currentStart). Restore h-16 "Calendars" header above mini calendar for consistent top-of-page alignment. Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/components/calendar/CalendarSidebar.tsx | 3 +++ frontend/src/components/calendar/MiniCalendar.tsx | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/calendar/CalendarSidebar.tsx b/frontend/src/components/calendar/CalendarSidebar.tsx index 4dbeb79..7cac30a 100644 --- a/frontend/src/components/calendar/CalendarSidebar.tsx +++ b/frontend/src/components/calendar/CalendarSidebar.tsx @@ -99,6 +99,9 @@ const CalendarSidebar = forwardRef(functio return (
+
+ Calendars +
{onDateClick && (
currentDate ? startOfMonth(parseDate(currentDate)) : startOfMonth(new Date()) ); - const [selectedDate, setSelectedDate] = useState( - currentDate ?? null - ); + const [selectedDate, setSelectedDate] = useState(null); // Sync displayed month when main calendar navigates across months + // selectedDate is only set by user clicks in the mini calendar, not by external navigation useEffect(() => { if (!currentDate) return; const incoming = startOfMonth(parseDate(currentDate)); setDisplayedMonth((prev) => prev.getTime() === incoming.getTime() ? prev : incoming ); - setSelectedDate((prev) => prev === currentDate ? prev : currentDate); }, [currentDate, parseDate]); const days = useMemo(