fix(month): point the split slide the way the month moves (#53)
Tapping a greyed leading/trailing day in the split grid follows the selection to that day's own month, but selectDate never set the slide direction — so the incoming page reused whatever the last swipe left in slideDir and could travel backwards while navigation moved forwards. Wrap selectDate so a tap that crosses months points slideDir at the month it is actually heading to. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -297,6 +297,15 @@ fun MonthScreen(
|
|||||||
viewModel.goToDate(target)
|
viewModel.goToDate(target)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Selecting a day in the split grid can cross into a neighbour month — a
|
||||||
|
// tapped leading/trailing day follows to its own month. Point the slide the
|
||||||
|
// way the month is actually moving, so the incoming page travels the right
|
||||||
|
// direction instead of reusing whatever the last swipe left in slideDir.
|
||||||
|
val selectDay: (LocalDate) -> Unit = { date ->
|
||||||
|
val target = YearMonth(date.year, date.month)
|
||||||
|
if (target != month) slideDir = if (target < month) -1 else 1
|
||||||
|
viewModel.selectDate(date)
|
||||||
|
}
|
||||||
|
|
||||||
ModalNavigationDrawer(
|
ModalNavigationDrawer(
|
||||||
drawerState = drawerState,
|
drawerState = drawerState,
|
||||||
@@ -377,7 +386,7 @@ fun MonthScreen(
|
|||||||
onSwipeNext = goNext,
|
onSwipeNext = goNext,
|
||||||
onSwipePrev = goPrev,
|
onSwipePrev = goPrev,
|
||||||
onRetry = jumpToToday,
|
onRetry = jumpToToday,
|
||||||
onSelectDay = viewModel::selectDate,
|
onSelectDay = selectDay,
|
||||||
onOpenDay = onOpenDay,
|
onOpenDay = onOpenDay,
|
||||||
onEventClick = onEventClick,
|
onEventClick = onEventClick,
|
||||||
onCreateEvent = { onCreateEvent(it, null) },
|
onCreateEvent = { onCreateEvent(it, null) },
|
||||||
|
|||||||
Reference in New Issue
Block a user