Document how the views switch (#184)

This commit is contained in:
2026-09-27 19:31:59 +02:00
parent f9dd7a22b7
commit 254fafe42b
3 changed files with 39 additions and 12 deletions
@@ -71,8 +71,9 @@ import kotlin.time.Clock
/**
* Holds the top-level view back stack (spec M1) and swaps between the calendar
* screens. Each screen owns its own ViewModel and date anchor; the view-switcher
* pill in their top bars writes back here via [onSelectView].
* screens. Each screen owns its own ViewModel; they all open on the one focused
* date held here ([ViewFocus]), and the view-switcher pill in their top bars
* writes back here via [onSelectView].
*
* The stack's bottom is the user's [CalendarHostViewModel.defaultView] home view.
* A lateral switch (pill / drawer) builds a visit history so back retraces it
@@ -382,7 +383,7 @@ fun CalendarHost(
}
Box(modifier = modifier.fillMaxSize()) {
// Switching between the peer views (month/week/day/agenda) is lateral
// Switching between the month, timeline and agenda screens is lateral
// navigation, so it fades through rather than sliding — paging *within* a
// view keeps the directional slide. What both views show morphs across
// (#184): see [ViewMorphKey]. Reduced motion keeps the plain fade.
@@ -37,5 +37,5 @@ val LocalViewFocus = staticCompositionLocalOf<ViewFocus?> { null }
@Composable
fun <T : Any> EnterOnFocus(key: T, enter: (LocalDate) -> Unit) {
val focus = LocalViewFocus.current
remember(key) { focus?.let { enter(it.date) } }
remember(key) { focus?.date?.also(enter) }
}