refactor(agenda): put range header and pill on one bar
Move the session range pill from the bottom-left corner onto the same top bar as the "Showing all upcoming events for …" header — header on the left, pill on the right, each still independently toggleable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -149,38 +149,48 @@ fun AgendaScreen(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { innerPadding ->
|
) { innerPadding ->
|
||||||
Box(modifier = Modifier.fillMaxSize()) {
|
Column(
|
||||||
Column(
|
modifier = Modifier
|
||||||
modifier = Modifier
|
.fillMaxSize()
|
||||||
.fillMaxSize()
|
.padding(innerPadding),
|
||||||
.padding(innerPadding),
|
) {
|
||||||
) {
|
// One bar at the top: the "showing …" header on the left and the
|
||||||
// A header naming the concrete window currently shown.
|
// session range pill on the right (each toggleable independently).
|
||||||
successState?.takeIf { it.showRangeBanner }?.let { s ->
|
val s = successState
|
||||||
AgendaRangeBanner(range = s.range, start = s.anchor, end = s.rangeEnd)
|
if (s != null && (s.showRangeBanner || s.showRangePill)) {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(start = 28.dp, end = 16.dp, top = 8.dp, bottom = 8.dp),
|
||||||
|
) {
|
||||||
|
if (s.showRangeBanner) {
|
||||||
|
AgendaRangeBanner(
|
||||||
|
range = s.range,
|
||||||
|
start = s.anchor,
|
||||||
|
end = s.rangeEnd,
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Spacer(Modifier.weight(1f))
|
||||||
|
}
|
||||||
|
if (s.showRangePill) {
|
||||||
|
AgendaRangePill(
|
||||||
|
range = s.range,
|
||||||
|
isOverride = s.rangeIsOverride,
|
||||||
|
onClick = { showRangePicker = true },
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AgendaContent(
|
|
||||||
state = state,
|
|
||||||
onRetry = viewModel::goToToday,
|
|
||||||
onEventClick = onEventClick,
|
|
||||||
modifier = Modifier
|
|
||||||
.weight(1f)
|
|
||||||
.fillMaxWidth(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// A bottom-left pill to peek at a different range for this
|
|
||||||
// session, mirroring the FAB column on the right.
|
|
||||||
successState?.takeIf { it.showRangePill }?.let { s ->
|
|
||||||
AgendaRangePill(
|
|
||||||
range = s.range,
|
|
||||||
isOverride = s.rangeIsOverride,
|
|
||||||
onClick = { showRangePicker = true },
|
|
||||||
modifier = Modifier
|
|
||||||
.align(Alignment.BottomStart)
|
|
||||||
.padding(innerPadding)
|
|
||||||
.padding(16.dp),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
AgendaContent(
|
||||||
|
state = state,
|
||||||
|
onRetry = viewModel::goToToday,
|
||||||
|
onEventClick = onEventClick,
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.fillMaxWidth(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,7 +265,7 @@ private fun AgendaRangeBanner(
|
|||||||
) {
|
) {
|
||||||
val locale = currentLocale()
|
val locale = currentLocale()
|
||||||
val window = agendaRangeWindowSummary(range, start, end, locale)
|
val window = agendaRangeWindowSummary(range, start, end, locale)
|
||||||
Column(modifier = modifier.padding(horizontal = 28.dp, vertical = 8.dp)) {
|
Column(modifier = modifier) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.agenda_range_showing_label),
|
text = stringResource(R.string.agenda_range_showing_label),
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
|
|||||||
Reference in New Issue
Block a user