Clear mini calendar selection on main calendar navigation
Clicking Today/prev/next on the toolbar now clears the selected day in the mini calendar, so only the today highlight remains visible. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2d76ecf869
commit
bda02039a6
@ -44,14 +44,15 @@ const MiniCalendar = memo(function MiniCalendar({
|
||||
);
|
||||
const [selectedDate, setSelectedDate] = useState<string | null>(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
|
||||
// Sync displayed month when main calendar navigates (toolbar prev/next/today)
|
||||
// Also clear selected date — avoids stale highlight after "Today" click
|
||||
useEffect(() => {
|
||||
if (!currentDate) return;
|
||||
const incoming = startOfMonth(parseDate(currentDate));
|
||||
setDisplayedMonth((prev) =>
|
||||
prev.getTime() === incoming.getTime() ? prev : incoming
|
||||
);
|
||||
setSelectedDate(null);
|
||||
}, [currentDate, parseDate]);
|
||||
|
||||
const days = useMemo(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user